Bio-EBI-RNAseqAPI
view release on metacpan or search on metacpan
lib/Bio/EBI/RNAseqAPI.pm view on Meta::CPAN
"\" is missing."
);
$allWantedPresent = 0;
}
}
# Next, check whether there are any unrecognised arguments. Just warn about
# them if so.
foreach my $argName ( sort keys %{ $argsHash } ) {
unless( $wantedArgNames{ $argName } ) {
$logger->warn(
"Argument \"",
$argName,
"\" is not recognised."
);
}
}
# Now return the flag to show whether all wanted arguments are present or
# not.
return $allWantedPresent;
}
# REST call running -- common to all the querying functions.
sub _run_rest_call {
my ( $self, $args ) = @_;
my $logger = $self->get_log_writer;
my $userAgent = $self->get_user_agent;
# Start building the query URL.
my $url = $self->get_api_base . "/json/";
# If we're passed a minimum percentage of mapped reads, add this to the URL
# next.
if( defined( $args->{ "minimum_mapped_reads" } ) ) {
$url .= $args->{ "minimum_mapped_reads" } . "/";
}
# Add the function name and argument to the end of the URL.
$url .= $args->{ "function_name" };
if( $args->{ "function_argument" } ) {
$url .= "/" . $args->{ "function_argument" };
}
# Run HTTP GET request.
my $response = $userAgent->get( $url );
# If the request was successful, return the parsed JSON.
if( $response->is_success ) {
return parse_json( $response->decoded_content );
}
# Otherwise, log an error and return undef.
else {
$logger->error(
"Problem retrieving URL: ",
$url,
" . Response from server: ",
$response->status_line
);
return;
}
}
# Check that the run organism name is allowed. This checks the passed string
# against the keys of the hash stored in the "run_organism_list" attribute.
sub _organism_name_ok {
my ( $self, $organism, $type ) = @_;
my $logger = $self->get_log_writer;
my $organismList = ( $type eq "run" ? $self->get_run_organism_list : $self->get_expression_organism_list );
if( $organismList->{ $organism } ) {
return 1;
}
else {
$logger->error(
"Organism \"",
$organism,
"\" is not an allowed organism. Check organisms against the run_organism_list attribute."
);
return;
}
}
=head1 AUTHOR
Maria Keays <mkeays@cpan.org>
The above email should be used for feedback about the Perl module only. All
mail regarding the RNA-seq analysis API itself should be directed to
<rnaseq@ebi.ac.uk>.
=cut
1;
( run in 2.599 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )