module Bio::Alignment::OriginalPrivate

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

Public Class Methods

extract_key(obj) click to toggle source

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

# 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) click to toggle source

Gets the sequence from given object.

# 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

Private Instance Methods

extract_key(obj) click to toggle source

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

# 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) click to toggle source

Gets the sequence from given object.

# 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