Skip to content

Instantly share code, notes, and snippets.

@leipzig
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leipzig/050ee1d5346e70418718 to your computer and use it in GitHub Desktop.
Save leipzig/050ee1d5346e70418718 to your computer and use it in GitHub Desktop.
access Haplogrep compatible input from a Genbank id
#!/usr/bin/perl
use LWP::UserAgent;
use HTTP::Request::Common;
my $userAgent = LWP::UserAgent->new(timeout => 1800); #a half-hour
my $request = POST 'http://mitomaster.mitomap.org/cgi-bin/websrvc.cgi', [
gb => $ARGV[0],
fileType => 'id',
output => 'hsd'
];
my $response = $userAgent->request($request);
print $response->error_as_HTML . "\n" if $response->is_error;
if ($response->is_success) {
print $response->decoded_content;
} else {
die $response->status_line;
}
@leipzig
Copy link
Author

leipzig commented Aug 20, 2014

usage:
perl gb_client.pl JX153710.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment