Method: Bio::Alignment::OriginalAlignment#index

Defined in:
lib/bio/alignment.rb

#index(seq) ⇒ Object

Returns the key for a given sequence. If not found, returns nil.



1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
# File 'lib/bio/alignment.rb', line 1816

def index(seq)
  #(Hash-like)
  last_key = nil
  self.each_pair do |k, s|
    last_key = k
    if s.class == seq.class then
      r = (s == seq)
    else
      r = (s.to_s == seq.to_s)
    end
    break if r
  end
  last_key
end