[Biopython] How to use SeqRecord to get the subseq location information

Liu, XiaoChuan xiaochuan.liu at mssm.edu
Thu May 3 22:46:58 UTC 2012


Dear all,

I face a problem: How to use SeqRecord to get the subseq location information?

My code is like this:

>>> from Bio.Seq import Seq

>>> simple_seq = Seq("gugggaagagggguggggcccgggacuguacccaugugaggacuauucuugaguccugcucuuguucugagcaccaccccucucucaga")

>>> from Bio.SeqRecord import SeqRecord

>>> from Bio.SeqFeature import SeqFeature, FeatureLocation

>>> example_feature = SeqFeature(FeatureLocation(25382494, 25382583), type="mRNA", strand=-1)

>>> simple_seq_r = SeqRecord(simple_seq, id="17_329.4",features=[example_feature])

>>> simple_seq_r
SeqRecord(seq=Seq('gugggaagagggguggggcccgggacuguacccaugugaggacuauucuugagu...aga', Alphabet()), id='17_329.4', name='<unknown name>', description='<unknown description>', dbxrefs=[])

>>> simple_seq_r.features
[SeqFeature(FeatureLocation(ExactPosition(25382494),ExactPosition(25382583)), type='mRNA', strand=-1)]

>>> simple_seq_r.features[0]
SeqFeature(FeatureLocation(ExactPosition(25382494),ExactPosition(25382583)), type='mRNA', strand=-1)

>>> subseq=simple_seq_r[3:10]
>>> subseq
SeqRecord(seq=Seq('ggaagag', Alphabet()), id='17_329.4', name='<unknown name>', description='<unknown description>', dbxrefs=[])

But when I type “subseq.features” like this:
>>> subseq.features
[]

I could not get the location information of subseq. Why? Do somebody know how to get these information? Thank you very much!

Best,

Xiaochuan




More information about the Biopython mailing list