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.


1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
# File 'lib/bio/alignment.rb', line 1498

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
1490
1491
1492
1493
1494
# File 'lib/bio/alignment.rb', line 1478

def extract_seq(obj)
  seq = nil
  if obj.is_a?(Bio::Sequence::NA) or obj.is_a?(Bio::Sequence::AA) then
    seq = obj
  else
    for m in [ :seq, :naseq, :aaseq ]
      begin
        seq = obj.send(m)
      rescue NameError, ArgumentError
        seq = nil
      end
      break if seq
    end
    seq = obj unless seq
  end
  seq
end