Read a protein fasta file and splitting the read string at Arginine(R) and then blastp the peptides to get the matches?

StackOverflow https://stackoverflow.com/questions/16994465

Question

I have the following fasta file:

'>gi|277456704|dbj|ID_P|Gene name LLL
MDGFAGSLDDSISAASTSDVQDRLSALESRVQQQEDEITVLKAALADVLRRLAISEDHVASVKKSVSSKV
YRRKHQELQAMQMELQSPEYKLSKLRTSTIMTDYNPNYCFAGKTSSISDLKEVPRKNITLIRGLGHGAFG
EVYEGQVSGMPNDPSPLQVAVKTLPEVCSEQDELDFLMEALIISKFNHQNIVRCIGVSLQSLPRFILLEL
MAGGDLKSFLRETRPRPSQPSSLAMLDLLHVARDIACGCQYLEENHFIHRDIAARNCLLTCPGPGRVAKI
GDFGMARDIYRASYYRKGGCAMLPVKWMPPEAFMEGIFTSKTDTWSFGVLLWEIFSLGYMPYPSKSNQEV
LEFVTSGGRMDPPKNCPGPVYRIMTQCWQHQPEDRPNFAIILERIEYCTQDPDVINTALPIEYGPLVEEE

'>gi|27704|dbj|ID_Y|Gene name JJJ
MDGFAGSLDDSISAASTSDVQDRLSALESRVQQQEDEITVLKAALADVLRRLAISEDHVASVKKSVSSKG
SELRGGYGDPGRLPVGSGLCSASRARLPGHVAADHPPAVYRRKHQELQAMQMELQSPEYKLSKLRTSTIM
TDYNPNYCFAGKTSSISDLKEVPRKNITLIRGLGHGAFGEVYEGQVSGMPNDPSPLQVAVKTLPEVCSEQ
DELDFLMEALIISKFNHQNIVRCIGVSLQSLPRFILLELMAGGDLKSFLRETRPRPSQPSSLAMLDLLHV
ARDIACGCQYLEENHFIHRDIAARNCLLTCPGPGRVAKIGDFGMARDIYRASYYRKGGCAMLPVKWMPPE

'>gi|2097704|dbj|ID_X|Gene name X
MDGFAGSLDDSISAASTSDVQDRLSALESRVQQQEDEITVLKAALADVLRRLAISEDHVASVKKSVSSKG
QPSPRAVIPMSCITNGSGANRKPSHTSAVSIAGKETLSSAAKSGTEKKKEKPQGQREKKEESHSNDQSPQ
IRASPSPQPSSQPLQIHRQTPESKNATPTKSIKRPSPAEKSHNSWENSDDSRNKLSKIPSTPKLIPKVTK
TADKHKDVIINQEGEYIKMFMRGRPITMFIPSDVDNYDDIRTELPPEKLKLEWAYGYRGKDCRANVYLLP
TGEIVYFIASVVVLFNYEERTQRHYLGHTDCVKCLAIHPDKIRIATGQIAGVDKDGRPLQPHVRVWDSVT
LSTLQIIGLGTFERGVGCLDFSKADSGVHLCVIDDSNEHMLTVWDWQRKAKGAEIKTTNEVVLAVEFHPT

I would like to loop through the FASTA , split the protein sequence at all the 'R' it comes across, this will generate peptides and then blastp the peptides. Get the results from blastp and store the blastp results in a separate file for each protein ID in the fasta file. I am not particular about what language is used. I want to learn how this can be done so that i can build more functionality on top of it. Thanks!

Was it helpful?

Solution

With Biopython, you can parse the FASTA file into Sequence objects, split at "R", then BLAST over the internet or run BLAST locally. You can take the results (expressed as SeqRecords, and output them to a FASTA file by iterating over each record.

The documentation has plenty of code samples you can use to piece together what you're looking for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top