in progress
authorcmzmasek <cmzmasek@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Mon, 7 Apr 2014 04:03:46 +0000 (04:03 +0000)
committercmzmasek <cmzmasek@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Mon, 7 Apr 2014 04:03:46 +0000 (04:03 +0000)
forester/java/src/org/forester/archaeopteryx/AptxUtil.java
forester/java/src/org/forester/archaeopteryx/Archaeopteryx.java
forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java
forester/java/src/org/forester/archaeopteryx/webservices/WebserviceUtil.java
forester/java/src/org/forester/phylogeny/PhylogenyMethods.java

index 14cb729..73c2c4f 100644 (file)
@@ -712,7 +712,7 @@ public final class AptxUtil {
         if ( phys != null ) {
             if ( nhx_or_nexus && internal_numbers_are_confidences ) {
                 for( final Phylogeny phy : phys ) {
-                    PhylogenyMethods.transferInternalNodeNamesToConfidence( phy );
+                    PhylogenyMethods.transferInternalNodeNamesToConfidence( phy, "" );
                 }
             }
             if ( midpoint_reroot ) {
index c23dcca..a15ef51 100644 (file)
@@ -102,7 +102,7 @@ public final class Archaeopteryx {
                     phylogenies = PhylogenyMethods.readPhylogenies( p, f );
                     if ( nhx_or_nexus && conf.isInternalNumberAreConfidenceForNhParsing() ) {
                         for( final Phylogeny phy : phylogenies ) {
-                            PhylogenyMethods.transferInternalNodeNamesToConfidence( phy );
+                            PhylogenyMethods.transferInternalNodeNamesToConfidence( phy, "" );
                         }
                     }
                 }
index 4b860a1..6ae6a95 100644 (file)
@@ -1223,7 +1223,7 @@ public final class MainFrameApplication extends MainFrame {
             if ( ( phys != null ) && ( phys.length > 0 ) ) {
                 if ( nhx_or_nexus && getOptions().isInternalNumberAreConfidenceForNhParsing() ) {
                     for( final Phylogeny phy : phys ) {
-                        PhylogenyMethods.transferInternalNodeNamesToConfidence( phy );
+                        PhylogenyMethods.transferInternalNodeNamesToConfidence( phy, "" );
                     }
                 }
                 AptxUtil.addPhylogeniesToTabs( phys,
@@ -2189,7 +2189,7 @@ public final class MainFrameApplication extends MainFrame {
                         if ( nhx_or_nexus ) {
                             for( final Phylogeny phy : phys ) {
                                 if ( getOptions().isInternalNumberAreConfidenceForNhParsing() ) {
-                                    PhylogenyMethods.transferInternalNodeNamesToConfidence( phy );
+                                    PhylogenyMethods.transferInternalNodeNamesToConfidence( phy, "" );
                                 }
                                 if ( PhylogenyMethods.getMinimumDescendentsPerInternalNodes( phy ) == 1 ) {
                                     one_desc = true;
index 58fb1e0..18bc84f 100644 (file)
@@ -126,31 +126,29 @@ public final class WebserviceUtil {
     public static void processInstructions( final PhylogeniesWebserviceClient client, final Phylogeny phylogeny )
             throws PhyloXmlDataFormatException {
         if ( client.getProcessingInstructions().equals( WebserviceUtil.TREE_FAM_INST ) ) {
-            WebserviceUtil.removeEventsInExternalNodes( phylogeny );
-            WebserviceUtil.setTaxonomyIdentifierType( phylogeny, "ncbi" );
+            
+            WebserviceUtil.processTreeFamTrees( phylogeny );
         }
         else if ( client.getProcessingInstructions().equals( WebserviceUtil.PFAM_INST ) ) {
             WebserviceUtil.extractSpTremblAccFromNodeName( phylogeny, "sptrembl" );
-        }
+            PhylogenyMethods.transferInternalNodeNamesToConfidence( phylogeny, "bootstrap" );        }
     }
 
-    static void setTaxonomyIdentifierType( final Phylogeny phy, final String type ) {
+    static void processTreeFamTrees( final Phylogeny phy ) {
         final PhylogenyNodeIterator it = phy.iteratorPostorder();
         while ( it.hasNext() ) {
             final PhylogenyNode n = it.next();
+            if ( n.isExternal() ) {
+                n.getNodeData().setEvent( null );
+            }
+            
             if ( n.getNodeData().isHasTaxonomy() && ( n.getNodeData().getTaxonomy().getIdentifier() != null ) ) {
                 n.getNodeData()
                         .getTaxonomy()
-                        .setIdentifier( new Identifier( n.getNodeData().getTaxonomy().getIdentifier().getValue(), type ) );
+                        .setIdentifier( new Identifier( n.getNodeData().getTaxonomy().getIdentifier().getValue(), "ncbi" ) );
             }
         }
     }
 
-    static void removeEventsInExternalNodes( final Phylogeny phy ) {
-        final PhylogenyNodeIterator it = phy.iteratorExternalForward();
-        while ( it.hasNext() ) {
-            final PhylogenyNode n = it.next();
-            n.getNodeData().setEvent( null );
-        }
-    }
+    
 }
index 806f031..1f872cf 100644 (file)
@@ -1516,7 +1516,7 @@ public class PhylogenyMethods {
         }
     }
 
-    final static public void transferInternalNodeNamesToConfidence( final Phylogeny phy ) {
+    final static public void transferInternalNodeNamesToConfidence( final Phylogeny phy, final String confidence_type ) {
         final PhylogenyNodeIterator it = phy.iteratorPostorder();
         while ( it.hasNext() ) {
             final PhylogenyNode n = it.next();
@@ -1530,7 +1530,7 @@ public class PhylogenyMethods {
                         d = -1.0;
                     }
                     if ( d >= 0.0 ) {
-                        n.getBranchData().addConfidence( new Confidence( d, "" ) );
+                        n.getBranchData().addConfidence( new Confidence( d, confidence_type ) );
                         n.setName( "" );
                     }
                 }