Question: Fasta file substitution
1
gravatar for max1415r
4.2 years ago by
max1415r10
United States
max1415r10 wrote:

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.

eg. 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

 

snp sequence • 1.1k views
ADD COMMENTlink modified 4.2 years ago by mkulecka310 • written 4.2 years ago by max1415r10
1
gravatar for mkulecka
4.2 years ago by
mkulecka310
European Union
mkulecka310 wrote:

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))
ADD COMMENTlink modified 4.2 years ago • written 4.2 years ago by mkulecka310

Thank you. It was very helpful.

ADD REPLYlink written 4.2 years ago by max1415r10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 887 users visited in the last hour