When To Use Bio::Sequence::Na, And When To Use Bio::Sequence?
1
0
Entering edit mode
12.6 years ago
andrewjgrimm ▴ 10

When should I use the Bio::Sequence::NA class, and when should I use the Bio::Sequence class, if I've got a nucleotide sequence?

I assumed that you should use Bio::Sequence::NA when you know it's a nucleotide sequence, because otherwise, you're throwing information away - namely the fact that it's a nucleotide sequence, not an amino acid sequence.

However, there's methods available for Bio::Sequence, that aren't available for Bio::Sequence::NA. For example, I can do

string = "gattaca"
sequence = Bio::Sequence.new(string)
sequence.output_fasta

but I can't do the following

string = "gattaca"
na = Bio::Sequence::NA.new(string)
na.output_fasta # => NoMethodError

So which class should I be using, and why?

• 1.9k views
ADD COMMENT
0
Entering edit mode
12.6 years ago

As the documentation says

A Bio::Sequence object is a wrapper around the actual sequence, represented as either a Bio::Sequence::NA or a Bio::Sequence::AA object, For most users, this encapsulation will be completely transparent.

what this means is that the Sequence class offers additional functionality that makes it work identically with both nucleic and aminoacid sequences. In general you should use Bio::Sequence

ADD COMMENT
0
Entering edit mode

Does that mean I should do string = "gattaca"; na = Bio::Sequence::NA.new(string); sequence = Bio::Sequence.new(na)?

ADD REPLY
-1
Entering edit mode

no it means to forget that Bio::Sequence::NA even exists use the Bio::Sequence directly

ADD REPLY

Login before adding your answer.

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