Digesting contig sequence with multiple enzymes
1
0
Entering edit mode
9.8 years ago

I was trying get a length of each fragment produce by restriction enzyme for each contig present in my contigs.fasta. In my following example enzyme is AflII. So basically, I am digesting each contig with AflII enzyme. So my code for that is as follows

for record in Bio.SeqIO.parse(open("contigs.fasta"), "fasta"):
   printrecord.id, [len(fragment) for fragment in Bio.Restriction.AflII.catalyze(record.seq)])

Now, I have more than one enzyme and I have to generate digestion for that. How can I do it using BioPython?

Please let me know, If you are unclear about the question. PS: I am new to the topic and BioPython as well.

restriction enzymes digestion python biopython • 2.6k views
ADD COMMENT
1
Entering edit mode
9.8 years ago
capemaster • 0

Can you better explain your desiderata?

My code for what I understand is the following, but I'm not sure of what you want.

from Bio import SeqIO
from Bio.Restriction import *


multi = (BamHI, EcoRI, PstI) # just a few enzymes

for record in SeqIO.parse("contigs.fasta", "fasta"):
    for enz in range(len(multi)):
        coords = multi[enz].search(record.seq)
        for site in range(len(coords)):
            print  "%s    %d    %s" % (record.id, coords[site], multi[enz])
ADD COMMENT

Login before adding your answer.

Traffic: 1711 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6