Thank you. It was very helpful.
• 0 views
•
link
I have a batch protein FASTA file. I wan to create output file with position for each amino acid with possible mutation (remaining 19 aa) in tab-delimited file.
e.g. sequence
>sp|Q6NUK1|SCMC1_HUMAN Calcium-binding mitochondrial carrier protein
MLRWLRDFVLPTAACQDAEQPTRYETLFQALDRNGDGVVDIGELQEGLRNLGIPLGQDAE
>sp|Q6KCM7|SCMC2_HUMAN Calcium-binding mitochondrial carrier protein
MLCLCLYVPVIGEAQTEFQYFESKGLPAELKSIFKLSVFIPSQEFSTYRQWKQKIVQAGD
Output file; (Protein ID, position, amino acid, substitution(19). It will be given for all protein(around 4000)
Q6NUK1 1 M A
Q6NUK1 1 M R
Q6NUK1 1 M N
Q6NUK1 1 M D
Q6NUK1 1 M C
Q6NUK1 1 M Q
Q6NUK1 1 M E
Q6NUK1 1 M G
Q6NUK1 1 M H
Q6NUK1 1 M I
Q6NUK1 1 M L
Q6NUK1 1 M K
Q6NUK1 1 M F
Q6NUK1 1 M P
Q6NUK1 1 M S
Q6NUK1 1 M T
Q6NUK1 1 M W
Q6NUK1 1 M Y
Q6NUK1 1 M V
It's very easy using BioPython:
from Bio import SeqIO
from Bio.Alphabet import IUPAC
for seq_record in SeqIO.parse("example.fasta", "fasta"):
record_name=seq_record.id.split("|")[1]
for I in range(0,len(seq_record.seq)):
letter=seq_record.seq[i]
position=i+1
IUPAC_list=list(IUPAC.protein.letters)
IUPAC_list.remove(letter)
for item in IUPAC_list:
new_list=[record_name,str(position),letter,item]
print(("\t").join(new_list))
Thank you. It was very helpful.
Log in to answer this question.