[Biopython] How to use SeqRecord to get the subseq location information
Liu, XiaoChuan
xiaochuan.liu at mssm.edu
Fri May 4 16:19:47 UTC 2012
Hi Bow,
Thank you very much for your helps!
But according to your suggestion, I also face this problem. See below:
>>> example_feature = SeqFeature(FeatureLocation(0, 88), 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(0),ExactPosition(88)), 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=[])
>>> subseq.features
[]
I could not get the location information of subseq yet. Why? Thank you very much!
Best,
Xiaochuan
-----Original Message-----
From: Wibowo Arindrarto [mailto:w.arindrarto at gmail.com]
Sent: Friday, May 04, 2012 2:10 AM
To: Liu, XiaoChuan
Cc: biopython at biopython.org
Subject: Re: [Biopython] How to use SeqRecord to get the subseq location information
Hi Liu,
It looks like the problem is caused by the values you put in your SeqFeature. Your sequence length is less than the feature location values. If you try plugging in a number in range, like this:
>>> example_feature = SeqFeature(FeatureLocation(5, 7), type="mRNA",
>>> strand=-1)
You should still keep the feature in your subsequence, like so:
>>> subseq = simple_seq_r[3:10]
>>> subseq.features
[SeqFeature(FeatureLocation(ExactPosition(2), ExactPosition(4), strand=-1), type='mRNA')]
Hope that helps :),
cheers,
Bow
More information about the Biopython
mailing list