Thanks! We ended up using a C script, but this worked well, and could be adapted with a for loop to run over a larger file.
I have a data frame of Uniprot Accessions and amino acid positions within each represented protein. I would like to extract a peptide of some length (lets say +/- 5 amino acids, total length of 11 residues), from Uniprot surrounding each position.
Example: Accession_position: P02699_311 Result: YIMMNKQFRNC
I've seen similar posts, but no solutions pertaining to solving this issue. Does anyone have hints for where to look to solve this, or better yet a solution already?
2 answers
Try:
use strict;
use warnings;
use Bio::DB::SwissProt;
my $pos = 311;
my $gb = new Bio::DB::SwissProt();
my $seqObj = $gb->get_Seq_by_id('P02699');
my $seq = $seqObj->seq();
my $peptide = substr($seq,$pos-6,11);
You have solved your problem, but just in case it may be useful for others:
You could write a script to transform your "identifiers" from
P02699_311 to P02699[306-316]
and then submit the resulting lists to the batch retrieve service on the UniProt website, http://www.uniprot.org/uploadlists
You can download the results in various formats, including FASTA (select "source list"), which looks like this:
>sp|P02699|306-316
YIMMNKQFRNC
>sp|P02699|308-318
MMNKQFRNCMV
>sp|P02699|309-319
MNKQFRNCMVT
Log in to answer this question.