Module: Bio::Alignment::OriginalPrivate

Included in:
OriginalAlignment
Defined in:
lib/bio/alignment.rb

Overview

Bio::Alignment::OriginalPrivate is a set of private methods for Bio::Alignment::OriginalAlignment.

Class Method Summary collapse

Class Method Details

.extract_key(obj) ⇒ Object

Gets the name or the definition of the sequence from given object.


1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
# File 'lib/bio/alignment.rb', line 1493

def extract_key(obj)
  sn = nil
  for m in [ :definition, :entry_id ]
    begin
      sn = obj.send(m)
    rescue NameError, ArgumentError
      sn = nil
    end
    break if sn
  end
  sn
end

.extract_seq(obj) ⇒ Object

Gets the sequence from given object.


1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
# File 'lib/bio/alignment.rb', line 1478

def extract_seq(obj)
  if obj.is_a?(Bio::Sequence::NA) or obj.is_a?(Bio::Sequence::AA) then
    obj
  else
    meth = [ :seq, :naseq, :aaseq ].find {|m|
      obj.respond_to? m
    }
    meth ?
      obj.__send__(meth) :
      obj
  end
end