Add gene feature into genebank file
1
0
Entering edit mode
2.8 years ago

Hi, I would like to add some new features into genebank file in order to visulize them in some software like Snapgene.

I have create a dict with the position information and sequnce, like:

{Seq('TTCAGAGAAGCCTGAACTATTGGAGTGCTCGGCGGCT'): (129576, 129612), Seq('TTCAACGGACCCGGCTGTTCCCGACAGCTCCAGACGG'): (130899, 130607),Seq('TTCGAGTCTCTGCCGCAGCCGCTGGTTCTCCAAGGTG'): (129652, 129688)}

And I want to merge these sequences into gbk file and name them as "feature1, feature2 ... ..."

caution: sometimes the sequence is reverse, like second sequence (130899, 130607)

How can I do it by using biopython or other methods? I want everything to be sorted by position

Thanks a lot, good man.

feature genebank Biopython • 719 views
ADD COMMENT
2
Entering edit mode
2.8 years ago

What you need to build is a SeqRecord object that has SeqFeatures and FeatureLocation instances.

Note that you can't just add sequences as features, the features are relative to the sequence that the GenBank record describes, here is an example of how to create objects that can be saved as GenBank

from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.SeqFeature import SeqFeature, FeatureLocation
from Bio import SeqIO

ann = dict(molecule_type="DNA")

seq = Seq('ATGC')
rec = SeqRecord(seq, id="test", annotations=ann)
feat = SeqFeature(FeatureLocation(1, 2), type='CDS')
rec.features.append(feat)

SeqIO.write(rec, 'output.gb', 'genbank')
ADD COMMENT

Login before adding your answer.

Traffic: 5724 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