JMenuItem _view_as_NHX_item;
JMenuItem _view_as_XML_item;
JMenuItem _view_as_nexus_item;
+ JMenuItem _display_basic_information_item;
// help menu:
JMenuItem _about_item;
JMenuItem _help_item;
else if ( o == _switch_colors_mi ) {
switchColors();
}
+ else if ( o == _display_basic_information_item ) {
+ displayBasicInformation();
+ }
else if ( o == _view_as_NH_item ) {
viewAsNH();
}
}
void buildViewMenu() {
- _view_jmenu = createMenu( "View as Text", getConfiguration() );
+ _view_jmenu = createMenu( "View", getConfiguration() );
_view_jmenu.add( _view_as_XML_item = new JMenuItem( "View as phyloXML" ) );
_view_jmenu.add( _view_as_NH_item = new JMenuItem( "View as Newick" ) );
_view_jmenu.add( _view_as_NHX_item = new JMenuItem( "View as NHX" ) );
_view_jmenu.add( _view_as_nexus_item = new JMenuItem( "View as Nexus" ) );
+ _view_jmenu.add( _display_basic_information_item = new JMenuItem( "Display Basic Information" ) );
+ customizeJMenuItem( _display_basic_information_item );
customizeJMenuItem( _view_as_NH_item );
customizeJMenuItem( _view_as_NHX_item );
customizeJMenuItem( _view_as_XML_item );
( ( JCheckBoxMenuItem ) o ).setSelected( true );
}
+ void displayBasicInformation() {
+ if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty() ) {
+ return;
+ }
+ _textframe = TextFrame.instantiate( Util.crateBasicInformation( _mainpanel.getCurrentPhylogeny() ) );
+ }
+
void viewAsNexus() {
removeTextFrame();
if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty()
import org.forester.phylogeny.factories.PhylogenyFactory;
import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
import org.forester.phylogeny.iterators.PreorderTreeIterator;
+import org.forester.util.DescriptiveStatistics;
import org.forester.util.ForesterUtil;
final class Util {
}
}
- final static String createDescriptionForTab( final Phylogeny phy, final String full_path ) {
+ final static String crateBasicInformation( final Phylogeny phy ) {
final StringBuilder desc = new StringBuilder();
if ( ( phy != null ) && !phy.isEmpty() ) {
if ( !ForesterUtil.isEmpty( phy.getName() ) ) {
- desc.append( "name: " );
+ desc.append( "Name: " );
desc.append( phy.getName() );
- desc.append( "; " );
+ desc.append( "\n" );
}
if ( phy.getIdentifier() != null ) {
- desc.append( "id: " );
+ desc.append( "Id: " );
desc.append( phy.getIdentifier() );
- desc.append( "; " );
+ desc.append( "\n" );
}
- desc.append( "rooted: " );
+ desc.append( "Rooted: " );
desc.append( phy.isRooted() );
- desc.append( "; " );
- desc.append( "rerootable: " );
+ desc.append( "\n" );
+ desc.append( "Rerootable: " );
desc.append( phy.isRerootable() );
- desc.append( "; " );
- desc.append( "external nodes: " );
+ desc.append( "\n" );
+ desc.append( "Node sum: " );
+ desc.append( phy.getNodeCount() );
+ desc.append( "\n" );
+ desc.append( "External node sum: " );
desc.append( phy.getNumberOfExternalNodes() );
- desc.append( "; " );
- desc.append( "branches: " );
+ desc.append( "\n" );
+ desc.append( "Internal node sum: " );
+ desc.append( phy.getNodeCount() - phy.getNumberOfExternalNodes() );
+ desc.append( "\n" );
+ desc.append( "Branche sum: " );
desc.append( phy.getNumberOfBranches() );
- desc.append( "; " );
- desc.append( "maximum descendants: " );
- desc.append( PhylogenyMethods.calculateMaximumNumberOfDescendantsPerNode( phy ) );
- if ( !ForesterUtil.isEmpty( full_path ) && ( full_path.length() <= 50 ) ) {
- desc.append( "; " );
- desc.append( "path: " );
- desc.append( full_path );
+ desc.append( "\n" );
+ desc.append( "Depth: " );
+ desc.append( PhylogenyMethods.calculateMaxDepth( phy ) );
+ desc.append( "\n" );
+ desc.append( "Maximum distance to root: " );
+ desc.append( ForesterUtil.round( PhylogenyMethods.calculateMaxDistanceToRoot( phy ), 6 ) );
+ desc.append( "\n" );
+ desc.append( "Descendants per node statistics: " );
+ final DescriptiveStatistics ds = PhylogenyMethods.calculatNumberOfDescendantsPerNodeStatistics( phy );
+ desc.append( "\n" );
+ desc.append( " Median: " + ForesterUtil.round( ds.median(), 2 ) );
+ desc.append( "\n" );
+ desc.append( " Mean: " + ForesterUtil.round( ds.arithmeticMean(), 2 ) );
+ desc.append( "\n" );
+ desc.append( " SD: " + ForesterUtil.round( ds.sampleStandardDeviation(), 2 ) );
+ desc.append( "\n" );
+ desc.append( " Minimum: " + ForesterUtil.roundToInt( ds.getMin() ) );
+ desc.append( "\n" );
+ desc.append( " Maximum: " + ForesterUtil.roundToInt( ds.getMax() ) );
+ desc.append( "\n" );
+ final DescriptiveStatistics cs = PhylogenyMethods.calculatConfidenceStatistics( phy );
+ if ( cs.getN() > 1 ) {
+ desc.append( "Support statistics: " );
+ desc.append( "\n" );
+ desc.append( " Branches with support: " + cs.getN() );
+ desc.append( "\n" );
+ desc.append( " Median: " + ForesterUtil.round( cs.median(), 6 ) );
+ desc.append( "\n" );
+ desc.append( " Mean: " + ForesterUtil.round( cs.arithmeticMean(), 6 ) );
+ desc.append( "\n" );
+ if ( cs.getN() > 2 ) {
+ desc.append( " SD: " + ForesterUtil.round( cs.sampleStandardDeviation(), 6 ) );
+ desc.append( "\n" );
+ }
+ desc.append( " Minimum: " + ForesterUtil.roundToInt( cs.getMin() ) );
+ desc.append( "\n" );
+ desc.append( " Maximum: " + ForesterUtil.roundToInt( cs.getMax() ) );
+ desc.append( "\n" );
+ }
+ final Set<Taxonomy> taxs = PhylogenyMethods.obtainDistinctTaxonomies( phy.getRoot() );
+ if ( taxs != null ) {
+ desc.append( "Distinct external taxonomies: " );
+ desc.append( taxs.size() );
}
}
return desc.toString();
import org.forester.phylogeny.data.DomainArchitecture;
import org.forester.phylogeny.data.Taxonomy;
import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
+import org.forester.util.BasicDescriptiveStatistics;
+import org.forester.util.DescriptiveStatistics;
import org.forester.util.FailedConditionCheckException;
import org.forester.util.ForesterUtil;
return max;
}
- public static int calculateMaximumNumberOfDescendantsPerNode( final Phylogeny phy ) {
- int max = 0;
+ public static DescriptiveStatistics calculatNumberOfDescendantsPerNodeStatistics( final Phylogeny phy ) {
+ final DescriptiveStatistics stats = new BasicDescriptiveStatistics();
for( final PhylogenyNodeIterator iter = phy.iteratorPreorder(); iter.hasNext(); ) {
- final PhylogenyNode node = iter.next();
- if ( node.getNumberOfDescendants() > max ) {
- max = node.getNumberOfDescendants();
+ final PhylogenyNode n = iter.next();
+ if ( !n.isExternal() ) {
+ stats.addValue( n.getNumberOfDescendants() );
}
}
- return max;
+ return stats;
+ }
+
+ public static DescriptiveStatistics calculatConfidenceStatistics( final Phylogeny phy ) {
+ final DescriptiveStatistics stats = new BasicDescriptiveStatistics();
+ for( final PhylogenyNodeIterator iter = phy.iteratorPreorder(); iter.hasNext(); ) {
+ final PhylogenyNode n = iter.next();
+ if ( !n.isExternal() ) {
+ if ( n.getBranchData().isHasConfidences() ) {
+ stats.addValue( n.getBranchData().getConfidence( 0 ).getValue() );
+ }
+ }
+ }
+ return stats;
}
/**