import org.forester.io.parsers.nhx.NHXParser;
import org.forester.io.parsers.phyloxml.PhyloXmlParser;
import org.forester.phylogeny.Phylogeny;
-import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
import org.forester.util.ForesterUtil;
//
//
public final class Archaeopteryx {
- private final static boolean TEST = false; //TODO remove me!
-
public static MainFrame createApplication( final Phylogeny phylogeny ) {
final Phylogeny[] phylogenies = new Phylogeny[ 1 ];
phylogenies[ 0 ] = phylogeny;
ForesterUtil.transferInternalNodeNamesToConfidence( phy );
}
}
- //
- // Phylogeny py = phylogenies[ 0 ];
- // for( final PhylogenyNodeIterator iter = py.iteratorExternalForward(); iter.hasNext(); ) {
- // final PhylogenyNode node = iter.next();
- // System.out.println( node.getNodeData().getTaxonomy().getScientificName() + "\t"
- // + node.getNodeData().getBinaryCharacters().getPresentCount() );
- // }
- // for( final PhylogenyNodeIterator iter = py.iteratorPreorder(); iter.hasNext(); ) {
- // final PhylogenyNode node = iter.next();
- // if ( !node.isExternal() ) {
- // System.out.println( node.getNodeData().getTaxonomy().getScientificName() + "\t"
- // + node.getNodeData().getBinaryCharacters().getPresentCount() );
- // }
- // }
- //
}
}
}
title = f.getName();
}
try {
- String s = "";
- if ( TEST ) {
- s = "/home/czmasek/888.xml";
- if ( ForesterUtil.isReadableFile( s ) != null ) {
- s = "/Users/zma/888.xml";
- if ( ForesterUtil.isReadableFile( s ) != null ) {
- s = "C:\\888.xml";
- if ( ForesterUtil.isReadableFile( s ) != null ) {
- s = "C:\\Documents and Settings\\czmasek\\";
- }
- }
- }
- }
- if ( !TEST ) {
- MainFrameApplication.createInstance( phylogenies, conf, title );
- }
- else {
- MainFrameApplication.createInstance( ParserBasedPhylogenyFactory.getInstance()
- .create( s, new PhyloXmlParser() ),
- conf,
- title );
- }
+ MainFrameApplication.createInstance( phylogenies, conf, title );
}
- // catch ( final IOException ex ) {
- // ForesterUtil.fatalError( Constants.PRG_NAME, "failed to start: " + ex.getLocalizedMessage() );
- // }
catch ( final Exception ex ) {
Util.unexpectedException( ex );
}
import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
+import org.forester.archaeopteryx.Options.NodeFill;
+import org.forester.archaeopteryx.Options.NodeShape;
import org.forester.archaeopteryx.Options.OVERVIEW_PLACEMENT_TYPE;
import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
import org.forester.util.ForesterUtil;
private boolean _abbreviate_scientific_names = false;
private boolean _color_labels_same_as_parent_branch = false;
private int _default_bootstrap_samples = -1;
+ private NodeShape _default_node_shape = NodeShape.NONE;
+ private NodeFill _default_node_fill = NodeFill.GRADIENT;
+ private short _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
+ private boolean _taxonomy_colorize_node_shapes_instead_of_labels = false;
final static int display_as_phylogram = 0;
final static int show_node_names = 1;
final static int show_tax_code = 2;
else if ( key.equals( "domain_structure_base_color" ) ) {
_domain_structure_base_color = Color.decode( ( String ) st.nextElement() );
}
+ //
+ else if ( key.equals( "default_node_size" ) ) {
+ final short i = parseShort( ( ( String ) st.nextElement() ).trim() );
+ setDefaultNodeShapeSize( i );
+ }
+ else if ( key.equals( "default_node_fill" ) ) {
+ final String fill_str = ( ( String ) st.nextElement() ).trim();
+ if ( fill_str.equalsIgnoreCase( Options.NodeFill.NONE.toString() ) ) {
+ setDefaultNodeFill( NodeFill.NONE );
+ }
+ else if ( fill_str.equalsIgnoreCase( Options.NodeFill.GRADIENT.toString() ) ) {
+ setDefaultNodeFill( NodeFill.GRADIENT );
+ }
+ else if ( fill_str.equalsIgnoreCase( Options.NodeFill.SOLID.toString() ) ) {
+ setDefaultNodeFill( NodeFill.SOLID );
+ }
+ else {
+ ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + fill_str
+ + "] for [default_node_fill]" );
+ }
+ }
+ else if ( key.equals( "default_node_shape" ) ) {
+ final String shape_str = ( ( String ) st.nextElement() ).trim();
+ if ( shape_str.equalsIgnoreCase( Options.NodeShape.NONE.toString() ) ) {
+ setDefaultNodeShape( NodeShape.NONE );
+ }
+ else if ( shape_str.equalsIgnoreCase( Options.NodeShape.CIRCLE.toString() ) ) {
+ setDefaultNodeShape( NodeShape.CIRCLE );
+ }
+ else if ( shape_str.equalsIgnoreCase( Options.NodeShape.RECTANGLE.toString() ) ) {
+ setDefaultNodeShape( NodeShape.RECTANGLE );
+ }
+ else {
+ ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + shape_str
+ + "] for [default_node_shape]" );
+ }
+ }
+ else if ( key.equals( "taxonomy_colorize_node_shapes" ) ) {
+ setTaxonomyColorizeNodeShapesInsteadOfLabels( parseBoolean( ( String ) st.nextElement() ) );
+ }
else if ( st.countTokens() >= 2 ) { // counts the tokens that are not
// yet retrieved!
int key_index = -1;
public boolean isAbbreviateScientificTaxonNames() {
return _abbreviate_scientific_names;
}
+
+ public NodeShape getDefaultNodeShape() {
+ return _default_node_shape;
+ }
+
+ private void setDefaultNodeShape( final NodeShape default_node_shape ) {
+ _default_node_shape = default_node_shape;
+ }
+
+ private void setDefaultNodeFill( final NodeFill default_node_fill ) {
+ _default_node_fill = default_node_fill;
+ }
+
+ public NodeFill getDefaultNodeFill() {
+ return _default_node_fill;
+ }
+
+ private void setDefaultNodeShapeSize( final short default_node_shape_size ) {
+ _default_node_shape_size = default_node_shape_size;
+ }
+
+ public short getDefaultNodeShapeSize() {
+ return _default_node_shape_size;
+ }
+
+ private void setTaxonomyColorizeNodeShapesInsteadOfLabels( final boolean taxonomy_colorize_node_shapes_instead_of_labels ) {
+ _taxonomy_colorize_node_shapes_instead_of_labels = taxonomy_colorize_node_shapes_instead_of_labels;
+ }
+
+ public boolean isTaxonomyColorizeNodeShapesInsteadOfLabels() {
+ return _taxonomy_colorize_node_shapes_instead_of_labels;
+ }
}
144,
144 );
final static String NCBI_ALL_DATABASE_SEARCH = "http://www.ncbi.nlm.nih.gov/gquery/?term=";
+ final static short DEFAULT_NODE_SHAPE_SIZE_DEFAULT = 6;
}
private boolean _color_labels_same_as_parent_branch;
private boolean _abbreviate_scientific_names;
private NodeShape _default_node_shape;
+ private NodeFill _default_node_fill;
private short _default_node_shape_size;
private boolean _taxonomy_colorize_node_shapes_instead_of_labels;
- enum NodeShape {
- NONE,
- CIRCLE_WITH_GRADIENT,
- CIRCLE_SOLID,
- CIRCLE_HOLLOW,
- RECTANGLE_WITH_GRADIENT,
- RECTANGLE_SOLID,
- RECTANGLE_HOLLOW;
- }
-
private Options() {
init();
}
return _cladogram_type;
}
+ int getDefaultNodeBoxSize() {
+ // TODO make variable ~~
+ return 8;
+ }
+
+ final NodeFill getDefaultNodeFill() {
+ return _default_node_fill;
+ }
+
+ final NodeShape getDefaultNodeShape() {
+ return _default_node_shape;
+ }
+
+ final short getDefaultNodeShapeSize() {
+ return _default_node_shape_size;
+ }
+
final double getMinConfidenceValue() {
return _min_confidence_value;
}
}
final private void init() {
- _default_node_shape = NodeShape.RECTANGLE_WITH_GRADIENT;
+ _default_node_shape = NodeShape.NONE;
+ _default_node_fill = NodeFill.GRADIENT;
+ _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
+ _taxonomy_colorize_node_shapes_instead_of_labels = false;
_show_branch_length_values = false;
_internal_number_are_confidence_for_nh_parsing = false;
_show_scale = false;
_color_labels_same_as_parent_branch = false;
}
+ final boolean isAbbreviateScientificTaxonNames() {
+ return _abbreviate_scientific_names;
+ }
+
+ boolean isAllowMagnificationOfTaxonomyImages() {
+ return true;
+ }
+
final boolean isAntialiasPrint() {
return _antialias_print;
}
return _background_color_gradient;
}
- public final boolean isShowDomainLabels() {
- return _show_domain_labels;
- }
-
final boolean isColorLabelsSameAsParentBranch() {
return _color_labels_same_as_parent_branch;
}
return _show_branch_length_values;
}
- final NodeShape getDefaultNodeShape() {
- return _default_node_shape;
+ public final boolean isShowDomainLabels() {
+ return _show_domain_labels;
}
final boolean isShowOverview() {
return _show_scale;
}
+ boolean isTaxonomyColorizeNodeShapesInsteadOfLabels() {
+ return _taxonomy_colorize_node_shapes_instead_of_labels;
+ }
+
+ final void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) {
+ _abbreviate_scientific_names = abbreviate_scientific_names;
+ }
+
final void setAntialiasPrint( final boolean antialias_print ) {
_antialias_print = antialias_print;
}
_background_color_gradient = background_color_gradient;
}
- public void setShowDomainLabels( final boolean show_domain_labels ) {
- _show_domain_labels = show_domain_labels;
+ final void setBaseFont( final Font base_font ) {
+ _base_font = base_font;
+ }
+
+ final void setCladogramType( final CLADOGRAM_TYPE cladogram_type ) {
+ _cladogram_type = cladogram_type;
}
public void setColorLabelsSameAsParentBranch( final boolean color_labels_same_as_parent_branch ) {
_color_labels_same_as_parent_branch = color_labels_same_as_parent_branch;
}
- final void setBaseFont( final Font base_font ) {
- _base_font = base_font;
+ final void setDefaultNodeFill( final NodeFill default_node_fill ) {
+ _default_node_fill = default_node_fill;
}
- final void setCladogramType( final CLADOGRAM_TYPE cladogram_type ) {
- _cladogram_type = cladogram_type;
+ final void setDefaultNodeShape( final NodeShape default_node_shape ) {
+ _default_node_shape = default_node_shape;
+ }
+
+ final void setDefaultNodeShapeSize( final short default_node_shape_size ) {
+ _default_node_shape_size = default_node_shape_size;
}
final void setEditable( final boolean editable ) {
_show_branch_length_values = show_branch_length_values;
}
- final void setDefaultNodeShape( final NodeShape default_node_shape ) {
- _default_node_shape = default_node_shape;
+ public void setShowDomainLabels( final boolean show_domain_labels ) {
+ _show_domain_labels = show_domain_labels;
}
final void setShowOverview( final boolean show_overview ) {
_show_scale = show_scale;
}
+ void setTaxonomyColorizeNodeShapesInsteadOfLabels( final boolean taxonomy_colorize_node_shapes_instead_of_labels ) {
+ _taxonomy_colorize_node_shapes_instead_of_labels = taxonomy_colorize_node_shapes_instead_of_labels;
+ }
+
final static Options createDefaultInstance() {
return new Options();
}
if ( configuration.getPhylogenyGraphicsType() != null ) {
instance.setPhylogenyGraphicsType( configuration.getPhylogenyGraphicsType() );
}
+ if ( configuration.getDefaultNodeFill() != null ) {
+ instance.setDefaultNodeFill( configuration.getDefaultNodeFill() );
+ }
+ if ( configuration.getDefaultNodeShape() != null ) {
+ instance.setDefaultNodeShape( configuration.getDefaultNodeShape() );
+ }
+ if ( configuration.getDefaultNodeShapeSize() >= 0 ) {
+ instance.setDefaultNodeShapeSize( configuration.getDefaultNodeShapeSize() );
+ }
+ instance.setTaxonomyColorizeNodeShapesInsteadOfLabels( configuration
+ .isTaxonomyColorizeNodeShapesInsteadOfLabels() );
}
return instance;
}
- final void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) {
- _abbreviate_scientific_names = abbreviate_scientific_names;
- }
-
- final boolean isAbbreviateScientificTaxonNames() {
- return _abbreviate_scientific_names;
- }
-
static enum CLADOGRAM_TYPE {
NON_LINED_UP, EXT_NODE_SUM_DEP, TOTAL_NODE_SUM_DEP;
}
HORIZONTAL, RADIAL;
}
+ enum NodeFill {
+ NONE, GRADIENT, SOLID
+ }
+
+ enum NodeShape {
+ NONE, CIRCLE, RECTANGLE
+ }
+
static enum OVERVIEW_PLACEMENT_TYPE {
UPPER_LEFT( "upper left" ),
UPPER_RIGHT( "upper right" ),
static enum PHYLOGENY_GRAPHICS_TYPE {
RECTANGULAR, TRIANGULAR, EURO_STYLE, ROUNDED, CONVEX, CURVED, UNROOTED, CIRCULAR;
}
-
- boolean isAllowMagnificationOfTaxonomyImages() {
- return true;
- }
-
- int getDefaultNodeBoxSize() {
- // TODO make variable ~~
- return 8;
- }
}
import org.forester.archaeopteryx.ControlPanel.NodeClickAction;
import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
+import org.forester.archaeopteryx.Options.NodeFill;
+import org.forester.archaeopteryx.Options.NodeShape;
import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
import org.forester.archaeopteryx.phylogeny.data.RenderableDomainArchitecture;
import org.forester.archaeopteryx.phylogeny.data.RenderableVector;
else {
//TODO FIXME
//drawRectFilled( x - HALF_BOX_SIZE, y - HALF_BOX_SIZE, BOX_SIZE, BOX_SIZE, g );
- drawOvalGradient( x - _half_box_size,
- y - _half_box_size,
- _box_size,
- _box_size,
- g,
- Color.BLACK,
- g.getColor(),
- g.getColor() );
+ if ( getOptions().getDefaultNodeShape() == NodeShape.CIRCLE ) {
+ if ( getOptions().getDefaultNodeFill() == NodeFill.GRADIENT ) {
+ drawOvalGradient( x - _half_box_size,
+ y - _half_box_size,
+ _box_size,
+ _box_size,
+ g,
+ Color.BLACK,
+ g.getColor(),
+ g.getColor() );
+ }
+ else if ( getOptions().getDefaultNodeFill() == NodeFill.SOLID ) {
+ drawOvalFilled( x - _half_box_size, y - _half_box_size, _box_size, _box_size, g );
+ }
+ }
+ else if ( getOptions().getDefaultNodeShape() == NodeShape.RECTANGLE ) {
+ if ( getOptions().getDefaultNodeFill() == NodeFill.GRADIENT ) {
+ drawRectGradient( x - _half_box_size,
+ y - _half_box_size,
+ _box_size,
+ _box_size,
+ g,
+ Color.BLACK,
+ g.getColor(),
+ g.getColor() );
+ }
+ else if ( getOptions().getDefaultNodeFill() == NodeFill.SOLID ) {
+ drawRectFilled( x - _half_box_size, y - _half_box_size, _box_size, _box_size, g );
+ }
+ }
}
}
}