Module: Bio::BioAlignment::Coerce
- Included in:
- Alignment
- Defined in:
- lib/bio-alignment/coerce.rb
Class Method Summary collapse
-
.fetch_id(seq) ⇒ Object
Make BioRuby’s entry_id compatible with id.
-
.fetch_seq(seq) ⇒ Object
Coerce BioRuby’s sequence objects to return the sequence itself.
-
.fetch_seq_string(seq) ⇒ Object
Coerce sequence objects into a string.
-
.to_elements(seq) ⇒ Object
Coerce sequence objects into elements.
Class Method Details
.fetch_id(seq) ⇒ Object
Make BioRuby’s entry_id compatible with id
5 6 7 8 9 10 11 12 13 |
# File 'lib/bio-alignment/coerce.rb', line 5 def Coerce::fetch_id seq if seq.respond_to?(:id) seq.id elsif seq.respond_to?(:entry_id) seq.entry_id else "id?" end end |
.fetch_seq(seq) ⇒ Object
Coerce BioRuby’s sequence objects to return the sequence itself
16 17 18 19 20 21 22 |
# File 'lib/bio-alignment/coerce.rb', line 16 def Coerce::fetch_seq seq if seq.respond_to?(:seq) seq.seq else seq end end |
.fetch_seq_string(seq) ⇒ Object
Coerce sequence objects into a string
25 26 27 28 29 30 31 32 |
# File 'lib/bio-alignment/coerce.rb', line 25 def Coerce::fetch_seq_string seq s = fetch_seq(seq) if s.respond_to?(:join) s.join else s.to_s end end |