I have a list of UniProtKB Protein Accessions. I want to fetch the peptide sequence corresponding to each accession in fasta format. Preferably, all the fasta sequences should be combined into a single file.
I would like to do this programmatically, with C#.
UniProt's FAQ explains how to do it. However, the code example they give is Perl:
use strict;
use warnings;
use LWP::UserAgent;
my $list = $ARGV[0]; # File containg list of UniProt identifiers.
my $base = 'http://www.uniprot.org';
my $tool = 'batch';
my $contact = ''; # Please set your email address here to help us debug in case of problems.
my $agent = LWP::UserAgent->new(agent => "libwww-perl $contact");
push @{$agent->requests_redirectable}, 'POST';
my $response = $agent->post("$base/$tool/",
[ 'file' => [$list],
'format' => 'txt',
],
'Content_Type' => 'form-data');
while (my $wait = $response->header('Retry-After')) {
print STDERR "Waiting ($wait)...\n";
sleep $wait;
$response = $agent->get($response->base);
}
$response->is_success ?
print $response->content :
die 'Failed, got ' . $response->status_line .
' for ' . $response->request->uri . "\n";
I don't know Perl (and would prefer not having to learn it). I can see that it submits the required identifier with an HTTP POST, but I can't figure out what the HTTP POST is supposed to contain (it would be really helpful if I had URL that I could paste into my browser to manually download the file). I tried using Fiddler to intercept the request, but Strawberry Perl manages to circumvent Fiddler.
How would I accomplish the same thing this code is doing in C#? What is the correct way to submit the web request?
how about using http://www.uniprot.org/help/batch ?
I wish to do it programmatically, not manually.
You can do using one liner given by UCSC_UTILITIES. Once you download this use faSomeRecords