import java.util.NoSuchElementException;
import java.util.Vector;
+import org.forester.io.parsers.nhx.NHXParser;
import org.forester.io.writers.PhylogenyWriter;
import org.forester.phylogeny.PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE;
import org.forester.phylogeny.data.BranchData;
import org.forester.phylogeny.data.Sequence;
import org.forester.phylogeny.data.SequenceRelation;
import org.forester.phylogeny.data.SequenceRelation.SEQUENCE_RELATION_TYPE;
+import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
+import org.forester.phylogeny.factories.PhylogenyFactory;
import org.forester.phylogeny.iterators.ExternalForwardIterator;
import org.forester.phylogeny.iterators.LevelOrderTreeIterator;
import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
return _distance_unit;
}
+ public final static Phylogeny createInstanceFromNhxString( final String nhx ) throws IOException {
+ final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ return factory.create( nhx, new NHXParser() )[ 0 ];
+ }
+
/**
*
* Warning. The order of the returned nodes is random
}
public String toNewHampshire() {
- return toNewHampshire( false, NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE );
+ return toNewHampshire( NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE );
}
- public String toNewHampshire( final boolean simple_nh,
- final NH_CONVERSION_SUPPORT_VALUE_STYLE nh_conversion_support_style ) {
+ public String toNewHampshire( final NH_CONVERSION_SUPPORT_VALUE_STYLE nh_conversion_support_style ) {
try {
- return new PhylogenyWriter().toNewHampshire( this, simple_nh, true, nh_conversion_support_style )
- .toString();
+ return new PhylogenyWriter().toNewHampshire( this, true, nh_conversion_support_style ).toString();
}
catch ( final IOException e ) {
throw new Error( "this should not have happend: " + e.getMessage() );