class Bio::NeXML::Matrix

Attributes

id[RW]

Because matrix elements don’t have id attributes, we will use object_id in this case

Public Class Methods

new( options = {} ) click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 547
def initialize( options = {} )
  @id = self.object_id
  properties( options ) unless options.empty?
  block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given?        
end

Public Instance Methods

add_row( row ) click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 553
def add_row( row )
  # dummy for rdoc
end
delete_row( row ) click to toggle source

Remove a row from the matrix.

  • Arguments :

row( required ) - a Bio::NeXML::Row object.

  • Returns : the deleted object.

    matrix.delete_row( row )
    matrix.rows                #=> [ .. .. ]
    row.matrix                #=> nil
    
# File lib/bio/db/nexml/matrix.rb, line 570
def delete_row( row )
  # dummy for rdoc
end
each_row() click to toggle source

Iterate over each row ( Bio::NeXML::Row object ) defined for the matrix. Returns an Enumerator if no block is provided.

# File lib/bio/db/nexml/matrix.rb, line 609
def each_row
  # dummy for rdoc
end
get_row_by_id( id ) click to toggle source

Fetch a row ( Bio::NeXML::Row object ) by id. Returns nil if none found.

# File lib/bio/db/nexml/matrix.rb, line 575
def get_row_by_id( id )
  # dummy for rdoc
end
has_row?( rows ) click to toggle source

Returns true if the given row( Bio::NeXML::Row object ) is defined for the matrix.

# File lib/bio/db/nexml/matrix.rb, line 603
def has_row?( rows )
  # dummy for rdoc
end
has_rows?( rows ) click to toggle source

Returns true if the given row ( Bio::NeXML::Row object ) is defined for the matrix block.

# File lib/bio/db/nexml/matrix.rb, line 559
def has_rows?( rows )
  # dummy for rdoc
end
number_of_rows() click to toggle source

Returns the number of rows defined for the matrix.

# File lib/bio/db/nexml/matrix.rb, line 580
def number_of_rows
  # dummy for rdoc
end
rows() click to toggle source

Returns an array of rows( Bio::NeXML::Rows objects ) for the matrix.

matrix.rows  #=> [ .. .. ]
# File lib/bio/db/nexml/matrix.rb, line 587
def rows
  # dummy for rdoc
end
rows=( rows ) click to toggle source

Add rowsthe matrix. This function will overwrite previous rows for the matrix if any.

  • Arguments :

rows( required ) - an array of Bio::NeXML::Row object.

matrix.rows = [ rows ]
matrix.rows    #=> [ rows ]
rows.matrix    #=> matrix
# File lib/bio/db/nexml/matrix.rb, line 598
def rows=( rows )
  # dummy for rdoc
end
to_xml() click to toggle source
# File lib/bio/db/nexml/matrix.rb, line 618
def to_xml
  node = @@writer.create_node( "matrix" )
  self.each_row do |row|
    node << row.to_xml
  end
  node
end