- public static void ensurePresenceOfTaxonomy( final PhylogenyNode node ) {
- if ( !node.getNodeData().isHasTaxonomy() ) {
- node.getNodeData().setTaxonomy( new Taxonomy() );
- }
- }
-
- public static void ensurePresenceOfSequence( final PhylogenyNode node ) {
- if ( !node.getNodeData().isHasSequence() ) {
- node.getNodeData().setSequence( new Sequence() );
- }
- }
-
- final public static void ensurePresenceOfDistribution( final PhylogenyNode node ) {
- if ( !node.getNodeData().isHasDistribution() ) {
- node.getNodeData().setDistribution( new Distribution( "" ) );
- }
- }
-
- final public static void ensurePresenceOfDate( final PhylogenyNode node ) {
- if ( !node.getNodeData().isHasDate() ) {
- node.getNodeData().setDate( new org.forester.phylogeny.data.Date() );
- }
- }
-
- final static public boolean isHasAtLeastOneBranchWithSupportValues( final Phylogeny phy ) {
- final PhylogenyNodeIterator it = phy.iteratorPostorder();
- while ( it.hasNext() ) {
- if ( it.next().getBranchData().isHasConfidences() ) {
- return true;
- }
- }
- return false;
- }
-
- public static void writePhylogenyToGraphicsFileNonInteractive( final File intree,
- final File outfile,
- final int width,
- final int height,
- final GraphicsExportType type,
- final Configuration config ) throws IOException {
- final PhylogenyParser parser = ParserUtils.createParserDependingOnFileType( intree, true );
- Phylogeny[] phys = null;
- phys = PhylogenyMethods.readPhylogenies( parser, intree );
- final MainFrameApplication mf = MainFrameApplication.createInstance( phys, config );
- AptxUtil.writePhylogenyToGraphicsFileNonInteractive( outfile, width, height, mf.getMainPanel()
- .getCurrentTreePanel(), mf.getMainPanel().getControlPanel(), type, mf.getOptions() );
- mf.end();
- }
-
- /**
- * Returns true if at least one branch has a length larger than zero.
- *
- *
- * @param phy
- */
- final static public boolean isHasAtLeastOneBranchLengthLargerThanZero( final Phylogeny phy ) {
- final PhylogenyNodeIterator it = phy.iteratorPostorder();
- while ( it.hasNext() ) {
- if ( it.next().getDistanceToParent() > 0.0 ) {
- return true;
- }
- }
- return false;
- }
-
- final static public boolean isHasAtLeastNodeWithEvent( final Phylogeny phy ) {
- final PhylogenyNodeIterator it = phy.iteratorPostorder();
- while ( it.hasNext() ) {
- if ( it.next().getNodeData().isHasEvent() ) {
- return true;
- }
- }
- return false;
- }
-
- public static MaskFormatter createMaskFormatter( final String s ) {
- MaskFormatter formatter = null;
- try {
- formatter = new MaskFormatter( s );
- }
- catch ( final ParseException e ) {
- throw new IllegalArgumentException( e );
- }
- return formatter;
- }
-