[Biopython] How to print variants ?

Anirban Bhattachariya anbhat at utu.fi
Sun Jan 17 20:11:45 UTC 2010


Hi,

I'm trying to download a protein sequence object (using ID or accession number) and then trying to print its variants (all variant sequences) from its features and annotations.My script works fine so far and it prints number of sequence features.

The problem is, how can I print its variants ( should work for any ID) and all variant sequence?

Here is my code so far:

from Bio import Entrez 
from Bio import SeqIO

         
handle = Entrez.efetch(db=raw_input("What type of database? protein/nucleotide="),\
                       rettype=raw_input("which datbase you want to use? For example:genbank(gb)="),\
                       ID=raw_input("Enter the ID; for example human BChE contain lot of genetic \
varients,id is P06276="))


for seq_record in SeqIO.parse(handle, "gb") :
    print seq_record.id, seq_record.description[:50] + "..."
    print "Sequence length %i," % len(seq_record),
    print "%i features," % len(seq_record.features),
    print "from: %s" % seq_record.annotations["source"]
    print seq_record.annotations["keywords"]
    print repr(seq_record.seq)

    print "features:%i" % len(seq_record.features),

# [ code for printing variants? ]
        
handle.close()

Thanks in advance.

-Anirban





More information about the Biopython mailing list