- /**
- * Helper method for calcColor methods.
- *
- * @param smallercolor_component_x
- * color component the smaller color
- * @param largercolor_component_x
- * color component the larger color
- * @param x
- * factor
- * @return an int representing a color component
- */
- final private static int calculateColorComponent( final double smallercolor_component_x,
- final double largercolor_component_x,
- final double x ) {
- return ( int ) ( smallercolor_component_x + ( ( x * ( largercolor_component_x - smallercolor_component_x ) ) / 255.0 ) );
- }
-
- /**
- * Helper method for calcColor methods.
- *
- *
- * @param value
- * the value
- * @param larger
- * the largest value
- * @param smaller
- * the smallest value
- * @return a normalized value between larger and smaller
- */
- final private static double calculateColorFactor( final double value, final double larger, final double smaller ) {
- return ( 255.0 * ( value - smaller ) ) / ( larger - smaller );
- }
-
- final private static String[] splitString( final String str ) {
- final String regex = "[\\s;,]+";
- return str.split( regex );
- }
-
- public final static void outOfMemoryError( final OutOfMemoryError e ) {
- System.err.println();
- System.err.println( "Java memory allocation might be too small, try \"-Xmx2048m\" java command line option" );
- System.err.println();
- e.printStackTrace( System.err );
- System.err.println();
- System.exit( -1 );
- }
-
- public final static Color obtainColorDependingOnTaxonomyGroup( final String tax, final String tax_code ) {
- if ( tax.equalsIgnoreCase( "deuterostomia" ) ) {
- printRel( tax_code, "deuterostomia" );
- return TaxonomyColors.DEUTEROSTOMIA_COLOR;
- }
- else if ( tax.equalsIgnoreCase( "protostomia" ) ) {
- printRel( tax_code, "protostomia" );
- return TaxonomyColors.PROTOSTOMIA_COLOR;
- }
- else if ( tax.equalsIgnoreCase( "cnidaria" ) ) {
- printRel( tax_code, "cnidaria" );
- return TaxonomyColors.CNIDARIA_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" ) ) {
- printRel( tax_code, "fungi" );
- return TaxonomyColors.FUNGI_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" ) ) {
- printRel( tax_code, "amoebozoa" );
- return TaxonomyColors.AMOEBOZOA_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" ) ) {
- printRel( tax_code, "rhodophyta" );
- return TaxonomyColors.RHODOPHYTA_COLOR;
- }
- else if ( tax.toLowerCase().startsWith( "hacrobia" ) ) {
- printRel( tax_code, "hacrobia" );
- return TaxonomyColors.HACROBIA_COLOR;
- }
- else if ( tax.equalsIgnoreCase( "glaucocystophyceae" ) || tax.equalsIgnoreCase( "glaucophyta" ) ) {
- printRel( tax_code, "glaucocystophyceae" );
- return TaxonomyColors.GLAUCOPHYTA_COLOR;
- }
- else if ( tax.equalsIgnoreCase( "stramenopiles" ) ) {
- printRel( tax_code, "stramenopiles" );
- return TaxonomyColors.STRAMENOPILES_COLOR;
- }
- else if ( tax.equalsIgnoreCase( "alveolata" ) ) {
- printRel( tax_code, "alveolata" );
- return TaxonomyColors.ALVEOLATA_COLOR;
- }
- else if ( tax.equalsIgnoreCase( "rhizaria" ) ) {
- printRel( tax_code, "rhizaria" );
- return TaxonomyColors.RHIZARIA_COLOR;
- }
- else if ( tax.equalsIgnoreCase( "excavata" ) ) {
- printRel( tax_code, "excavata" );
- return TaxonomyColors.EXCAVATA_COLOR;
- }
- else if ( tax.equalsIgnoreCase( "apusozoa" ) ) {
- printRel( tax_code, "apusozoa" );
- return TaxonomyColors.APUSOZOA_COLOR;
- }
- else if ( tax.equalsIgnoreCase( "archaea" ) ) {
- printRel( tax_code, "archaea" );
- return TaxonomyColors.ARCHAEA_COLOR;
- }
- else if ( tax.equalsIgnoreCase( "bacteria" ) ) {
- printRel( tax_code, "bacteria" );
- return TaxonomyColors.BACTERIA_COLOR;
- }
- return null;
- }
-
- private final static void printRel( final String tax_code, final String group ) {
- //System.out.println( tax_code + "->" + group );
- System.out.println( "_default_taxcode_taxgroup_map.put( \"" + tax_code + "\", \"" + group + "\" );" );