Method: Bio::Nexus::DataBlock#to_nexus
- Defined in:
- lib/bio/db/nexus.rb
#to_nexus ⇒ Object
Returns a String describing this block as nexus formatted data.
- Returns
-
String
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 |
# File 'lib/bio/db/nexus.rb', line 1241 def to_nexus line_1 = String.new line_1 << DIMENSIONS if ( Nexus::Util::larger_than_zero( get_number_of_taxa ) ) line_1 << " " << NTAX << "=" << get_number_of_taxa end if ( Nexus::Util::larger_than_zero( get_number_of_characters ) ) line_1 << " " << NCHAR << "=" << get_number_of_characters end line_1 << DELIMITER line_2 = String.new line_2 << FORMAT if ( Nexus::Util::longer_than_zero( get_datatype ) ) line_2 << " " << DATATYPE << "=" << get_datatype end if ( Nexus::Util::longer_than_zero( get_missing ) ) line_2 << " " << MISSING << "=" << get_missing end if ( Nexus::Util::longer_than_zero( get_gap_character ) ) line_2 << " " << GAP << "=" << get_gap_character end if ( Nexus::Util::longer_than_zero( get_match_character ) ) line_2 << " " << MATCHCHAR << "=" << get_match_character end line_2 << DELIMITER line_3 = String.new line_3 << TAXLABELS << " " << Nexus::Util::array_to_string( get_taxa ) line_3 << DELIMITER line_4 = String.new line_4 << MATRIX Nexus::Util::to_nexus_helper( DATA_BLOCK, [ line_1, line_2, line_3, line_4 ] + get_matrix.to_nexus_row_array ) end |