gravatar for hugo.avila

2 hours ago by

I need to remove features from a gbk file that have split coordinates:

join{[5355286:5355459](+), [0:17](+)}
join{[5355286:5355459](+), [0:17](+)}

So far i was able to test features to check if they are CompaundLocation types, but i culd not remove all off then from the record object:

#!/usr/bin/env python

from Bio import SeqIO
import sys

records = SeqIO.parse(sys.argv[1],"genbank")

for record in records:
    for index, feature in enumerate(record.features):
        try:
            if feature.location.operator == "join":
                record.features.pop(index)
        except:
            pass
    SeqIO.write(record, "out.gbk", "genbank")

link

modified 2 hours ago

written
2 hours ago
by

hugo.avila10



Source link