special domain coloring
[jalview.git] / forester / java / src / org / forester / archaeopteryx / AptxUtil.java
index d6c980a..b2c3dd8 100644 (file)
@@ -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<Confidence> 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,
@@ -947,30 +988,6 @@ public final class AptxUtil {
         }
     }
 
-    // See: http://www.xml.nig.ac.jp/tutorial/rest/index.html#2.2
-    // static void openDDBJRest() throws IOException {
-    // //set URL
-    // URL url = new URL( "http://xml.nig.ac.jp/rest/Invoke" );
-    // //set parameter
-    // String query = "service=GetEntry&method=getDDBJEntry&accession=AB000100";
-    // //make connection
-    // URLConnection urlc = url.openConnection();
-    // //use post mode
-    // urlc.setDoOutput( true );
-    // urlc.setAllowUserInteraction( false );
-    // //send query
-    // PrintStream ps = new PrintStream( urlc.getOutputStream() );
-    // ps.print( query );
-    // ps.close();
-    // //get result
-    // BufferedReader br = new BufferedReader( new InputStreamReader(
-    // urlc.getInputStream() ) );
-    // String l = null;
-    // while ( ( l = br.readLine() ) != null ) {
-    // System.out.println( l );
-    // }
-    // br.close();
-    // }
     public static enum GraphicsExportType {
         BMP( "bmp" ), GIF( "gif" ), JPG( "jpg" ), PDF( "pdf" ), PNG( "png" ), TIFF( "tif" );