class Bio::NeXML::Matrix
Attributes
Because matrix elements don’t have id attributes, we will use object_id in this case
Public Class Methods
# 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
# File lib/bio/db/nexml/matrix.rb, line 553 def add_row( row ) # dummy for rdoc end
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
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
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
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
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
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
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
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
# 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