From: cmzmasek@gmail.com Date: Wed, 20 Aug 2014 20:27:04 +0000 (+0000) Subject: in progress X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4e9354fda88a25a2d5197cc7cf3f576f263aa49d;p=jalview.git in progress --- diff --git a/forester/java/src/org/forester/archaeopteryx/AptxUtil.java b/forester/java/src/org/forester/archaeopteryx/AptxUtil.java index e95283d..b2c3dd8 100644 --- a/forester/java/src/org/forester/archaeopteryx/AptxUtil.java +++ b/forester/java/src/org/forester/archaeopteryx/AptxUtil.java @@ -72,6 +72,7 @@ import org.forester.phylogeny.Phylogeny; import org.forester.phylogeny.PhylogenyMethods; import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY; import org.forester.phylogeny.PhylogenyNode; +import org.forester.phylogeny.data.Confidence; import org.forester.phylogeny.data.Taxonomy; import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; import org.forester.phylogeny.factories.PhylogenyFactory; @@ -135,6 +136,46 @@ public final class AptxUtil { return false; } + final static public boolean isHasAtLeastOneBranchWithSupportSD( final Phylogeny phy ) { + final PhylogenyNodeIterator it = phy.iteratorPostorder(); + while ( it.hasNext() ) { + final PhylogenyNode n = it.next(); + if ( n.getBranchData().isHasConfidences() ) { + final List c = n.getBranchData().getConfidences(); + for( final Confidence confidence : c ) { + if ( confidence.getStandardDeviation() > 0 ) { + return true; + } + } + } + } + return false; + } + + final static public boolean isHasAtLeastOneNodeWithScientificName( final Phylogeny phy ) { + final PhylogenyNodeIterator it = phy.iteratorPostorder(); + while ( it.hasNext() ) { + final PhylogenyNode n = it.next(); + if ( n.getNodeData().isHasTaxonomy() + && !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getScientificName() ) ) { + return true; + } + } + return false; + } + + final static public boolean isHasAtLeastOneNodeWithSequenceAnnotation( final Phylogeny phy ) { + final PhylogenyNodeIterator it = phy.iteratorPostorder(); + while ( it.hasNext() ) { + final PhylogenyNode n = it.next(); + if ( n.getNodeData().isHasSequence() + && !ForesterUtil.isEmpty( n.getNodeData().getSequence().getAnnotations() ) ) { + return true; + } + } + return false; + } + final public static void launchWebBrowser( final URI uri, final boolean is_applet, final JApplet applet, diff --git a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java index e8ba350..27c6b99 100644 --- a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java +++ b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java @@ -2298,6 +2298,38 @@ final class ControlPanel extends JPanel implements ActionListener { void setVisibilityOfX() { try { + if ( ( getCurrentTreePanel() != null ) && ( getCurrentTreePanel().getPhylogeny() != null ) ) { + if ( AptxUtil.isHasAtLeastOneBranchWithSupportSD( getCurrentTreePanel().getPhylogeny() ) ) { + if ( getMainPanel().getMainFrame()._show_confidence_stddev_cbmi != null ) { + getMainPanel().getMainFrame()._show_confidence_stddev_cbmi.setVisible( true ); + } + } + else { + if ( getMainPanel().getMainFrame()._show_confidence_stddev_cbmi != null ) { + getMainPanel().getMainFrame()._show_confidence_stddev_cbmi.setVisible( false ); + } + } + if ( AptxUtil.isHasAtLeastOneNodeWithScientificName( getCurrentTreePanel().getPhylogeny() ) ) { + if ( getMainPanel().getMainFrame()._abbreviate_scientific_names != null ) { + getMainPanel().getMainFrame()._abbreviate_scientific_names.setVisible( true ); + } + } + else { + if ( getMainPanel().getMainFrame()._abbreviate_scientific_names != null ) { + getMainPanel().getMainFrame()._abbreviate_scientific_names.setVisible( false ); + } + } + if ( AptxUtil.isHasAtLeastOneNodeWithSequenceAnnotation( getCurrentTreePanel().getPhylogeny() ) ) { + if ( getMainPanel().getMainFrame()._show_annotation_ref_source != null ) { + getMainPanel().getMainFrame()._show_annotation_ref_source.setVisible( true ); + } + } + else { + if ( getMainPanel().getMainFrame()._show_annotation_ref_source != null ) { + getMainPanel().getMainFrame()._show_annotation_ref_source.setVisible( false ); + } + } + } if ( isDrawPhylogram() || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel() .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) {