Hi everyone so I have a question how can you print out for each specific residue of a sequence in msa its msa position I tried something with biopython :
from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from Bio import AlignIO alignment = AlignIO.read(open("ADORA1.pfam"), "PFAM") def msa_position(aln, id, res_no): rec = next((r for r in aln if r.id==id), None) j = 0 for i, res in enumerate(rec.seq): if res!='-': if j==res_no: return i j+=1 print (msa_position(alignment, "ENST00000618295|ADORA1/1-210", 3))
However, i can only do it for one position at a time and i want output like
id Sequence_position msa_positon ENST00000618295|ADORA1 3 119 ENST00000618295|ADORA1 4 120
and so on
Sorry for the code writing its my first time on biostars.