public boolean isShowAnnotationRefSource() {
return _show_annotation_ref_source;
}
+
+ public boolean isColorByTaxonomicGroup() {
+
+ return false;
+ }
}
static final String SEARCH_CASE_SENSITIVE_LABEL = "Case Sensitive";
static final String INVERSE_SEARCH_RESULT_LABEL = "Negate Result";
static final String DISPLAY_BRANCH_LENGTH_VALUES_LABEL = "Display Branch Length Values";
+ static final String COLOR_BY_TAXONOMIC_GROUP = "Color by Taxonomic Group";
static final String DISPLAY_SCALE_LABEL = "Display Scale";
static final String NON_LINED_UP_CLADOGRAMS_LABEL = "Non-Lined Up Cladograms";
static final String UNIFORM_CLADOGRAMS_LABEL = "Total Node Sum Dependent Cladograms";
static final String LABEL_DIRECTION_LABEL = "Radial Labels";
static final String LABEL_DIRECTION_TIP = "To use radial node labels in radial and unrooted display types";
static final String SCREEN_ANTIALIAS_LABEL = "Antialias";
- static final String COLOR_LABELS_LABEL = "Colorize Labels Same as Parent Branch";
+ static final String COLOR_LABELS_LABEL = "Color Labels Same as Parent Branch";
static final String BG_GRAD_LABEL = "Background Color Gradient";
static final String DISPLAY_NODE_BOXES_LABEL_EXT = "Show External Node Shapes";
static final String DISPLAY_NODE_BOXES_LABEL_INT = "Show Internal Node Shapes";
JRadioButtonMenuItem _uniform_cladograms_rbmi;
JRadioButtonMenuItem _ext_node_dependent_cladogram_rbmi;
JCheckBoxMenuItem _show_branch_length_values_cbmi;
+ JCheckBoxMenuItem _color_by_taxonomic_group_cbmi;
+
JCheckBoxMenuItem _show_scale_cbmi; //TODO fix me
JCheckBoxMenuItem _show_overview_cbmi;
JCheckBoxMenuItem _show_domain_labels;
else if ( o == _show_branch_length_values_cbmi ) {
updateOptions( getOptions() );
}
+ else if ( o == _color_by_taxonomic_group_cbmi ) {
+ updateOptions( getOptions() );
+ }
+
else if ( o == _show_confidence_stddev_cbmi ) {
updateOptions( getOptions() );
}
if ( ( _show_branch_length_values_cbmi != null ) && _show_branch_length_values_cbmi.isEnabled() ) {
options.setShowBranchLengthValues( _show_branch_length_values_cbmi.isSelected() );
}
+
+ if ( ( _color_by_taxonomic_group_cbmi != null ) && _color_by_taxonomic_group_cbmi.isEnabled() ) {
+ options.setColorByTaxonomicGroup( _color_by_taxonomic_group_cbmi.isSelected() );
+ }
+
+
options.setPrintUsingActualSize( ( _print_using_actual_size_cbmi != null )
&& ( _print_using_actual_size_cbmi.isSelected() ) );
options.setGraphicsExportUsingActualSize( ( _graphics_export_using_actual_size_cbmi != null )
_options_jmenu.add( _show_scale_cbmi = new JCheckBoxMenuItem( DISPLAY_SCALE_LABEL ) );
_options_jmenu
.add( _show_branch_length_values_cbmi = new JCheckBoxMenuItem( DISPLAY_BRANCH_LENGTH_VALUES_LABEL ) );
- _options_jmenu.add( _show_confidence_stddev_cbmi = new JCheckBoxMenuItem( SHOW_CONF_STDDEV_LABEL ) );
+
+
_options_jmenu
.add( _show_default_node_shapes_internal_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL_INT ) );
_options_jmenu
.add( _show_default_node_shapes_external_cbmi = new JCheckBoxMenuItem( DISPLAY_NODE_BOXES_LABEL_EXT ) );
+
+ _options_jmenu
+ .add( _color_by_taxonomic_group_cbmi = new JCheckBoxMenuItem( COLOR_BY_TAXONOMIC_GROUP ) );
+
_options_jmenu
.add( _taxonomy_colorize_node_shapes_cbmi = new JCheckBoxMenuItem( MainFrame.TAXONOMY_COLORIZE_NODE_SHAPES_LABEL ) );
+ _options_jmenu.add( _show_confidence_stddev_cbmi = new JCheckBoxMenuItem( SHOW_CONF_STDDEV_LABEL ) );
+
_options_jmenu.add( _cycle_node_shape_mi = new JMenuItem( MainFrame.CYCLE_NODE_SHAPE_LABEL ) );
_options_jmenu.add( _cycle_node_fill_mi = new JMenuItem( MainFrame.CYCLE_NODE_FILL_LABEL ) );
_options_jmenu.add( _choose_node_size_mi = new JMenuItem( MainFrame.CHOOSE_NODE_SIZE_LABEL ) );
customizeJMenuItem( _cycle_node_fill_mi );
customizeJMenuItem( _choose_node_size_mi );
customizeCheckBoxMenuItem( _color_labels_same_as_parent_branch, getOptions().isColorLabelsSameAsParentBranch() );
- customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
+ customizeCheckBoxMenuItem( _color_by_taxonomic_group_cbmi, getOptions().isColorByTaxonomicGroup() );
+
+ customizeCheckBoxMenuItem( _screen_antialias_cbmi, getOptions().isAntialiasScreen() );
customizeCheckBoxMenuItem( _background_gradient_cbmi, getOptions().isBackgroundColorGradient() );
customizeCheckBoxMenuItem( _show_domain_labels, getOptions().isShowDomainLabels() );
customizeCheckBoxMenuItem( _show_annotation_ref_source, getOptions().isShowAnnotationRefSource() );
final public class Options {
static final double MIN_CONFIDENCE_DEFAULT = 0.0;
+ private boolean _color_by_taxonomic_group;
private boolean _show_branch_length_values;
private boolean _internal_number_are_confidence_for_nh_parsing;
private boolean _show_scale;
return _show_branch_length_values;
}
+ final boolean isColorByTaxonomicGroup() {
+ return _color_by_taxonomic_group;
+ }
+
+
boolean isShowConfidenceStddev() {
return _show_confidence_stddev;
}
_show_branch_length_values = show_branch_length_values;
}
+ final void setColorByTaxonomicGroup( final boolean color_by_taxonomic_group ) {
+ _color_by_taxonomic_group = color_by_taxonomic_group;
+ }
+
void setShowConfidenceStddev( final boolean show_confidence_stddev ) {
_show_confidence_stddev = show_confidence_stddev;
}
instance.setShowScale( configuration.isShowScale() );
instance.setShowBranchLengthValues( configuration.isShowBranchLengthValues() );
instance.setShowOverview( configuration.isShowOverview() );
+ instance.setColorByTaxonomicGroup( configuration.isColorByTaxonomicGroup() );
instance.setCladogramType( configuration.getCladogramType() );
instance.setOvPlacement( configuration.getOvPlacement() );
instance.setPrintLineWidth( configuration.getPrintLineWidth() );
final class TaxonomyUtil {
+ static String getTaxGroupByTaxCode( String code ) {
+ return _default_taxcode_taxgroup_map.get( code );
+ }
+
+
private final static Map<String, String> _default_taxcode_taxgroup_map = new HashMap<String, String>();
static {
_default_taxcode_taxgroup_map.put( "HUMAN", "deuterostomia" );
}
final Color calculateTaxonomyBasedColor( final Taxonomy tax ) {
- if ( ForesterUtil.isEmpty( tax.getTaxonomyCode() ) && ForesterUtil.isEmpty( tax.getScientificName() ) ) {
+ if ( getOptions().isColorByTaxonomicGroup() && !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
+ boolean ex = false;
+ String group = null;
+ try {
+ group =TaxonomyUtil.getTaxGroupByTaxCode( tax.getTaxonomyCode() );
+ }
+ catch ( Exception e ) {
+ ex = true;
+ }
+ if ( !ex && !ForesterUtil.isEmpty( group ) ) {
+ Color c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( group );
+ if ( c != null ) {
+ return c;
+ }
+ }
return getTreeColorSet().getTaxonomyColor();
}
- Color c = null;
- if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
- c = getControlPanel().getSpeciesColors().get( tax.getTaxonomyCode() );
- }
- if ( ( c == null ) && !ForesterUtil.isEmpty( tax.getScientificName() ) ) {
- c = getControlPanel().getSpeciesColors().get( tax.getScientificName() );
- }
- if ( c == null ) {
+ else {
+ if ( ForesterUtil.isEmpty( tax.getTaxonomyCode() ) && ForesterUtil.isEmpty( tax.getScientificName() ) ) {
+ return getTreeColorSet().getTaxonomyColor();
+ }
+ Color c = null;
if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
- c = TreePanelUtil.calculateColorFromString( tax.getTaxonomyCode(), true );
- getControlPanel().getSpeciesColors().put( tax.getTaxonomyCode(), c );
+ c = getControlPanel().getSpeciesColors().get( tax.getTaxonomyCode() );
}
- else {
- c = TreePanelUtil.calculateColorFromString( tax.getScientificName(), true );
- getControlPanel().getSpeciesColors().put( tax.getScientificName(), c );
+ if ( ( c == null ) && !ForesterUtil.isEmpty( tax.getScientificName() ) ) {
+ c = getControlPanel().getSpeciesColors().get( tax.getScientificName() );
+ }
+ if ( c == null ) {
+ if ( !ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
+ c = TreePanelUtil.calculateColorFromString( tax.getTaxonomyCode(), true );
+ getControlPanel().getSpeciesColors().put( tax.getTaxonomyCode(), c );
+ }
+ else {
+ c = TreePanelUtil.calculateColorFromString( tax.getScientificName(), true );
+ getControlPanel().getSpeciesColors().put( tax.getScientificName(), c );
+ }
}
+ return c;
}
- return c;
}
void checkForVectorProperties( final Phylogeny phy ) {
package org.forester.surfacing;
+import java.awt.Color;
+import java.util.Comparator;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
return sb;
}
-
-
private StringBuffer getTaxonomyGroupDistribution( Phylogeny tol ) {
//TODO work on me
-
- final SortedMap<String, SortedSet<String>> m = new TreeMap<String, SortedSet<String>>();
+ final SortedMap<String, Set<String>> domain_to_species_set_map = new TreeMap<String, Set<String>>();
for( final Species species : getSpeciesData().keySet() ) {
for( final String combable_dom : getCombinableDomainIds( species ) ) {
- if ( !m.containsKey( combable_dom ) ) {
- m.put( combable_dom, new TreeSet<String>() );
+ if ( !domain_to_species_set_map.containsKey( combable_dom ) ) {
+ domain_to_species_set_map.put( combable_dom, new HashSet<String>() );
}
- m.get( combable_dom ).add( species.getSpeciesId() );
+ domain_to_species_set_map.get( combable_dom ).add( species.getSpeciesId() );
}
}
- Map<String,Integer> countz = new HashMap<String,Integer>();
- for( final Map.Entry<String, SortedSet<String>> e : m.entrySet() ) {
- for( final String tax_code : e.getValue() ) {
- final String group = SurfacingUtil.obtainTaxonomyGroup( tax_code, tol );
+ final StringBuffer sb = new StringBuffer();
+ for( final Map.Entry<String, Set<String>> domain_to_species_set : domain_to_species_set_map.entrySet() ) {
+ final Map<String, Integer> countz = new HashMap<String, Integer>();
+ final ValueComparator bvc = new ValueComparator( countz );
+ final SortedMap<String, Integer> sorted_countz = new TreeMap<String, Integer>( bvc );
+ for( final String tax_code : domain_to_species_set.getValue() ) {
+ final String group = SurfacingUtil.obtainTaxonomyGroup( tax_code, tol );
if ( !ForesterUtil.isEmpty( group ) ) {
if ( !countz.containsKey( group ) ) {
countz.put( group, 1 );
}
else {
- countz.put( group, countz.get( group) + 1 );
+ countz.put( group, countz.get( group ) + 1 );
}
-
}
else {
return null;
}
-
}
-
- }
- final StringBuffer sb = new StringBuffer();
-
- // i am just a template and need to be modified for "printout" TODO
- for( final Map.Entry<String, SortedSet<String>> e : m.entrySet() ) {
- sb.append( "<a href=\"" + SurfacingConstants.PFAM_FAMILY_ID_LINK + e.getKey() + "\">" + e.getKey() + "</a>" );
+ sorted_countz.putAll( countz );
+ sb.append( "<a href=\"" + SurfacingConstants.PFAM_FAMILY_ID_LINK + domain_to_species_set.getKey() + "\">" + domain_to_species_set.getKey() + "</a>" );
sb.append( ": " );
sb.append( "<span style=\"font-size:8px\">" );
- for( final String tax : e.getValue() ) {
- final String hex = SurfacingUtil.obtainHexColorStringDependingOnTaxonomyGroup( tax, null );
- if ( !ForesterUtil.isEmpty( hex ) ) {
- sb.append( "<span style=\"color:" );
- sb.append( hex );
- sb.append( "\">" );
- sb.append( tax );
- sb.append( "</span>" );
- }
- else {
- sb.append( tax );
- }
+ for( final Map.Entry<String, Integer> group_to_counts : sorted_countz.entrySet() ) {
+ final String group = group_to_counts.getKey();
+ final Color c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( group );
+ if ( c == null ) {
+ throw new IllegalArgumentException( "no color found for taxonomy group\"" + group + "\"" );
+ }
+ final String hex = String.format( "#%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue() );
+
+ sb.append( "<span style=\"color:" );
+ sb.append( hex );
+ sb.append( "\">" );
+ sb.append( group );
+ sb.append( ": " );
+ sb.append( group_to_counts.getValue() );
+ sb.append( "</span>" );
sb.append( " " );
+ sb.append( "<br>\n" );
}
sb.append( "</span>" );
- sb.append( "<br>\n" );
+
}
+ // i am just a template and need to be modified for "printout" TODO
+ // for( final Map.Entry<String, SortedSet<String>> e : m.entrySet() ) {
+ // sb.append( "<a href=\"" + SurfacingConstants.PFAM_FAMILY_ID_LINK + e.getKey() + "\">" + e.getKey() + "</a>" );
+ // sb.append( ": " );
+ // sb.append( "<span style=\"font-size:8px\">" );
+ // for( final String tax : e.getValue() ) {
+ // final String hex = SurfacingUtil.obtainHexColorStringDependingOnTaxonomyGroup( tax, null );
+ // if ( !ForesterUtil.isEmpty( hex ) ) {
+ // sb.append( "<span style=\"color:" );
+ // sb.append( hex );
+ // sb.append( "\">" );
+ // sb.append( tax );
+ // sb.append( "</span>" );
+ // }
+ // else {
+ // sb.append( tax );
+ // }
+ // sb.append( " " );
+ // }
+ // sb.append( "</span>" );
+ // sb.append( "<br>\n" );
+ // }
return sb;
}
-
-
+
+ /*
+ public class Testing {
+
+ public static void main(String[] args) {
+
+ HashMap<String,Double> map = new HashMap<String,Double>();
+ ValueComparator bvc = new ValueComparator(map);
+ TreeMap<String,Double> sorted_map = new TreeMap<String,Double>(bvc);
+
+ map.put("A",99.5);
+ map.put("B",67.4);
+ map.put("C",67.4);
+ map.put("D",67.3);
+
+ System.out.println("unsorted map: "+map);
+
+ sorted_map.putAll(map);
+
+ System.out.println("results: "+sorted_map);
+ }
+ }
+
+
+
+ */
private StringBuffer getSpeciesDataInAlphabeticalOrder( final boolean html,
final Map<String, Integer> tax_code_to_id_map,
final Phylogeny phy ) {
sb.append( "<td>" );
sb.append( getSpeciesDataInAlphabeticalOrder( true, tax_code_to_id_map, phy ) );
sb.append( getDomainDataInAlphabeticalOrder() );
+ sb.append( getTaxonomyGroupDistribution( phy ) );
sb.append( "</td>" );
}
else {
sb.append( "<td>" );
sb.append( getSpeciesDataInCustomOrder( true, tax_code_to_id_map, phy ) );
sb.append( getDomainDataInAlphabeticalOrder() );
+ sb.append( getTaxonomyGroupDistribution( phy ) );
+
sb.append( "</td>" );
}
sb.append( "</tr>" );
public static enum PRINT_OPTION {
HTML, SIMPLE_TAB_DELIMITED;
}
+
+ class ValueComparator implements Comparator<String> {
+
+ final private Map<String, Integer> _base;
+
+ public ValueComparator( final Map<String, Integer> base ) {
+ _base = base;
+ }
+
+ public int compare( final String a, final String b ) {
+ if ( _base.get( a ) >= _base.get( b ) ) {
+ return -1;
+ }
+ else {
+ return 1;
+ } // returning 0 would merge keys
+ }
+ }
}
throws IllegalArgumentException {
if ( !_TAXCODE_HEXCOLORSTRING_MAP.containsKey( tax_code ) ) {
if ( ( phy != null ) && !phy.isEmpty() ) {
- final List<PhylogenyNode> nodes = phy.getNodesViaTaxonomyCode( tax_code );
- Color c = null;
- if ( ( nodes == null ) || nodes.isEmpty() ) {
- throw new IllegalArgumentException( "code " + tax_code + " is not found" );
- }
- if ( nodes.size() != 1 ) {
- throw new IllegalArgumentException( "code " + tax_code + " is not unique" );
- }
- PhylogenyNode n = nodes.get( 0 );
- while ( n != null ) {
- if ( n.getNodeData().isHasTaxonomy()
- && !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getScientificName() ) ) {
- c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( n.getNodeData().getTaxonomy()
- .getScientificName(), tax_code );
- }
- if ( ( c == null ) && !ForesterUtil.isEmpty( n.getName() ) ) {
- c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( n.getName(), tax_code );
- }
- if ( c != null ) {
- break;
- }
- n = n.getParent();
- }
+// final List<PhylogenyNode> nodes = phy.getNodesViaTaxonomyCode( tax_code );
+// Color c = null;
+// if ( ( nodes == null ) || nodes.isEmpty() ) {
+// throw new IllegalArgumentException( "code " + tax_code + " is not found" );
+// }
+// if ( nodes.size() != 1 ) {
+// throw new IllegalArgumentException( "code " + tax_code + " is not unique" );
+// }
+// PhylogenyNode n = nodes.get( 0 );
+// while ( n != null ) {
+// if ( n.getNodeData().isHasTaxonomy()
+// && !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getScientificName() ) ) {
+// c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( n.getNodeData().getTaxonomy()
+// .getScientificName(), tax_code );
+// }
+// if ( ( c == null ) && !ForesterUtil.isEmpty( n.getName() ) ) {
+// c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( n.getName(), tax_code );
+// }
+// if ( c != null ) {
+// break;
+// }
+// n = n.getParent();
+// }
+ final String group = obtainTaxonomyGroup( tax_code, phy );
+ Color c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( group );
if ( c == null ) {
throw new IllegalArgumentException( "no color found for taxonomy code \"" + tax_code + "\"" );
- }
+ }
final String hex = String.format( "#%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue() );
_TAXCODE_HEXCOLORSTRING_MAP.put( tax_code, hex );
}
}
- public static String obtainTaxonomyGroup( final String tax_code, final Phylogeny phy )
+ public static String obtainTaxonomyGroup( final String tax_code, final Phylogeny species_tree )
throws IllegalArgumentException {
if ( !_TAXCODE_TAXGROUP_MAP.containsKey( tax_code ) ) {
- if ( ( phy != null ) && !phy.isEmpty() ) {
- final List<PhylogenyNode> nodes = phy.getNodesViaTaxonomyCode( tax_code );
+ if ( ( species_tree != null ) && !species_tree.isEmpty() ) {
+ final List<PhylogenyNode> nodes = species_tree.getNodesViaTaxonomyCode( tax_code );
if ( ( nodes == null ) || nodes.isEmpty() ) {
throw new IllegalArgumentException( "code " + tax_code + " is not found" );
}
PhylogenyNode n = nodes.get( 0 );
String group = null;
- Color c = null;
+
while ( n != null ) {
if ( n.getNodeData().isHasTaxonomy()
&& !ForesterUtil.isEmpty( n.getNodeData().getTaxonomy().getScientificName() ) ) {
- c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( n.getNodeData().getTaxonomy()
- .getScientificName(), tax_code );
+ group = ForesterUtil.obtainNormalizedTaxonomyGroup( n.getNodeData().getTaxonomy()
+ .getScientificName() );
- group = n.getNodeData().getTaxonomy()
- .getScientificName();
}
- if ( ( c == null ) && !ForesterUtil.isEmpty( n.getName() ) ) {
- c = ForesterUtil.obtainColorDependingOnTaxonomyGroup( n.getName(), tax_code );
- group = n.getName();
+ if ( ForesterUtil.isEmpty( group ) && !ForesterUtil.isEmpty( n.getName() ) ) {
+ group = ForesterUtil.obtainNormalizedTaxonomyGroup( n.getName() );
+
}
- if ( c != null ) {
+ if ( !ForesterUtil.isEmpty( group ) ) {
break;
}
- group = null;
+
n = n.getParent();
}
- if ( c == null ) {
+ if ( ForesterUtil.isEmpty( group ) ) {
throw new IllegalArgumentException( "no group found for taxonomy code \"" + tax_code + "\"" );
}
System.exit( -1 );
}
- public final static Color obtainColorDependingOnTaxonomyGroup( final String tax, final String tax_code ) {
+ public final static Color obtainColorDependingOnTaxonomyGroup( final String tax_group ) {
+ if ( !ForesterUtil.isEmpty( tax_group ) ) {
+ if ( tax_group.equals( "deuterostomia" ) ) {
+ return TaxonomyColors.DEUTEROSTOMIA_COLOR;
+ }
+ else if ( tax_group.equals( "protostomia" ) ) {
+ return TaxonomyColors.PROTOSTOMIA_COLOR;
+ }
+ else if ( tax_group.equals( "cnidaria" ) ) {
+ return TaxonomyColors.CNIDARIA_COLOR;
+ }
+ else if ( tax_group.equals( "placozoa" ) ) {
+ return TaxonomyColors.PLACOZOA_COLOR;
+ }
+ else if ( tax_group.equals( "ctenophora" ) ) {
+ return TaxonomyColors.CTENOPHORA_COLOR;
+ }
+ else if ( tax_group.equals( "porifera" ) ) {
+ return TaxonomyColors.PORIFERA_COLOR;
+ }
+ else if ( tax_group.equals( "choanoflagellida" ) ) {
+ return TaxonomyColors.CHOANOFLAGELLIDA;
+ }
+ else if ( tax_group.equals( "ichthyophonida & filasterea" ) ) {
+ return TaxonomyColors.ICHTHYOSPOREA_AND_FILASTEREA;
+ }
+ else if ( tax_group.equals( "dikarya" ) ) {
+ return TaxonomyColors.DIKARYA_COLOR;
+ }
+ else if ( tax_group.equalsIgnoreCase( "fungi" ) || tax_group.equalsIgnoreCase( "other fungi" ) ) {
+ return TaxonomyColors.OTHER_FUNGI_COLOR;
+ }
+ else if ( tax_group.equals( "nucleariidae and fonticula" ) ) {
+ return TaxonomyColors.NUCLEARIIDAE_AND_FONTICULA_GROUP_COLOR;
+ }
+ else if ( tax_group.equals( "amoebozoa" ) ) {
+ return TaxonomyColors.AMOEBOZOA_COLOR;
+ }
+ else if ( tax_group.equals( "embryophyta" ) ) {
+ return TaxonomyColors.EMBRYOPHYTA_COLOR;
+ }
+ else if ( tax_group.equals( "chlorophyta" ) ) {
+ return TaxonomyColors.CHLOROPHYTA_COLOR;
+ }
+ else if ( tax_group.equals( "rhodophyta" ) ) {
+ return TaxonomyColors.RHODOPHYTA_COLOR;
+ }
+ else if ( tax_group.equals( "hacrobia" ) ) {
+ return TaxonomyColors.HACROBIA_COLOR;
+ }
+ else if ( tax_group.equals( "glaucocystophyceae" ) ) {
+ return TaxonomyColors.GLAUCOPHYTA_COLOR;
+ }
+ else if ( tax_group.equals( "stramenopiles" ) ) {
+ return TaxonomyColors.STRAMENOPILES_COLOR;
+ }
+ else if ( tax_group.equals( "alveolata" ) ) {
+ return TaxonomyColors.ALVEOLATA_COLOR;
+ }
+ else if ( tax_group.equals( "rhizaria" ) ) {
+ return TaxonomyColors.RHIZARIA_COLOR;
+ }
+ else if ( tax_group.equals( "excavata" ) ) {
+ return TaxonomyColors.EXCAVATA_COLOR;
+ }
+ else if ( tax_group.equals( "apusozoa" ) ) {
+ return TaxonomyColors.APUSOZOA_COLOR;
+ }
+ else if ( tax_group.equals( "archaea" ) ) {
+ return TaxonomyColors.ARCHAEA_COLOR;
+ }
+ else if ( tax_group.equals( "bacteria" ) ) {
+ return TaxonomyColors.BACTERIA_COLOR;
+ }
+ }
+ return null;
+ }
+
+ public final static String obtainNormalizedTaxonomyGroup( final String tax ) {
if ( tax.equalsIgnoreCase( "deuterostomia" ) ) {
- printRel( tax_code, "deuterostomia" );
- return TaxonomyColors.DEUTEROSTOMIA_COLOR;
+ return "deuterostomia";
}
else if ( tax.equalsIgnoreCase( "protostomia" ) ) {
- printRel( tax_code, "protostomia" );
- return TaxonomyColors.PROTOSTOMIA_COLOR;
+ return "protostomia";
}
else if ( tax.equalsIgnoreCase( "cnidaria" ) ) {
- printRel( tax_code, "cnidaria" );
- return TaxonomyColors.CNIDARIA_COLOR;
+ return "cnidaria";
}
else if ( tax.toLowerCase().startsWith( "trichoplax" ) || tax.equalsIgnoreCase( "placozoa" ) ) {
- printRel( tax_code, "placozoa" );
- return TaxonomyColors.PLACOZOA_COLOR;
+ return "placozoa";
}
else if ( tax.toLowerCase().startsWith( "mnemiopsis" ) || tax.equalsIgnoreCase( "ctenophora" ) ) {
- printRel( tax_code, "ctenophora" );
- return TaxonomyColors.CTENOPHORA_COLOR;
+ return "ctenophora";
}
else if ( tax.toLowerCase().startsWith( "amphimedon" ) || tax.equalsIgnoreCase( "porifera" ) ) {
- printRel( tax_code, "porifera" );
- return TaxonomyColors.PORIFERA_COLOR;
+ return "porifera";
}
else if ( tax.equalsIgnoreCase( "codonosigidae" ) || tax.equalsIgnoreCase( "choanoflagellida" ) ) {
- printRel( tax_code, "choanoflagellida" );
- return TaxonomyColors.CHOANOFLAGELLIDA;
+ return "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;
+ return "ichthyophonida & filasterea";
}
else if ( tax.equalsIgnoreCase( "dikarya" ) ) {
- printRel( tax_code, "dikarya" );
- return TaxonomyColors.DIKARYA_COLOR;
+ return "dikarya";
}
- else if ( tax.equalsIgnoreCase( "fungi" ) || tax.equalsIgnoreCase( "other fungi" ) ) {
- printRel( tax_code, "other fungi" );
- return TaxonomyColors.OTHER_FUNGI_COLOR;
+ else if ( tax.equalsIgnoreCase( "other fungi" ) ) {
+ return "other fungi";
}
else if ( tax.toLowerCase().startsWith( "nucleariidae and fonticula" ) ) {
- printRel( tax_code, "nucleariidae and fonticula group" );
- return TaxonomyColors.NUCLEARIIDAE_AND_FONTICULA_GROUP_COLOR;
+ return "nucleariidae and fonticula group";
}
else if ( tax.equalsIgnoreCase( "amoebozoa" ) ) {
- printRel( tax_code, "amoebozoa" );
- return TaxonomyColors.AMOEBOZOA_COLOR;
+ return "amoebozoa";
}
else if ( tax.equalsIgnoreCase( "embryophyta" ) ) {
- printRel( tax_code, "embryophyta" );
- return TaxonomyColors.EMBRYOPHYTA_COLOR;
+ return "embryophyta";
}
else if ( tax.equalsIgnoreCase( "chlorophyta" ) ) {
- printRel( tax_code, "chlorophyta" );
- return TaxonomyColors.CHLOROPHYTA_COLOR;
+ return "chlorophyta";
}
else if ( tax.equalsIgnoreCase( "rhodophyta" ) ) {
- printRel( tax_code, "rhodophyta" );
- return TaxonomyColors.RHODOPHYTA_COLOR;
+ return "rhodophyta";
}
else if ( tax.toLowerCase().startsWith( "hacrobia" ) ) {
- printRel( tax_code, "hacrobia" );
- return TaxonomyColors.HACROBIA_COLOR;
+ return "hacrobia";
}
else if ( tax.equalsIgnoreCase( "glaucocystophyceae" ) || tax.equalsIgnoreCase( "glaucophyta" ) ) {
- printRel( tax_code, "glaucocystophyceae" );
- return TaxonomyColors.GLAUCOPHYTA_COLOR;
+ return "glaucocystophyceae";
}
else if ( tax.equalsIgnoreCase( "stramenopiles" ) ) {
- printRel( tax_code, "stramenopiles" );
- return TaxonomyColors.STRAMENOPILES_COLOR;
+ return "stramenopiles";
}
else if ( tax.equalsIgnoreCase( "alveolata" ) ) {
- printRel( tax_code, "alveolata" );
- return TaxonomyColors.ALVEOLATA_COLOR;
+ return "alveolata";
}
else if ( tax.equalsIgnoreCase( "rhizaria" ) ) {
- printRel( tax_code, "rhizaria" );
- return TaxonomyColors.RHIZARIA_COLOR;
+ return "rhizaria";
}
else if ( tax.equalsIgnoreCase( "excavata" ) ) {
- printRel( tax_code, "excavata" );
- return TaxonomyColors.EXCAVATA_COLOR;
+ return "excavata";
}
else if ( tax.equalsIgnoreCase( "apusozoa" ) ) {
- printRel( tax_code, "apusozoa" );
- return TaxonomyColors.APUSOZOA_COLOR;
+ return "apusozoa";
}
else if ( tax.equalsIgnoreCase( "archaea" ) ) {
- printRel( tax_code, "archaea" );
- return TaxonomyColors.ARCHAEA_COLOR;
+ return "archaea";
}
else if ( tax.equalsIgnoreCase( "bacteria" ) ) {
- printRel( tax_code, "bacteria" );
- return TaxonomyColors.BACTERIA_COLOR;
+ return "bacteria";
}
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 + "\" );" );
- }
}