in progress
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Fri, 30 Nov 2012 21:14:02 +0000 (21:14 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Fri, 30 Nov 2012 21:14:02 +0000 (21:14 +0000)
forester/java/src/org/forester/analysis/TaxonomyDataManager.java
forester/java/src/org/forester/application/rio.java
forester/java/src/org/forester/archaeopteryx/TreePanel.java
forester/java/src/org/forester/util/ForesterConstants.java
forester/java/src/org/forester/util/ForesterUtil.java
forester/java/src/org/forester/ws/seqdb/SequenceDbWsTools.java
forester/java/src/org/forester/ws/seqdb/UniProtTaxonomy.java

index fac9f85..50cd1cc 100644 (file)
@@ -335,6 +335,7 @@ public final class TaxonomyDataManager extends RunnableProcess {
                     .get( lineage.size() - 1 ) );
             if ( ( up_taxonomies != null ) && ( up_taxonomies.size() > 0 ) ) {
                 for( final UniProtTaxonomy up_taxonomy : up_taxonomies ) {
+                    System.out.println( "up_taxonomy=" + up_taxonomy.getScientificName() );
                     boolean match = true;
                     I: for( int i = 0; i < lineage.size(); ++i ) {
                         if ( !lineage.get( i ).equalsIgnoreCase( up_taxonomy.getLineage().get( i ) ) ) {
index 5564763..94e6f5c 100644 (file)
@@ -47,8 +47,8 @@ import org.forester.util.ForesterUtil;
 public class rio {
 
     final static private String PRG_NAME              = "rio";
-    final static private String PRG_VERSION           = "3.00 beta 1";
-    final static private String PRG_DATE              = "2012.11.27";
+    final static private String PRG_VERSION           = "3.00 beta 2";
+    final static private String PRG_DATE              = "2012.11.30";
     final static private String E_MAIL                = "czmasek@burnham.org";
     final static private String WWW                   = "www.phylosoft.org/forester/";
     final static private String HELP_OPTION_1         = "help";
@@ -103,7 +103,7 @@ public class rio {
         }
         ForesterUtil.fatalErrorIfFileNotReadable( PRG_NAME, gene_trees_file );
         ForesterUtil.fatalErrorIfFileNotReadable( PRG_NAME, species_tree_file );
-        if ( outfile.exists() ) {
+        if ( ( outfile != null ) && outfile.exists() ) {
             ForesterUtil.fatalError( PRG_NAME, "[" + outfile + "] already exists" );
         }
         String query = null;
@@ -123,16 +123,20 @@ public class rio {
         }
         double cutoff_for_orthologs = 50;
         double cutoff_for_ultra_paralogs = 50;
-        int sort = 2;
+        int sort = 1;
         try {
             if ( cla.isOptionSet( CUTOFF_ORTHO_OPTION ) ) {
                 cutoff_for_orthologs = cla.getOptionValueAsDouble( CUTOFF_ORTHO_OPTION );
+                if ( query == null ) {
+                    ForesterUtil.fatalError( PRG_NAME, "missing query name, type \"rio -h\" for help" );
+                }
+                if ( outfile == null ) {
+                    ForesterUtil.fatalError( PRG_NAME, "missing outfile, type \"rio -h\" for help" );
+                }
             }
             if ( cla.isOptionSet( CUTOFF_ULTRA_P_OPTION ) ) {
                 cutoff_for_ultra_paralogs = cla.getOptionValueAsDouble( CUTOFF_ULTRA_P_OPTION );
-                if ( !output_ultraparalogs ) {
-                    printHelp();
-                }
+                output_ultraparalogs = true;
             }
             if ( cla.isOptionSet( SORT_OPTION ) ) {
                 sort = cla.getOptionValueAsInt( SORT_OPTION );
@@ -142,13 +146,13 @@ public class rio {
             ForesterUtil.fatalError( PRG_NAME, "error in command line: " + e.getLocalizedMessage() );
         }
         if ( ( cutoff_for_orthologs < 0 ) || ( cutoff_for_ultra_paralogs < 0 ) || ( sort < 0 ) || ( sort > 2 ) ) {
-            printHelp();
+            ForesterUtil.fatalError( PRG_NAME, "numberical option out of range, type \"rio -h\" for help" );
         }
-        if ( ( ( query == null ) && ( outfile != null ) ) || ( ( query != null ) && ( outfile == null ) ) ) {
-            printHelp();
+        if ( ( ( query == null ) && ( ( outfile != null ) || output_ultraparalogs ) ) ) {
+            ForesterUtil.fatalError( PRG_NAME, "missing query name, type \"rio -h\" for help" );
         }
-        if ( output_ultraparalogs && ( outfile == null ) ) {
-            printHelp();
+        if ( ( output_ultraparalogs && ( outfile == null ) ) || ( ( query != null ) && ( outfile == null ) ) ) {
+            ForesterUtil.fatalError( PRG_NAME, "missing outfile, type \"rio -h\" for help" );
         }
         long time = 0;
         System.out.println( "Gene trees                : " + gene_trees_file );
@@ -177,12 +181,10 @@ public class rio {
             System.exit( -1 );
         }
         if ( !species_tree.isRooted() ) {
-            ForesterUtil.printErrorMessage( PRG_NAME, "species tree is not rooted" );
-            System.exit( -1 );
+            ForesterUtil.fatalError( PRG_NAME, "species tree is not rooted" );
         }
         if ( !species_tree.isCompletelyBinary() ) {
-            ForesterUtil.printErrorMessage( PRG_NAME, "species tree is not completely binary" );
-            System.exit( -1 );
+            ForesterUtil.fatalError( PRG_NAME, "species tree is not completely binary" );
         }
         try {
             RIO rio;
@@ -210,6 +212,9 @@ public class rio {
                 tableOutput( table_outfile, rio );
             }
         }
+        catch ( final IllegalArgumentException e ) {
+            ForesterUtil.fatalError( PRG_NAME, e.getLocalizedMessage() );
+        }
         catch ( final Exception e ) {
             ForesterUtil.printErrorMessage( PRG_NAME, e.getLocalizedMessage() );
             e.printStackTrace();
@@ -267,13 +272,19 @@ public class rio {
         System.out.println();
         System.out.println( " Options" );
         System.out.println( "  -" + CUTOFF_ORTHO_OPTION + " : cutoff for ortholog output (default: 50)" );
-        System.out.println( "  -" + TABLE_OUTPUT_OPTION + "  : file-name for output table" );
-        System.out.println( "  -" + QUERY_OPTION + "  : name for query (sequence/node)" );
-        System.out.println( "  -" + SORT_OPTION + "  : sort (default: 2)" );
+        System.out.println( "  -" + TABLE_OUTPUT_OPTION
+                + "  : file-name for output table of all vs. all ortholgy support" );
+        System.out.println( "  -" + QUERY_OPTION
+                + "  : name for query (sequence/node), if this is used, [outfile] is required as well" );
+        System.out.println( "  -" + SORT_OPTION + "  : sort (default: 1)" );
         System.out.println( "  -" + OUTPUT_ULTRA_P_OPTION
                 + "  : to output ultra-paralogs (species specific expansions/paralogs)" );
         System.out.println( "  -" + CUTOFF_ULTRA_P_OPTION + " : cutoff for ultra-paralog output (default: 50)" );
         System.out.println();
+        System.out.println( " Note" );
+        System.out.println( "  Either output of all vs. all ortholgy support with -t=<output table> and/or output for" );
+        System.out.println( "  one query sequence with -q=<query name> and a [outfile] are required." );
+        System.out.println();
         System.out.println( " Sort" );
         System.out.println( RIO.getOrderHelp().toString() );
         System.out.println( " Formats" );
@@ -287,6 +298,8 @@ public class rio {
         System.out.println( "  \"rio gene_trees.nh species.xml outfile -q=BCL2_HUMAN -t=outtable -u -cu=60 -co=60\"" );
         System.out.println( "  \"rio gene_trees.nh species.xml -t=outtable\"" );
         System.out.println();
+        System.out.println( " More information: http://code.google.com/p/forester/wiki/RIO" );
+        System.out.println();
         System.exit( -1 );
     }
 }
index 1e329d3..907a20f 100644 (file)
@@ -2243,7 +2243,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         Color c = getTreeColorSet().getAnnotationColor();
         if ( getControlPanel().isColorAccordingToAnnotation() && ( getControlPanel().getAnnotationColors() != null ) ) {
             final StringBuilder sb = new StringBuilder();
-            for( Annotation a : ann ) {
+            for( final Annotation a : ann ) {
                 sb.append( !ForesterUtil.isEmpty( a.getRef() ) ? a.getRef() : a.getDesc() );
             }
             final String ann_str = sb.toString();
@@ -4038,7 +4038,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
     private String createAnnotationString( final SortedSet<Annotation> ann ) {
         final StringBuilder sb = new StringBuilder();
         boolean first = true;
-        for( Annotation a : ann ) {
+        for( final Annotation a : ann ) {
             if ( !first ) {
                 sb.append( "|" );
             }
index 27cf706..6ff9c10 100644 (file)
@@ -27,8 +27,8 @@ package org.forester.util;
 
 public final class ForesterConstants {
 
-    public final static String  FORESTER_VERSION            = "1.006";
-    public final static String  FORESTER_DATE               = "121128";
+    public final static String  FORESTER_VERSION            = "1.007";
+    public final static String  FORESTER_DATE               = "121130";
     public final static String  PHYLO_XML_VERSION           = "1.10";
     public final static String  PHYLO_XML_LOCATION          = "http://www.phyloxml.org";
     public final static String  PHYLO_XML_XSD               = "phyloxml.xsd";
index 043df39..ef30200 100644 (file)
@@ -771,7 +771,7 @@ public final class ForesterUtil {
     }
 
     final public static void printErrorMessage( final String prg_name, final String message ) {
-        System.out.println( "[" + prg_name + "] > error: " + message );
+        System.err.println( "[" + prg_name + "] > error: " + message );
     }
 
     final public static void printProgramInformation( final String prg_name, final String prg_version, final String date ) {
index b56a633..5c1cc73 100644 (file)
@@ -121,16 +121,20 @@ public final class SequenceDbWsTools {
                                                                          final int max_taxonomies_return )
             throws IOException {
         // Hack!  Craniata? .. 
-        if ( sn.equals( "Drosophila" ) ) {
-            return uniProtTaxonomyToList( UniProtTaxonomy.DROSOPHILA_GENUS );
-        }
-        else if ( sn.equals( "Xenopus" ) ) {
+        // if ( sn.equals( "Drosophila" ) ) {
+        //     return uniProtTaxonomyToList( UniProtTaxonomy.DROSOPHILA_GENUS );
+        // }
+        /* else*/if ( sn.equals( "Xenopus" ) ) {
             return uniProtTaxonomyToList( UniProtTaxonomy.XENOPUS_GENUS );
         }
         // else if ( sn.equals( "Nucleariidae and Fonticula group" ) ) {
         //     return hack( UniProtTaxonomy.NUCLEARIIDAE_AND_FONTICULA );
         // }
         final List<String> result = getTaxonomyStringFromScientificName( sn, max_taxonomies_return );
+        System.out.println( "SN=" + sn );
+        for( final String string : result ) {
+            System.out.println( "|" + string );
+        }
         if ( result.size() > 0 ) {
             return parseUniProtTaxonomy( result );
         }
index e9a2e88..145569d 100644 (file)
@@ -118,7 +118,7 @@ public final class UniProtTaxonomy {
         }
         _lineage.add( _scientific_name );
         if ( _lineage.isEmpty() ) {
-            throw new IllegalArgumentException( "lineage in a UniProt Taxonomy can not be empty\n: " + line );
+            throw new IllegalArgumentException( "lineage in a UniProt taxonomy can not be empty\n: " + line );
         }
     }