How to compare multiple protein sequences and obtain single point mutations and their positions
Hi! I need your help. I'm working on a ML model and I need to compare a wt protein sequence to a list of 3000 mutated sequences. every mt sequence contains a single point mutation. the aim is to find every mutation and create two columns, one for the mutation position and the other for the type of mutation (aa symbol). Can you help me, please?
• 1,914 views
•
link
1 answer
If you really want to stick with Python and oversimplifying a ton, you could probably go to the EBI website and run a multiple sequence alignment using Clustal Omega; generate a 'dumb' consensus in Python; then finally write a script to compare sequences. Something on the line of:
from Bio import AlignIO
alignment = AlignIO.read('alignment.clustal', 'clustal')
from Bio.Align import AlignInfo
summary_align = AlignInfo.SummaryInfo(alignment)
consensus = summary_align.dumb_consensus()
variants = {}
for pep in alignment:
variants[pep.id] = []
for aa in range(len(pep.seq)):
if pep.seq[aa] == '-':
variants[pep.id].append([aa, 'deletion'])
elif consensus[aa] == '-':
variants[pep.id].append([aa, 'insertion'])
elif pep.seq[aa] != consensus[aa]:
variants[pep.id].append([aa, 'snp', pep.seq[aa]])
• 0 views
•
link
Log in to answer this question.
You can do this easily with a multiple sequence alignment tool and the
AlignIOmodule of biopython.Biostars is not a code writing service though. Judging by your tags you already know where to start, so please have a go and we will gladly help troubleshoot.