final static boolean __ALLOW_PHYLOGENETIC_INFERENCE = true;
public final static String PRG_NAME = "Archaeopteryx";
- final static String VERSION = "0.9915 test";
- final static String PRG_DATE = "160727";
+ final static String VERSION = "0.9916 beta";
+ final static String PRG_DATE = "160817";
final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file";
final static String[] DEFAULT_FONT_CHOICES = {
"Arial Unicode MS", "Dialog", "SansSerif", "Sans", "Arial", "Helvetica" };
150,
150 );
final static short DEFAULT_NODE_SHAPE_SIZE_DEFAULT = 4;
+ static final int MAX_LENGTH_FOR_COLLAPSED_NAME = 8;
}
}
final void updateRankCollapseRankDisplay() {
+
+
if ( _rank_collapse_depth_tf != null ) {
final String r = obtainRankCollapseDepthValue();
if ( r.equals( "off" ) ) {
JCheckBoxMenuItem _right_line_up_domains_cbmi;
JCheckBoxMenuItem _line_up_renderable_data_cbmi;
JCheckBoxMenuItem _collapsed_with_average_height_cbmi;
+ JCheckBoxMenuItem _show_abbreviated_labels_for_collapsed_nodes_cbmi;
// _ print
JCheckBoxMenuItem _graphics_export_visible_only_cbmi;
JCheckBoxMenuItem _antialias_print_cbmi;
}
updateOptions( getOptions() );
}
+ else if ( o == _show_abbreviated_labels_for_collapsed_nodes_cbmi ) {
+ if ( _show_abbreviated_labels_for_collapsed_nodes_cbmi.isSelected() ) {
+ _show_abbreviated_labels_for_collapsed_nodes_cbmi.setSelected( true );
+ }
+ updateOptions( getOptions() );
+ }
else if ( o == _right_line_up_domains_cbmi ) {
if ( _right_line_up_domains_cbmi.isSelected() ) {
_line_up_renderable_data_cbmi.setSelected( true );
if ( ( _collapsed_with_average_height_cbmi != null ) && _collapsed_with_average_height_cbmi.isEnabled() ) {
options.setCollapsedWithAverageHeigh(_collapsed_with_average_height_cbmi.isSelected() );
}
+ if ( ( _show_abbreviated_labels_for_collapsed_nodes_cbmi != null ) && _show_abbreviated_labels_for_collapsed_nodes_cbmi.isEnabled() ) {
+ options.setShowAbbreviatedLabelsForCollapsedNodes(_show_abbreviated_labels_for_collapsed_nodes_cbmi.isSelected() );
+ }
}
_options_jmenu
+ .add( _show_abbreviated_labels_for_collapsed_nodes_cbmi = new JCheckBoxMenuItem( "Add Abbreviated Labels to Collapsed Subtrees" ) );
+
+
+
+ _options_jmenu
.add( _line_up_renderable_data_cbmi = new JCheckBoxMenuItem( MainFrame.LINE_UP_RENDERABLE_DATA ) );
customizeCheckBoxMenuItem( _search_case_senstive_cbmi, getOptions().isSearchCaseSensitive() );
customizeCheckBoxMenuItem( _show_scale_cbmi, getOptions().isShowScale() );
customizeCheckBoxMenuItem( _collapsed_with_average_height_cbmi, getOptions().isCollapsedWithAverageHeigh() );
+ customizeCheckBoxMenuItem( _show_abbreviated_labels_for_collapsed_nodes_cbmi, getOptions().isShowAbbreviatedLabelsForCollapsedNodes() );
+
customizeRadioButtonMenuItem( _non_lined_up_cladograms_rbmi,
getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP );
customizeRadioButtonMenuItem( _ext_node_dependent_cladogram_rbmi,
private boolean _color_all_found_nodes_when_coloring_subtree;
private boolean _parse_beast_style_extended_nexus_tags;
private boolean _collapsed_with_average_height;
+ private boolean _show_abbreviated_labels_for_collapsed_nodes;
private Options() {
init();
_ext_desc_data_to_return = NodeDataField.UNKNOWN;
_line_up_renderable_node_data = true;
_right_align_domains = false;
- _collapsed_with_average_height= true;
+ _collapsed_with_average_height = true;
+ _show_abbreviated_labels_for_collapsed_nodes = true;
}
final private void setNumberOfDigitsAfterCommaForBranchLength( final short number_of_digits_after_comma_for_branch_length_values ) {
final void setCollapsedWithAverageHeigh( final boolean collapsed_with_average_height ) {
_collapsed_with_average_height = collapsed_with_average_height;
}
+
+ final boolean isShowAbbreviatedLabelsForCollapsedNodes() {
+ return _show_abbreviated_labels_for_collapsed_nodes;
+ }
+
+ final void setShowAbbreviatedLabelsForCollapsedNodes(final boolean show_abbreviated_labels_for_collapsed_nodes) {
+ _show_abbreviated_labels_for_collapsed_nodes = show_abbreviated_labels_for_collapsed_nodes;
+ }
}
&& ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) {
c = PhylogenyMethods.getBranchColorValue( node );
}
+ else if ( to_pdf ) {
+ g.setColor( getTreeColorSet().getBranchColorForPdf() );
+ }
else {
c = getTreeColorSet().getCollapseFillColor();
}
}
setColor( g, node, to_graphics_file, to_pdf, is_in_found_nodes, getTreeColorSet().getSequenceColor() );
if ( node.isCollapse() && ( ( !node.isRoot() && !node.getParent().isCollapse() ) || node.isRoot() ) ) {
- if ( _sb.length() > 0 ) {
+ if ( _sb.length() == 0 ) {
+ if ( getOptions().isShowAbbreviatedLabelsForCollapsedNodes()
+ && ( getControlPanel().isShowTaxonomyCode() || getControlPanel().isShowTaxonomyScientificNames()
+ || getControlPanel().isShowSeqNames() || getControlPanel().isShowNodeNames() ) ) {
+ final PhylogenyNode first = PhylogenyMethods.getFirstExternalNode( node );
+ final PhylogenyNode last = PhylogenyMethods.getLastExternalNode( node );
+ if ( getControlPanel().isShowTaxonomyCode() && first.getNodeData().isHasTaxonomy()
+ && last.getNodeData().isHasTaxonomy()
+ && !ForesterUtil.isEmpty( first.getNodeData().getTaxonomy().getTaxonomyCode() )
+ && !ForesterUtil.isEmpty( last.getNodeData().getTaxonomy().getTaxonomyCode() ) ) {
+ addLabelForCollapsed( first.getNodeData().getTaxonomy().getTaxonomyCode(),
+ last.getNodeData().getTaxonomy().getTaxonomyCode(),
+ node.getAllExternalDescendants().size() );
+ }
+ else if ( getControlPanel().isShowTaxonomyScientificNames() && first.getNodeData().isHasTaxonomy()
+ && last.getNodeData().isHasTaxonomy()
+ && !ForesterUtil.isEmpty( first.getNodeData().getTaxonomy().getScientificName() )
+ && !ForesterUtil.isEmpty( last.getNodeData().getTaxonomy().getScientificName() ) ) {
+ addLabelForCollapsed( first.getNodeData().getTaxonomy().getScientificName(),
+ last.getNodeData().getTaxonomy().getScientificName(),
+ node.getAllExternalDescendants().size() );
+ }
+ else if ( getControlPanel().isShowSeqNames() && first.getNodeData().isHasSequence()
+ && last.getNodeData().isHasSequence()
+ && !ForesterUtil.isEmpty( first.getNodeData().getSequence().getName() )
+ && !ForesterUtil.isEmpty( last.getNodeData().getSequence().getName() ) ) {
+ addLabelForCollapsed( first.getNodeData().getSequence().getName(),
+ last.getNodeData().getSequence().getName(),
+ node.getAllExternalDescendants().size() );
+ }
+ else if ( getControlPanel().isShowNodeNames() && !ForesterUtil.isEmpty( first.getName() )
+ && !ForesterUtil.isEmpty( last.getName() ) ) {
+ addLabelForCollapsed( first.getName(),
+ last.getName(),
+ node.getAllExternalDescendants().size() );
+ }
+ }
+ }
+ else if ( _sb.length() > 0 ) {
_sb.setLength( 0 );
_sb.append( " (" );
_sb.append( node.getAllExternalDescendants().size() );
return x;
}
+ private final void addLabelForCollapsed( final String first, final String last, final int size ) {
+ _sb.append( first.length() < AptxConstants.MAX_LENGTH_FOR_COLLAPSED_NAME ? first
+ : first.substring( 0, AptxConstants.MAX_LENGTH_FOR_COLLAPSED_NAME - 1 ) );
+ _sb.append( " ... " );
+ _sb.append( last.length() < AptxConstants.MAX_LENGTH_FOR_COLLAPSED_NAME ? last
+ : last.substring( 0, AptxConstants.MAX_LENGTH_FOR_COLLAPSED_NAME - 1 ) );
+ _sb.append( " (" + size + ")" );
+ }
+
private final boolean isAllowAttributedStrings() {
return false;
}
setArrowCursor();
}
-
-
final void colorRank( final String rank ) {
if ( ( _phylogeny == null ) || ( _phylogeny.getNumberOfExternalNodes() < 2 ) ) {
return;
_sub_phylogenies_temp_roots[ _subtree_index ] = node;
++_subtree_index;
_phylogeny = TreePanelUtil.subTree( node, _phylogeny );
+ if ( _phylogeny.getRoot().isCollapse() ) {
+ _phylogeny.getRoot().setCollapse( false );
+ }
+ _phylogeny.externalNodesHaveChanged();
+ _phylogeny.clearHashIdToNodeMap();
+ _phylogeny.recalculateNumberOfExternalDescendants( true );
updateSubSuperTreeButton();
+ getMainPanel().getControlPanel().search0();
+ getMainPanel().getControlPanel().search1();
+ resetRankCollapseRankValue();
+ resetDepthCollapseDepthValue();
+ getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
+ getMainPanel().getControlPanel().updateDepthCollapseDepthDisplay();
+ getMainPanel().getControlPanel().updateRankCollapseRankDisplay();
}
else if ( node.isRoot() && isCurrentTreeIsSubtree() ) {
superTree();
_sub_phylogenies[ _subtree_index ] = null;
_sub_phylogenies_temp_roots[ _subtree_index ] = null;
_phylogeny = _sub_phylogenies[ --_subtree_index ];
+ _phylogeny.externalNodesHaveChanged();
+ _phylogeny.clearHashIdToNodeMap();
+ _phylogeny.recalculateNumberOfExternalDescendants( true );
+ getMainPanel().getControlPanel().search0();
+ getMainPanel().getControlPanel().search1();
+ resetRankCollapseRankValue();
+ resetDepthCollapseDepthValue();
+ getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
+ getMainPanel().getControlPanel().updateDepthCollapseDepthDisplay();
+ getMainPanel().getControlPanel().updateRankCollapseRankDisplay();
updateSubSuperTreeButton();
}
--_depth_collapse_level;
PhylogenyMethods.collapseToDepth( _phylogeny, _depth_collapse_level );
}
-
}
}
}
else {
--_rank_collapse_level;
- PhylogenyMethods.collapseToRank( _phylogeny, mapToAbsoluteRankLevel( ranks, _rank_collapse_level ) );
+ PhylogenyMethods.collapseToRank( _phylogeny,
+ mapToAbsoluteRankLevel( ranks, _rank_collapse_level ) );
}
}
}
}
-
public void increaseRankCollapseLevel() {
if ( ( _phylogeny != null ) && ( _phylogeny.getNumberOfExternalNodes() > 2 ) ) {
final String ranks[] = PhylogenyMethods.obtainPresentRanksSorted( _phylogeny );
if ( ranks.length > 1 ) {
- if ( _rank_collapse_level >= (ranks.length - 1 ) ) {
+ if ( _rank_collapse_level >= ( ranks.length - 1 ) ) {
_rank_collapse_level = 0;
- PhylogenyMethods.collapseToRank( _phylogeny,mapToAbsoluteRankLevel( ranks, _rank_collapse_level ) );
+ PhylogenyMethods.collapseToRank( _phylogeny,
+ mapToAbsoluteRankLevel( ranks, _rank_collapse_level ) );
}
- else if ( _rank_collapse_level == (ranks.length - 2 ) ) {
+ else if ( _rank_collapse_level == ( ranks.length - 2 ) ) {
++_rank_collapse_level;
uncollapseAll();
}
else {
++_rank_collapse_level;
- PhylogenyMethods.collapseToRank( _phylogeny,mapToAbsoluteRankLevel( ranks, _rank_collapse_level ) );
+ PhylogenyMethods.collapseToRank( _phylogeny,
+ mapToAbsoluteRankLevel( ranks, _rank_collapse_level ) );
}
}
}
}
-
private final static int mapToAbsoluteRankLevel( final String present_ranks_sorted[],
final int rank_collapse_level ) {
final String rank_str = present_ranks_sorted[ rank_collapse_level ];
}
return TaxonomyUtil.RANK_TO_INT.get( rank_str );
}
-
+
private final void uncollapseAll() {
- final PhylogenyNodeIterator it = new PreorderTreeIterator(_phylogeny );
+ final PhylogenyNodeIterator it = new PreorderTreeIterator( _phylogeny );
while ( it.hasNext() ) {
it.next().setCollapse( false );
}
}
-
+
final int resetDepthCollapseDepthValue() {
return _depth_collapse_level = -1;
}
final void setDepthCollapseDepthValue( final int depth_collapse_level ) {
_depth_collapse_level = depth_collapse_level;
}
-
+
final int resetRankCollapseRankValue() {
return _rank_collapse_level = -1;
}
}
}
- final static int collapseByTaxonomicRank( final Phylogeny tree, final String rank, final TreePanel tree_panel ) {
- final Set<String> true_lineage_set = new HashSet<String>();
- for( final PhylogenyNodeIterator iter = tree.iteratorPreorder(); iter.hasNext(); ) {
- iter.next().setCollapse( false );
- }
- int collapsed = 0;
- for( final PhylogenyNodeIterator it = tree.iteratorPostorder(); it.hasNext(); ) {
- final PhylogenyNode n = it.next();
- if ( !n.isExternal() && n.getNodeData().isHasTaxonomy() && !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getRank() )
- && n.getNodeData().getTaxonomy().getRank().equalsIgnoreCase( rank ) /*&& !n.isRoot()*/ ) {
- TreePanelUtil.collapseSubtree( n, true );
- ++collapsed;
- if ( !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getScientificName() ) ) {
- true_lineage_set.add( n.getNodeData().getTaxonomy().getScientificName() );
- }
- }
- }
- for( final PhylogenyNodeIterator it = tree.iteratorPostorder(); it.hasNext(); ) {
- final PhylogenyNode node = it.next();
- if ( ( !node.isExternal() && !node.isCollapse() ) && node.getNodeData().isHasTaxonomy()
- && !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getLineage() ) /* && !node.isRoot()*/ ) {
- boolean success = false;
- if ( !true_lineage_set.isEmpty() ) {
- for( final String lin : node.getNodeData().getTaxonomy().getLineage() ) {
- if ( true_lineage_set.contains( lin ) ) {
- TreePanelUtil.collapseSubtree( node, true );
- ++collapsed;
- success = true;
- break;
- }
- }
- }
- if ( !success ) {
- final Map<String, String> lineage_to_rank_map = MainPanel.getLineageToRankMap();
- for( final String lin : node.getNodeData().getTaxonomy().getLineage() ) {
- final Taxonomy temp_tax = new Taxonomy();
- temp_tax.setScientificName( lin );
- if ( lineage_to_rank_map.containsKey( lin )
- && !ForesterUtil.isEmpty( lineage_to_rank_map.get( lin ) )
- && lineage_to_rank_map.get( lin ).equalsIgnoreCase( rank ) ) {
- TreePanelUtil.collapseSubtree( node, true );
- ++collapsed;
- true_lineage_set.add( lin );
- break;
- }
- else {
- UniProtTaxonomy up = null;
- try {
- up = TaxonomyDataManager.obtainUniProtTaxonomy( temp_tax, null, null );
- }
- catch ( final Exception e ) {
- e.printStackTrace();
- }
- if ( ( up != null ) && !ForesterUtil.isEmpty( up.getRank() ) ) {
- lineage_to_rank_map.put( lin, up.getRank() );
- System.out.println( lin + "->" + up.getRank() );
- if ( up.getRank().equalsIgnoreCase( rank ) ) {
- TreePanelUtil.collapseSubtree( node, true );
- ++collapsed;
- true_lineage_set.add( lin );
- break;
- }
- }
- }
- }
- }
- }
- }
- return collapsed;
- }
+// final static int collapseByTaxonomicRank( final Phylogeny tree, final String rank, final TreePanel tree_panel ) {
+// final Set<String> true_lineage_set = new HashSet<String>();
+// for( final PhylogenyNodeIterator iter = tree.iteratorPreorder(); iter.hasNext(); ) {
+// iter.next().setCollapse( false );
+// }
+// int collapsed = 0;
+// for( final PhylogenyNodeIterator it = tree.iteratorPostorder(); it.hasNext(); ) {
+// final PhylogenyNode n = it.next();
+// if ( !n.isExternal() && n.getNodeData().isHasTaxonomy() && !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getRank() )
+// && n.getNodeData().getTaxonomy().getRank().equalsIgnoreCase( rank ) /*&& !n.isRoot()*/ ) {
+// TreePanelUtil.collapseSubtree( n, true );
+// ++collapsed;
+// if ( !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getScientificName() ) ) {
+// true_lineage_set.add( n.getNodeData().getTaxonomy().getScientificName() );
+// }
+// }
+// }
+// for( final PhylogenyNodeIterator it = tree.iteratorPostorder(); it.hasNext(); ) {
+// final PhylogenyNode node = it.next();
+// if ( ( !node.isExternal() && !node.isCollapse() ) && node.getNodeData().isHasTaxonomy()
+// && !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getLineage() ) /* && !node.isRoot()*/ ) {
+// boolean success = false;
+// if ( !true_lineage_set.isEmpty() ) {
+// for( final String lin : node.getNodeData().getTaxonomy().getLineage() ) {
+// if ( true_lineage_set.contains( lin ) ) {
+// TreePanelUtil.collapseSubtree( node, true );
+// ++collapsed;
+// success = true;
+// break;
+// }
+// }
+// }
+// if ( !success ) {
+// final Map<String, String> lineage_to_rank_map = MainPanel.getLineageToRankMap();
+// for( final String lin : node.getNodeData().getTaxonomy().getLineage() ) {
+// final Taxonomy temp_tax = new Taxonomy();
+// temp_tax.setScientificName( lin );
+// if ( lineage_to_rank_map.containsKey( lin )
+// && !ForesterUtil.isEmpty( lineage_to_rank_map.get( lin ) )
+// && lineage_to_rank_map.get( lin ).equalsIgnoreCase( rank ) ) {
+// TreePanelUtil.collapseSubtree( node, true );
+// ++collapsed;
+// true_lineage_set.add( lin );
+// break;
+// }
+// else {
+// UniProtTaxonomy up = null;
+// try {
+// up = TaxonomyDataManager.obtainUniProtTaxonomy( temp_tax, null, null );
+// }
+// catch ( final Exception e ) {
+// e.printStackTrace();
+// }
+// if ( ( up != null ) && !ForesterUtil.isEmpty( up.getRank() ) ) {
+// lineage_to_rank_map.put( lin, up.getRank() );
+// System.out.println( lin + "->" + up.getRank() );
+// if ( up.getRank().equalsIgnoreCase( rank ) ) {
+// TreePanelUtil.collapseSubtree( node, true );
+// ++collapsed;
+// true_lineage_set.add( lin );
+// break;
+// }
+// }
+// }
+// }
+// }
+// }
+// }
+// return collapsed;
+// }
final static int colorPhylogenyAccordingToRanks( final Phylogeny tree,
final String rank,
--- /dev/null
+
+package org.forester.archaeopteryx.util;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.Timer;
+
+public final class TypomaticJButton extends JButton implements ActionListener, MouseListener {
+
+ private static final long serialVersionUID = 7435606927739361980L;
+ private boolean pressed = false;
+ private boolean repeat_enabled = true;
+ private Timer timer = null;
+ private int initial_delay = 600;
+ private int delay = 200;
+ private int modifiers = 0;
+
+ public TypomaticJButton() {
+ super();
+ init();
+ }
+
+ public TypomaticJButton( final Action a ) {
+ super( a );
+ init();
+ }
+
+ public TypomaticJButton( final Icon icon ) {
+ super( icon );
+ init();
+ }
+
+ public TypomaticJButton( final String text ) {
+ super( text );
+ init();
+ }
+
+ public TypomaticJButton( final String text, final Icon icon ) {
+ super( text, icon );
+ init();
+ }
+
+ @Override
+ final public void actionPerformed( final ActionEvent ae ) {
+ if ( ae.getSource() == timer ) {
+ final ActionEvent event = new ActionEvent( this,
+ ActionEvent.ACTION_PERFORMED,
+ super.getActionCommand(),
+ modifiers );
+ super.fireActionPerformed( event );
+ }
+ }
+
+ final public int getDelay() {
+ return delay;
+ }
+
+ final public int getInitialDelay() {
+ return initial_delay;
+ }
+
+ final private void init() {
+ addMouseListener( this );
+ timer = new Timer( delay, this );
+ timer.setRepeats( true );
+ }
+
+ final public boolean isRepeatEnabled() {
+ return repeat_enabled;
+ }
+
+ @Override
+ final public void mouseClicked( final MouseEvent me ) {
+ if ( me.getSource() == this ) {
+ pressed = false;
+ if ( timer.isRunning() ) {
+ timer.stop();
+ }
+ }
+ }
+
+ @Override
+ final public void mouseEntered( final MouseEvent e ) {
+ if ( ( e.getSource() == this ) && isEnabled() && isRepeatEnabled() ) {
+ if ( pressed && !timer.isRunning() ) {
+ modifiers = e.getModifiers();
+ timer.setInitialDelay( delay );
+ timer.start();
+ }
+ }
+ }
+
+ @Override
+ final public void mouseExited( final MouseEvent e ) {
+ if ( e.getSource() == this ) {
+ if ( timer.isRunning() ) {
+ timer.stop();
+ }
+ }
+ }
+
+ @Override
+ final public void mousePressed( final MouseEvent e ) {
+ if ( ( e.getSource() == this ) && isEnabled() && isRepeatEnabled() ) {
+ pressed = true;
+ if ( !timer.isRunning() ) {
+ modifiers = e.getModifiers();
+ timer.setInitialDelay( initial_delay );
+ timer.start();
+ }
+ }
+ }
+
+ @Override
+ final public void mouseReleased( final MouseEvent e ) {
+ if ( e.getSource() == this ) {
+ pressed = false;
+ if ( timer.isRunning() ) {
+ timer.stop();
+ }
+ }
+ }
+
+ final public void setDelay( final int d ) {
+ delay = d;
+ }
+
+ @Override
+ final public void setEnabled( final boolean e ) {
+ if ( e != super.isEnabled() ) {
+ pressed = false;
+ if ( timer.isRunning() ) {
+ timer.stop();
+ }
+ }
+ super.setEnabled( e );
+ }
+
+ final public void setInitialDelay( final int d ) {
+ initial_delay = d;
+ }
+
+ final public void setRepeatEnabled( final boolean e ) {
+ if ( !e ) {
+ pressed = false;
+ if ( timer.isRunning() ) {
+ timer.stop();
+ }
+ }
+ repeat_enabled = e;
+ }
+}
\ No newline at end of file
return _external_nodes_set;
}
- /**
- * Returns the number of duplications of this Phylogeny (int). A return
- * value of -1 indicates that the number of duplications is unknown.
- */
- // public int getNumberOfDuplications() {
- // return _number_of_duplications;
- // } // getNumberOfDuplications()
- /**
- * Sets the number of duplications of this Phylogeny (int). A value of -1
- * indicates that the number of duplications is unknown.
- *
- * @param clean_nh
- * set to true for clean NH format
- */
- // public void setNumberOfDuplications( int i ) {
- // if ( i < 0 ) {
- // _number_of_duplications = -1;
- // }
- // else {
- // _number_of_duplications = i;
- // }
- // } // setNumberOfDuplications( int )
+
/**
* Returns the first external PhylogenyNode.
*/
import org.forester.phylogeny.iterators.PreorderTreeIterator;
import org.forester.util.BasicDescriptiveStatistics;
import org.forester.util.DescriptiveStatistics;
+import org.forester.util.FailedConditionCheckException;
import org.forester.util.ForesterUtil;
import org.forester.util.TaxonomyUtil;
}
}
-
+ public final static PhylogenyNode getFirstExternalNode( final PhylogenyNode node ) {
+ PhylogenyNode n = node;
+ while ( n.isInternal() ) {
+ n = n.getFirstChildNode();
+ }
+ return n;
+ }
+
+ public final static PhylogenyNode getLastExternalNode( final PhylogenyNode node ) {
+ PhylogenyNode n = node;
+ while ( n.isInternal() ) {
+ n = n.getLastChildNode();
+ }
+ return n;
+ }
}
public final class ForesterConstants {
- public final static String FORESTER_VERSION = "1.042";
- public final static String FORESTER_DATE = "160712";
+ public final static String FORESTER_VERSION = "1.043";
+ public final static String FORESTER_DATE = "160817";
public final static String PHYLO_XML_VERSION = "1.20";
public final static String PHYLO_XML_LOCATION = "http://www.phyloxml.org";
public final static String PHYLO_XML_XSD = "phyloxml.xsd";
static {
// same thing as set:
for( final String rank : TAXONOMY_RANKS_LIST ) {
- System.out.println( "=" + rank );
TAXONOMY_RANKS_SET.add( rank );
}
final int l = RANKS.length;
for( int i = 0; i < l; ++i ) {
- System.out.println( "i=" + i );
RANKS[ i ] = TAXONOMY_RANKS_LIST.get( i );
RANK_TO_INT.put( RANKS[ i ], i );
}