Bio-WebService-LANL-SequenceLocator
view release on metacpan or search on metacpan
examples/rest.pl view on Meta::CPAN
use LWP::UserAgent;
my $agent = LWP::UserAgent->new( agent => 'you@example.com' );
my $response = $agent->post(
"https://indra.mullins.microbiol.washington.edu/locate-sequence/within/hiv" => [
sequence => "TCATTATATAATACAGTAGCAACCCTCTATTGTGTGCATCAAAGG",
],
);
unless ($response->is_success) {
die "Request failed: ", $response->status_line, "\n",
$response->decoded_content;
}
my $results = decode_json( $response->decoded_content );
# $results is now an array ref, like the JSON above
print $results->[0]{polyprotein}, "\n";
lib/Bio/WebService/LANL/SequenceLocator.pm view on Meta::CPAN
my $self = shift;
my $req = shift;
my $response = $self->agent->request($req);
if (not $response->is_success) {
warn sprintf "Request failed: %s %s -> %s\n",
$req->method, $req->uri, $response->status_line;
return;
}
return $response->decoded_content;
}
=head2 find
Takes an array ref of sequence strings. Sequences may be in amino acids or
nucleotides and mixed freely. Sequences should not be in FASTA format.
If sequence bases are not clearly nucleotides or clearly amino acids, LANL
seems to default to nucleotides. This can be an issue for some sequences since
the full alphabet for nucleotides overlaps with the alphabet for amino acids.
share/about.html view on Meta::CPAN
use LWP::UserAgent;
my $agent = LWP::UserAgent->new( agent => 'you@example.com' );
my $response = $agent->post(
"https://indra.mullins.microbiol.washington.edu/locate-sequence/within/hiv" => [
sequence => "TCATTATATAATACAGTAGCAACCCTCTATTGTGTGCATCAAAGG",
],
);
unless ($response->is_success) {
die "Request failed: ", $response->status_line, "\n",
$response->decoded_content;
}
my $results = decode_json( $response->decoded_content );
# $results is now an array ref, like the JSON above
print $results->[0]{polyprotein}, "\n";
</pre>
<a name="python"></a>
<h3>Python</h3>
<pre>
#!/usr/bin/env python2
from urllib2 import Request, urlopen, URLError
%{$test->{args} || {}},
],
);
} else {
@data = [
sequence => $test->{sequences},
%{$test->{args} || {}},
];
}
my $response = request( POST '/within/hiv' => @data );
my $results = $response->decoded_content;
if ($response->content_type =~ /^application\/json/) {
$results = decode_json($results);
}
return $results;
}
sub request {
state $app = Bio::WebService::LANL::SequenceLocator::Server->new(
contact => 'automated testing'
);
( run in 0.403 second using v1.01-cache-2.11-cpan-26ccb49234f )