Skip to content
Snippets Groups Projects
Commit fdc5b341 authored by Matthew Laird's avatar Matthew Laird
Browse files

Merge pull request #120 from at7/at7/postrelease84/ld_windowsize

At7/postrelease84/ld windowsize
parents ddbd1697 bc0d30a9
No related branches found
No related tags found
1 merge request!132Update for Regulation Endpoint for e85 schema changes
......@@ -41,10 +41,10 @@ sub fetch_LDFeatureContainer_variation_name {
my $va = $c->model('Registry')->get_adaptor($species, 'Variation', 'Variation');
my $ldfca = $c->model('Registry')->get_adaptor($species, 'Variation', 'LDFeatureContainer');
my $window_size = $c->request->param('window_size') || 1000; # default is 1MB
Catalyst::Exception->throw("window_size needs to be a value between 0 and 1000.") if (!looks_like_number($window_size));
Catalyst::Exception->throw("window_size needs to be a value between 0 and 1000.") if ($window_size > 1000);
Catalyst::Exception->throw("window_size needs to be a value between 0 and 1000.") if ($window_size < 0);
my $window_size = $c->request->param('window_size') || 500; # default is 500KB
Catalyst::Exception->throw("window_size needs to be a value between 0 and 500.") if (!looks_like_number($window_size));
Catalyst::Exception->throw("window_size needs to be a value between 0 and 500.") if ($window_size > 500);
Catalyst::Exception->throw("window_size needs to be a value between 0 and 500.") if ($window_size < 0);
$window_size = floor($window_size);
my $max_snp_distance = ($window_size / 2) * 1000;
$ldfca->max_snp_distance($max_snp_distance);
......@@ -84,7 +84,7 @@ sub fetch_LDFeatureContainer_variation_name {
sub fetch_LDFeatureContainer_slice {
my ($self, $slice) = @_;
Catalyst::Exception->throw("No region given. Please specify a region to retrieve from this service.") if ! $slice;
Catalyst::Exception->throw("Specified region is too large. Maximum allowed size for region is 1Mb.") if ($slice->length > 1_000_000);
Catalyst::Exception->throw("Specified region is too large. Maximum allowed size for region is 500KB.") if ($slice->length > 500_000);
my $c = $self->context();
my $species = $c->stash->{species};
......
<endpoints>
<ld_id_get>
description=Computes and returns LD values between the given variant and all other variants in a window centered around the given variant. The window size is set to 1000 kb.
description=Computes and returns LD values between the given variant and all other variants in a window centered around the given variant. The window size is set to 500 kb.
endpoint=ld/:species/:id/:d_prime/:r2/:population_name/:window_size
method=GET
group=Linkage Disequilibrium
......@@ -40,8 +40,8 @@
</population_name>
<window_size>
type=Integer
description=Window size in kb. The maximum allowed value for the window size is 1000 kb. LD is computed for the given variant and all variants that are located within the specified window.
default=1000
description=Window size in kb. The maximum allowed value for the window size is 500 kb. LD is computed for the given variant and all variants that are located within the specified window.
default=500
example=__VAR(window_size)__
</window_size>
</params>
......
......@@ -88,7 +88,7 @@ $ld_get = '/ld/homo_sapiens/rs1333047?population_name=1000GENOMES:phase_1_ASW;d_
$json = json_GET($ld_get, 'GET LD data for variant, population, d_prime and window_size');
eq_or_diff($json, $expected_output, "Example variant, population, d_prime and window_size");
$ld_get = '/ld/homo_sapiens/rs1333047?population_name=1000GENOMES:phase_1_ASW;d_prime=1.0;window_size=500.123';
$ld_get = '/ld/homo_sapiens/rs1333047?population_name=1000GENOMES:phase_1_ASW;d_prime=1.0;window_size=499.123';
$json = json_GET($ld_get, 'GET LD data for variant, population, d_prime and window_size');
eq_or_diff($json, $expected_output, "Example variant, population, d_prime and window_size");
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment