in progress
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Fri, 25 Oct 2013 00:47:26 +0000 (00:47 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Fri, 25 Oct 2013 00:47:26 +0000 (00:47 +0000)
forester/java/src/org/forester/surfacing/DomainCountsDifferenceUtil.java
forester/java/src/org/forester/util/ForesterUtil.java
forester/java/src/org/forester/util/TaxonomyColors.java [new file with mode: 0644]

index 2a18c9c..e172659 100644 (file)
@@ -542,7 +542,7 @@ public final class DomainCountsDifferenceUtil {
         int counter = 0;
         int total_absense_counter = 0;
         int not_total_absense_counter = 0;
-        SurfacingUtil.addHtmlHead( html_writer, "Binary Domain Combination Copy Differences" );
+        SurfacingUtil.writeHtmlHead( html_writer, "Binary Domain Combination Copy Differences" );
         html_writer.write( "<body><table>" );
         for( final BinaryDomainCombination bdc : all_bdcs ) {
             if ( ( high_copy_base_values.get( bdc ) > 0 ) && ( high_copy_target_values.get( bdc ) > 0 )
@@ -666,7 +666,7 @@ public final class DomainCountsDifferenceUtil {
         int counter = 0;
         int total_absense_counter = 0;
         int not_total_absense_counter = 0;
-        SurfacingUtil.addHtmlHead( html_writer, "Domain Copy Differences" );
+        SurfacingUtil.writeHtmlHead( html_writer, "Domain Copy Differences" );
         html_writer.write( "<body><table>" );
         for( final String domain_id : all_domains ) {
             if ( ( high_copy_base_values.get( domain_id ) > 0 ) && ( high_copy_target_values.get( domain_id ) > 0 )
index 8036c2d..2cf0572 100644 (file)
@@ -92,24 +92,6 @@ public final class ForesterUtil {
     public static final String       NCBI_NUCCORE                     = "http://www.ncbi.nlm.nih.gov/nuccore/";
     public final static String       UNIPROT_KB                       = "http://www.uniprot.org/uniprot/";
     public static final String       NCBI_GI                          = "http://www.ncbi.nlm.nih.gov/protein/gi:";
-    public final static Color        DEUTEROSTOMIA_COLOR              = new Color( 255, 0, 0 );
-    public final static Color        PROTOSTOMIA_COLOR                = new Color( 204, 0, 0 );
-    public final static Color        METAZOA_COLOR                    = new Color( 204, 0, 102 );
-    public final static Color        HOLOZOA_COLOR                    = new Color( 127, 0, 255 );
-    public final static Color        FUNGI_COLOR                      = new Color( 255, 153, 0 );
-    public final static Color        HOLOMYCOTA_COLOR                 = new Color( 204, 102, 0 );
-    public final static Color        AMOEBOZOA_COLOR                  = new Color( 255, 0, 255 );
-    public final static Color        VIRIDPLANTAE_COLOR               = new Color( 0, 255, 0 );
-    public final static Color        RHODOPHYTA_COLOR                 = new Color( 0, 153, 76 );
-    public final static Color        HACROBIA_COLOR                   = new Color( 0, 102, 51 );
-    public final static Color        GLAUCOPHYTA_COLOR                = new Color( 0, 102, 51 );
-    public final static Color        STRAMENOPILES_COLOR              = new Color( 0, 0, 255 );
-    public final static Color        ALVEOLATA_COLOR                  = new Color( 0, 128, 255 );
-    public final static Color        RHIZARIA_COLOR                   = new Color( 0, 255, 255 );
-    public static final Color        APUSOZOA_COLOR                   = new Color( 204, 255, 255 );
-    public final static Color        EXCAVATA_COLOR                   = new Color( 204, 204, 0 );
-    public final static Color        ARCHAEA_COLOR                    = new Color( 160, 160, 160 );
-    public final static Color        BACTERIA_COLOR                   = new Color( 64, 64, 64 );
     static {
         final DecimalFormatSymbols dfs = new DecimalFormatSymbols();
         dfs.setDecimalSeparator( '.' );
@@ -733,7 +715,7 @@ public final class ForesterUtil {
         return i;
     }
 
-    final public static SortedMap<Object, Integer> listToSortedCountsMap( final List list ) {
+    final public static SortedMap<Object, Integer> listToSortedCountsMap( final List<?> list ) {
         final SortedMap<Object, Integer> map = new TreeMap<Object, Integer>();
         for( final Object key : list ) {
             if ( !map.containsKey( key ) ) {
@@ -773,9 +755,9 @@ public final class ForesterUtil {
         }
     }
 
-    final public static StringBuffer mapToStringBuffer( final Map map, final String key_value_separator ) {
+    final public static StringBuffer mapToStringBuffer( final Map<Object, Object> map, final String key_value_separator ) {
         final StringBuffer sb = new StringBuffer();
-        for( final Iterator iter = map.keySet().iterator(); iter.hasNext(); ) {
+        for( final Iterator<Object> iter = map.keySet().iterator(); iter.hasNext(); ) {
             final Object key = iter.next();
             sb.append( key.toString() );
             sb.append( key_value_separator );
@@ -1224,61 +1206,107 @@ public final class ForesterUtil {
         System.exit( -1 );
     }
 
-    public final static Color obtainColorDependingOnTaxonomyGroup( final String tax ) {
+    public final static Color obtainColorDependingOnTaxonomyGroup( final String tax, final String tax_code ) {
         if ( tax.equalsIgnoreCase( "deuterostomia" ) ) {
-            return DEUTEROSTOMIA_COLOR;
+            printRel( tax_code, "deuterostomia" );
+            return TaxonomyColors.DEUTEROSTOMIA_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "protostomia" ) ) {
-            return PROTOSTOMIA_COLOR;
+            printRel( tax_code, "protostomia" );
+            return TaxonomyColors.PROTOSTOMIA_COLOR;
         }
-        else if ( tax.equalsIgnoreCase( "metazoa" ) ) {
-            return METAZOA_COLOR;
+        else if ( tax.equalsIgnoreCase( "cnidaria" ) ) {
+            printRel( tax_code, "cnidaria" );
+            return TaxonomyColors.CNIDARIA_COLOR;
         }
-        else if ( tax.equalsIgnoreCase( "holozoa" ) ) {
-            return HOLOZOA_COLOR;
+        else if ( tax.toLowerCase().startsWith( "trichoplax" ) || tax.equalsIgnoreCase( "placozoa" ) ) {
+            printRel( tax_code, "placozoa" );
+            return TaxonomyColors.PLACOZOA_COLOR;
+        }
+        else if ( tax.toLowerCase().startsWith( "mnemiopsis" ) || tax.equalsIgnoreCase( "ctenophora" ) ) {
+            printRel( tax_code, "ctenophora" );
+            return TaxonomyColors.CTENOPHORA_COLOR;
+        }
+        else if ( tax.toLowerCase().startsWith( "amphimedon" ) || tax.equalsIgnoreCase( "porifera" ) ) {
+            printRel( tax_code, "porifera" );
+            return TaxonomyColors.PORIFERA_COLOR;
+        }
+        else if ( tax.equalsIgnoreCase( "codonosigidae" ) || tax.equalsIgnoreCase( "choanoflagellida" ) ) {
+            printRel( tax_code, "choanoflagellida" );
+            return TaxonomyColors.CHOANOFLAGELLIDA;
+        }
+        else if ( tax.toLowerCase().startsWith( "ichthyophonida & filasterea" )
+                || tax.toLowerCase().startsWith( "ichthyophonida and filasterea" )
+                || tax.toLowerCase().startsWith( "ichthyosporea & filasterea" )
+                || tax.toLowerCase().startsWith( "ichthyosporea and filasterea" ) ) {
+            printRel( tax_code, "ichthyophonida & filasterea" );
+            return TaxonomyColors.ICHTHYOSPOREA_AND_FILASTEREA;
         }
         else if ( tax.equalsIgnoreCase( "fungi" ) ) {
-            return FUNGI_COLOR;
+            printRel( tax_code, "fungi" );
+            return TaxonomyColors.FUNGI_COLOR;
         }
-        else if ( tax.equalsIgnoreCase( "holomycota" ) ) {
-            return HOLOMYCOTA_COLOR;
+        else if ( tax.toLowerCase().startsWith( "nucleariidae and fonticula" ) ) {
+            printRel( tax_code, "nucleariidae and fonticula group" );
+            return TaxonomyColors.NUCLEARIIDAE_AND_FONTICULA_GROUP_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "amoebozoa" ) ) {
-            return AMOEBOZOA_COLOR;
+            printRel( tax_code, "amoebozoa" );
+            return TaxonomyColors.AMOEBOZOA_COLOR;
         }
-        else if ( tax.equalsIgnoreCase( "viridiplantae" ) ) {
-            return VIRIDPLANTAE_COLOR;
+        else if ( tax.equalsIgnoreCase( "embryophyta" ) ) {
+            printRel( tax_code, "embryophyta" );
+            return TaxonomyColors.EMBRYOPHYTA_COLOR;
+        }
+        else if ( tax.equalsIgnoreCase( "chlorophyta" ) ) {
+            printRel( tax_code, "chlorophyta" );
+            return TaxonomyColors.CHLOROPHYTA_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "rhodophyta" ) ) {
-            return RHODOPHYTA_COLOR;
+            printRel( tax_code, "rhodophyta" );
+            return TaxonomyColors.RHODOPHYTA_COLOR;
         }
         else if ( tax.toLowerCase().startsWith( "hacrobia" ) ) {
-            return HACROBIA_COLOR;
+            printRel( tax_code, "hacrobia" );
+            return TaxonomyColors.HACROBIA_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "glaucocystophyceae" ) || tax.equalsIgnoreCase( "glaucophyta" ) ) {
-            return GLAUCOPHYTA_COLOR;
+            printRel( tax_code, "glaucocystophyceae" );
+            return TaxonomyColors.GLAUCOPHYTA_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "stramenopiles" ) ) {
-            return STRAMENOPILES_COLOR;
+            printRel( tax_code, "stramenopiles" );
+            return TaxonomyColors.STRAMENOPILES_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "alveolata" ) ) {
-            return ALVEOLATA_COLOR;
+            printRel( tax_code, "alveolata" );
+            return TaxonomyColors.ALVEOLATA_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "rhizaria" ) ) {
-            return RHIZARIA_COLOR;
+            printRel( tax_code, "rhizaria" );
+            return TaxonomyColors.RHIZARIA_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "excavata" ) ) {
-            return EXCAVATA_COLOR;
+            printRel( tax_code, "excavata" );
+            return TaxonomyColors.EXCAVATA_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "apusozoa" ) ) {
-            return APUSOZOA_COLOR;
+            printRel( tax_code, "apusozoa" );
+            return TaxonomyColors.APUSOZOA_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "archaea" ) ) {
-            return ARCHAEA_COLOR;
+            printRel( tax_code, "archaea" );
+            return TaxonomyColors.ARCHAEA_COLOR;
         }
         else if ( tax.equalsIgnoreCase( "bacteria" ) ) {
-            return BACTERIA_COLOR;
+            printRel( tax_code, "bacteria" );
+            return TaxonomyColors.BACTERIA_COLOR;
         }
         return null;
     }
+
+    private final static void printRel( String tax_code, String group ) {
+        //System.out.println( tax_code + "->" + group );
+        System.out.println( "_default_taxcode_taxgroup_map.put( \"" + tax_code + "\", \"" + group + "\" );" );
+    }
 }
diff --git a/forester/java/src/org/forester/util/TaxonomyColors.java b/forester/java/src/org/forester/util/TaxonomyColors.java
new file mode 100644 (file)
index 0000000..7f897ee
--- /dev/null
@@ -0,0 +1,43 @@
+\r
+package org.forester.util;\r
+\r
+import java.awt.Color;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+public final class TaxonomyColors {\r
+\r
+    public final static Color DEUTEROSTOMIA_COLOR                    = new Color( 255, 0, 0 );\r
+    public final static Color PROTOSTOMIA_COLOR                      = new Color( 204, 0, 0 );\r
+    public final static Color CNIDARIA_COLOR                         = new Color( 204, 0, 142 );\r
+    public final static Color PLACOZOA_COLOR                         = new Color( 204, 0, 132 );\r
+    public final static Color CTENOPHORA_COLOR                       = new Color( 204, 0, 122 );\r
+    public final static Color PORIFERA_COLOR                         = new Color( 204, 0, 112 );\r
+    public final static Color CHOANOFLAGELLIDA                       = new Color( 135, 0, 255 );\r
+    public final static Color ICHTHYOSPOREA_AND_FILASTEREA          = new Color( 125, 0, 225 );\r
+    public final static Color FUNGI_COLOR                            = new Color( 255, 153, 0 );\r
+    public final static Color NUCLEARIIDAE_AND_FONTICULA_GROUP_COLOR = new Color( 204, 102, 0 );\r
+    public final static Color AMOEBOZOA_COLOR                        = new Color( 255, 0, 255 );\r
+    public final static Color EMBRYOPHYTA_COLOR                      = new Color( 0, 255, 0 );\r
+    public final static Color CHLOROPHYTA_COLOR                      = new Color( 0, 204, 0 );\r
+    public final static Color RHODOPHYTA_COLOR                       = new Color( 0, 153, 76 );\r
+    public final static Color HACROBIA_COLOR                         = new Color( 0, 90, 40 );\r
+    public final static Color GLAUCOPHYTA_COLOR                      = new Color( 0, 90, 60 );\r
+    public final static Color STRAMENOPILES_COLOR                    = new Color( 0, 0, 255 );\r
+    public final static Color ALVEOLATA_COLOR                        = new Color( 0, 128, 255 );\r
+    public final static Color RHIZARIA_COLOR                         = new Color( 0, 255, 255 );\r
+    public static final Color APUSOZOA_COLOR                         = new Color( 204, 245, 245 );\r
+    public final static Color EXCAVATA_COLOR                         = new Color( 204, 204, 0 );\r
+    public final static Color ARCHAEA_COLOR                          = new Color( 160, 160, 160 );\r
+    public final static Color BACTERIA_COLOR                         = new Color( 64, 64, 64 );\r
+    \r
+    \r
+    private final static Map<String,String> _default_taxcode_taxgroup_map = new HashMap<String,String>();\r
+    \r
+    static {\r
+       // _default_taxcode_taxgroup_map.put( key, value );\r
+    }\r
+    \r
+    \r
+    \r
+}\r