class Bio::Nexus::DataBlock

DESCRIPTION

Bio::Nexus::DataBlock represents a data nexus block. A data block is a Bio::Nexus::CharactersBlock with the added capability to store taxa names.

Example of Data block:

Begin Data;

Dimensions ntax=5 nchar=14;
Format Datatype=RNA gap=# MISSING=x MatchChar=^;
TaxLabels ciona cow [comment] ape 'purple urchin' "green lizard";
Matrix
 taxon_1 A- CCGTCGA-GTTA
 taxon_2 T- CCG-CGA-GATA
 taxon_3 A- C-GTCGA-GATA
 taxon_4 A- CCTCGA--GTTA
 taxon_5 T- CGGTCGT-CTTA;

End;

USAGE

require 'bio/db/nexus'

# Create a new parser:
nexus = Bio::Nexus.new( nexus_data_as_string )

# Get first data block:
data_block = nexus.get_data_blocks[ 0 ]
# Get first characters name:
seq_name = data_block.get_row_name( 0 )
# Get first characters row named "taxon_2" as Bio::Sequence sequence:
seq_tax_2 = data_block.get_sequences_by_name( "taxon_2" )[ 0 ]
# Get third characters row as Bio::Sequence sequence:
seq_2 = data_block.get_sequence( 2 )
# Get first characters row named "taxon_3" as String:
string_tax_3 = data_block.get_characters_strings_by_name( "taxon_3" )
# Get name of first taxon:
taxon_0 = data_block.get_taxa[ 0 ]
# Get characters matrix as Bio::Nexus::NexusMatrix (names are in column 0)
characters_matrix = data_block.get_matrix