Method: Bio::Nexus::NexusMatrix#get_value

Defined in:
lib/bio/db/nexus.rb

#get_value(row, col) ⇒ Object

Returns the value at row ‘row’ and column ‘col’.


Arguments:

  • (required) row: Integer

  • (required) col: Integer

Returns

Object



1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
# File 'lib/bio/db/nexus.rb', line 1623

def get_value( row, col )
  if ( ( row > get_max_row() ) || ( row < 0 ) ) 
    raise( NexusMatrixError, "value for row (" + row.to_s +
      ") is out of range [max row: " + get_max_row().to_s + "]" )
  elsif ( ( col > get_max_col() ) || ( row < 0 ) )
    raise( NexusMatrixError, "value for column (" + col.to_s +
     ") is out of range [max column: " + get_max_col().to_s + "]" )
  end
  r = @rows[ row ]
  if ( ( r == nil ) || ( r.length < 1 ) ) 
    return nil
  end
  r[ col ]
end