[BioRuby] Bio::Sequence and Bio::Sequence::NA
Toshiaki Katayama
ktym at hgc.jp
Tue May 17 01:33:41 UTC 2011
Hi Anthony,
Bio::Sequence is a generic container class for a sequence with features which was
introduced relatively recently for interconversion of Bio::GenBank, Bio::EMBL and
Bio::SQL sequence objects (and it also provides common APIs for those seq objects).
Bio::Sequence#na or #auto method extract a sequence from a Bio::Sequence object, so
you should use another variable to store (instead of overriding the object reference).
> biosequence = biosequence.auto
seq = biosequence.auto
so that you can still access to biosequence.features.
% bioruby
bioruby> embl = Bio::EMBL.new(open("http://togows.dbcls.jp/entry/embl/J00231").read)
bioruby> embl.class
==> Bio::EMBL
bioruby> embl_bioseq = embl.to_biosequence
bioruby> embl_bioseq.class
==> Bio::Sequence
bioruby> embl_seq = embl_bioseq.auto
bioruby> embl_seq.class
==> Bio::Sequence::NA
Toshiaki
On 2011/05/16, at 18:07, Anthony Underwood wrote:
> Here's something that has alway puzzled me about BioRuby
>
> If I start with a Bio::EMBL object and want to extract the features I can do the following
>
> biosequence = embl_object.to_biosequence
>
> This returns an instance of a Bio::Sequence class. I can now access the features
>
> features = biosequence.features
>
> However if the sequence is nucleotide and I want to translate it I have to do the following
>
> biosequence.na
>
> OR
>
> biosequence = biosequence.auto
>
>
> This returns a Bio::Sequence::NA instance and I can now translate
>
> protein = biosequence.translate(1,11)
>
>
> Why can I not now get at the features
>
> biosequence.features #=> undefined method `features' for #<Bio::Sequence::NA:0x00000100cae5f8>
>
>
> I would have though that after converting to Bio::Sequence::NA or Bio::Sequence:AA the methods available to Bio::Sequence should still be available.
>
> Can anyone tell me what's going on here. Is there another method I should use?
>
>
> Thanks
>
> Anthony
> _______________________________________________
> BioRuby Project - http://www.bioruby.org/
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby
More information about the BioRuby
mailing list