import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
import org.forester.util.ForesterConstants;
-public final class Constants {
+public final class AptxConstants {
final static boolean __ALLOW_PHYLOGENETIC_INFERENCE = true;
public final static boolean __RELEASE = false; // TODO remove me
public final static boolean __SYNTH_LF = false; // TODO remove me
public final static String PRG_NAME = "Archaeopteryx";
final static String VERSION = "0.9909 experimental";
- final static String PRG_DATE = "150513";
+ final static String PRG_DATE = "160622";
final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file";
final static String[] DEFAULT_FONT_CHOICES = { "Arial", "Helvetica",
"Verdana", "Tahoma", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" };
final static String AUTHOR_EMAIL = "phyloxml@gmail.com";
final static int DOMAIN_STRUCTURE_E_VALUE_THR_DEFAULT_EXP = -3;
final static float BUTTON_ZOOM_IN_FACTOR = 1.25f;
- final static float BUTTON_ZOOM_OUT_FACTOR = 1 / Constants.BUTTON_ZOOM_IN_FACTOR;
+ final static float BUTTON_ZOOM_OUT_FACTOR = 1 / AptxConstants.BUTTON_ZOOM_IN_FACTOR;
final static float BUTTON_ZOOM_IN_X_CORRECTION_FACTOR = 1.2f;
- final static float BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR = 1 / Constants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR;
+ final static float BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR = 1 / AptxConstants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR;
final static float WHEEL_ZOOM_IN_FACTOR = 1.08f;
- final static float WHEEL_ZOOM_OUT_FACTOR = 1 / Constants.WHEEL_ZOOM_IN_FACTOR;
+ final static float WHEEL_ZOOM_OUT_FACTOR = 1 / AptxConstants.WHEEL_ZOOM_IN_FACTOR;
final static float WHEEL_ZOOM_IN_X_CORRECTION_FACTOR = 1.085f;
- final static float WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR = 1 / Constants.WHEEL_ZOOM_IN_X_CORRECTION_FACTOR;
+ final static float WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR = 1 / AptxConstants.WHEEL_ZOOM_IN_X_CORRECTION_FACTOR;
static final boolean SPECIAL_CUSTOM = false; //TODO remove me
static final double EXT_NODE_INFO_LENGTH_MAX_RATIO = 0.95;
static final Dimension NODE_PANEL_SPLIT_MINIMUM_SIZE = new Dimension( 100, 50 );
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URL;
-import java.net.URLConnection;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.util.Arrays;
import java.util.HashSet;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.Confidence;
import org.forester.phylogeny.data.Taxonomy;
-import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
-import org.forester.phylogeny.factories.PhylogenyFactory;
import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
import org.forester.util.AsciiHistogram;
import org.forester.util.DescriptiveStatistics;
final TAXONOMY_EXTRACTION taxonomy_extraction,
final boolean midpoint_reroot )
throws FileNotFoundException, IOException {
- final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
final PhylogenyParser parser;
boolean nhx_or_nexus = false;
if ( url.getHost().toLowerCase().indexOf( "tolweb" ) >= 0 ) {
}
}
AptxUtil.printAppletMessage( "Archaeopteryx", "parser is " + parser.getName() );
- final URLConnection url_connection = url.openConnection();
- url_connection.setDefaultUseCaches( false );
- final InputStream i = url_connection.getInputStream();
- final Phylogeny[] phys = factory.create( i, parser );
- i.close();
+ Phylogeny[] phys = null;
+ try {
+ phys = ForesterUtil.readPhylogeniesFromUrl( url, parser );
+ }
+ catch ( final KeyManagementException e ) {
+ throw new IOException( e.getMessage() );
+ }
+ catch ( final NoSuchAlgorithmException e ) {
+ throw new IOException( e.getMessage() );
+ }
if ( phys != null ) {
if ( nhx_or_nexus && internal_numbers_are_confidences ) {
for( final Phylogeny phy : phys ) {
}
final public static void showErrorMessage( final Component parent, final String error_msg ) {
- printAppletMessage( Constants.PRG_NAME, error_msg );
- JOptionPane.showMessageDialog( parent, error_msg, "[" + Constants.PRG_NAME + " " + Constants.VERSION
+ printAppletMessage( AptxConstants.PRG_NAME, error_msg );
+ JOptionPane.showMessageDialog( parent, error_msg, "[" + AptxConstants.PRG_NAME + " " + AptxConstants.VERSION
+ "] Error", JOptionPane.ERROR_MESSAGE );
}
final String full_path,
final Configuration configuration,
final MainPanel main_panel ) {
- if ( phys.length > Constants.MAX_TREES_TO_LOAD ) {
+ if ( phys.length > AptxConstants.MAX_TREES_TO_LOAD ) {
JOptionPane.showMessageDialog( main_panel, "Attempt to load " + phys.length
- + " phylogenies,\ngoing to load only the first " + Constants.MAX_TREES_TO_LOAD, Constants.PRG_NAME
- + " more than " + Constants.MAX_TREES_TO_LOAD + " phylogenies", JOptionPane.WARNING_MESSAGE );
+ + " phylogenies,\ngoing to load only the first " + AptxConstants.MAX_TREES_TO_LOAD, AptxConstants.PRG_NAME
+ + " more than " + AptxConstants.MAX_TREES_TO_LOAD + " phylogenies", JOptionPane.WARNING_MESSAGE );
}
int i = 1;
for( final Phylogeny phy : phys ) {
if ( !phy.isEmpty() ) {
- if ( i <= Constants.MAX_TREES_TO_LOAD ) {
+ if ( i <= AptxConstants.MAX_TREES_TO_LOAD ) {
String my_name = "";
String my_name_for_file = "";
if ( phys.length > 1 ) {
css = PhylogenyMethods.calculateConfidenceStatistics( phy );
}
catch ( final IllegalArgumentException e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, e.getMessage() );
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, e.getMessage() );
}
if ( ( css != null ) && ( css.size() > 0 ) ) {
desc.append( "\n" );
*/
final static void dieWithSystemError( final String message ) {
System.out.println();
- System.out.println( Constants.PRG_NAME + " encountered the following system error: " + message );
+ System.out.println( AptxConstants.PRG_NAME + " encountered the following system error: " + message );
System.out.println( "Please contact the authors." );
- System.out.println( Constants.PRG_NAME + " needs to close." );
+ System.out.println( AptxConstants.PRG_NAME + " needs to close." );
System.out.println();
System.exit( -1 );
}
final static void openWebsite( final String url, final boolean is_applet, final JApplet applet ) throws IOException {
try {
- AptxUtil.launchWebBrowser( new URI( url ), is_applet, applet, Constants.PRG_NAME );
+ AptxUtil.launchWebBrowser( new URI( url ), is_applet, applet, AptxConstants.PRG_NAME );
}
catch ( final Exception e ) {
throw new IOException( e );
JOptionPane.showMessageDialog( null,
"Java memory allocation might be too small, try \"-Xmx2048m\" java command line option"
+ "\n\nError: " + e.getLocalizedMessage(),
- "Out of Memory Error [" + Constants.PRG_NAME + " " + Constants.VERSION + "]",
+ "Out of Memory Error [" + AptxConstants.PRG_NAME + " " + AptxConstants.VERSION + "]",
JOptionPane.ERROR_MESSAGE );
System.exit( -1 );
}
JOptionPane
.showMessageDialog( null,
"An unexpected (possibly severe) error has occured - terminating. \nPlease contact: "
- + Constants.AUTHOR_EMAIL + " \nError: " + e.getLocalizedMessage() + "\n"
+ + AptxConstants.AUTHOR_EMAIL + " \nError: " + e.getLocalizedMessage() + "\n"
+ sb,
- "Unexpected Severe Error [" + Constants.PRG_NAME + " " + Constants.VERSION + "]",
+ "Unexpected Severe Error [" + AptxConstants.PRG_NAME + " " + AptxConstants.VERSION + "]",
JOptionPane.ERROR_MESSAGE );
System.exit( -1 );
}
}
JOptionPane.showMessageDialog( null,
"An unexpected exception has occured. \nPlease contact: "
- + Constants.AUTHOR_EMAIL + " \nException: " + e.getLocalizedMessage()
+ + AptxConstants.AUTHOR_EMAIL + " \nException: " + e.getLocalizedMessage()
+ "\n" + sb,
- "Unexpected Exception [" + Constants.PRG_NAME + Constants.VERSION + "]",
+ "Unexpected Exception [" + AptxConstants.PRG_NAME + AptxConstants.VERSION + "]",
JOptionPane.ERROR_MESSAGE );
}
f = new File( args[ filename_index ] );
final String err = ForesterUtil.isReadableFile( f );
if ( !ForesterUtil.isEmpty( err ) ) {
- ForesterUtil.fatalError( Constants.PRG_NAME, err );
+ ForesterUtil.fatalError( AptxConstants.PRG_NAME, err );
}
boolean nhx_or_nexus = false;
final PhylogenyParser p = ParserUtils.createParserDependingOnFileType( f, conf
}
}
catch ( final Exception e ) {
- ForesterUtil.fatalError( Constants.PRG_NAME, "failed to start: " + e.getLocalizedMessage() );
+ ForesterUtil.fatalError( AptxConstants.PRG_NAME, "failed to start: " + e.getLocalizedMessage() );
}
String title = "";
if ( f != null ) {
public void init() {
boolean has_exception = false;
setName( NAME );
- setTreeUrlStr( getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD ) );
- setSpeciesTreeUrlStr( getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_SPECIES_TREE_TO_LOAD ) );
+ setTreeUrlStr( getParameter( AptxConstants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD ) );
+ setSpeciesTreeUrlStr( getParameter( AptxConstants.APPLET_PARAM_NAME_FOR_URL_OF_SPECIES_TREE_TO_LOAD ) );
if ( !ForesterUtil.isEmpty( getTreeUrlStr() ) ) {
AptxUtil.printAppletMessage( NAME, "URL of tree(s) to load: " + getTreeUrlStr() );
}
setMessage2( "[Your Java version: " + s + "]" );
repaint();
}
- final String config_filename = getParameter( Constants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
+ final String config_filename = getParameter( AptxConstants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
AptxUtil.printAppletMessage( NAME, "URL for configuration file is: " + config_filename );
final Configuration configuration = new Configuration( config_filename, true, true, true );
try {
getMainFrameApplet().requestFocusInWindow();
getMainFrameApplet().requestFocus();
/* GUILHEM_BEG */
- final String default_relation = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_SEQUENCE_RELATION_TYPE );
+ final String default_relation = getParameter( AptxConstants.APPLET_PARAM_NAME_FOR_DEFAULT_SEQUENCE_RELATION_TYPE );
if ( default_relation != null ) {
getMainFrameApplet().getMainPanel().getControlPanel().getSequenceRelationTypeBox()
.setSelectedItem( default_relation );
}
- final String default_sequence = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_QUERY_SEQUENCE );
+ final String default_sequence = getParameter( AptxConstants.APPLET_PARAM_NAME_FOR_DEFAULT_QUERY_SEQUENCE );
if ( default_sequence != null ) {
getMainFrameApplet().getMainPanel().getControlPanel().getSequenceRelationBox()
.setSelectedItem( default_sequence );
}
else if ( o == _help_item ) {
try {
- AptxUtil.openWebsite( Constants.APTX_DOC_SITE, true, this );
+ AptxUtil.openWebsite( AptxConstants.APTX_DOC_SITE, true, this );
}
catch ( final IOException e1 ) {
- ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
}
}
else if ( o == _website_item ) {
try {
- AptxUtil.openWebsite( Constants.APTX_WEB_SITE, true, this );
+ AptxUtil.openWebsite( AptxConstants.APTX_WEB_SITE, true, this );
}
catch ( final IOException e1 ) {
- ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
}
}
else if ( o == _phyloxml_website_item ) {
try {
- AptxUtil.openWebsite( Constants.PHYLOXML_WEB_SITE, true, this );
+ AptxUtil.openWebsite( AptxConstants.PHYLOXML_WEB_SITE, true, this );
}
catch ( final IOException e1 ) {
- ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
}
}
else if ( o == _aptx_ref_item ) {
try {
- AptxUtil.openWebsite( Constants.APTX_REFERENCE_URL, true, this );
+ AptxUtil.openWebsite( AptxConstants.APTX_REFERENCE_URL, true, this );
}
catch ( final IOException e1 ) {
- ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
}
}
else if ( o == _phyloxml_ref_item ) {
try {
- AptxUtil.openWebsite( Constants.PHYLOXML_REFERENCE_URL, true, this );
+ AptxUtil.openWebsite( AptxConstants.PHYLOXML_REFERENCE_URL, true, this );
}
catch ( final IOException e1 ) {
- ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );
}
}
else if ( o == _color_by_taxonomic_group_cbmi ) {
e.printStackTrace();
// Do nothing. Not important.
}
- final String config_filename = getParameter( Constants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
+ final String config_filename = getParameter( AptxConstants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
AptxUtil.printAppletMessage( NAME, "URL for configuration file is: " + config_filename );
final Configuration configuration = new Configuration( config_filename, true, true, true );
setConfiguration( configuration );
setOptions( Options.createInstance( configuration ) );
setupUI();
- final String tree_url_str = getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
+ final String tree_url_str = getParameter( AptxConstants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
if ( ForesterUtil.isEmpty( tree_url_str ) ) {
ForesterUtil.printErrorMessage( NAME, "could not get tree URL from "
- + Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
+ + AptxConstants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
JOptionPane.showMessageDialog( this, NAME + ": could not get tree URL from "
- + Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD, "Failed get URL", JOptionPane.ERROR_MESSAGE );
+ + AptxConstants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD, "Failed get URL", JOptionPane.ERROR_MESSAGE );
return;
}
AptxUtil.printAppletMessage( NAME, "URL for phylogenies is " + tree_url_str );
}
if ( phys_url == null ) {
ForesterUtil.printErrorMessage( NAME, "failed to get tree URL from "
- + Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
+ + AptxConstants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
JOptionPane.showMessageDialog( this,
NAME + ": Could not create URL from: \"" + tree_url_str,
"Failed to create URL",
AptxUtil.printAppletMessage( NAME, "loaded " + phys.length + " phylogenies from: " + phys_url );
}
//
- final String species_tree_url_str = getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_SPECIES_TREE_TO_LOAD );
+ final String species_tree_url_str = getParameter( AptxConstants.APPLET_PARAM_NAME_FOR_URL_OF_SPECIES_TREE_TO_LOAD );
if ( !ForesterUtil.isEmpty( species_tree_url_str ) ) {
AptxUtil.printAppletMessage( NAME, "URL of species tree to load: \"" + species_tree_url_str + "\"" );
Phylogeny[] species_trees = null;
.getRelevantSequenceRelationTypes() ) {
getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().addItem( type );
}
- final String default_relation = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_SEQUENCE_RELATION_TYPE );
+ final String default_relation = getParameter( AptxConstants.APPLET_PARAM_NAME_FOR_DEFAULT_SEQUENCE_RELATION_TYPE );
if ( default_relation != null ) {
getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().setSelectedItem( default_relation );
}
- final String default_sequence = getParameter( Constants.APPLET_PARAM_NAME_FOR_DEFAULT_QUERY_SEQUENCE );
+ final String default_sequence = getParameter( AptxConstants.APPLET_PARAM_NAME_FOR_DEFAULT_QUERY_SEQUENCE );
if ( default_sequence != null ) {
getCurrentTreePanel().getControlPanel().getSequenceRelationBox().setSelectedItem( default_sequence );
}
+ "[current values: "
+ getOptions().getPrintSizeX() + ", "
+ getOptions().getPrintSizeY() + "]\n"
- + "[A4: " + Constants.A4_SIZE_X + ", "
- + Constants.A4_SIZE_Y + "]\n" + "[US Letter: "
- + Constants.US_LETTER_SIZE_X + ", "
- + Constants.US_LETTER_SIZE_Y + "]",
+ + "[A4: " + AptxConstants.A4_SIZE_X + ", "
+ + AptxConstants.A4_SIZE_Y + "]\n" + "[US Letter: "
+ + AptxConstants.US_LETTER_SIZE_X + ", "
+ + AptxConstants.US_LETTER_SIZE_Y + "]",
"Default Size for Graphics Export",
JOptionPane.QUESTION_MESSAGE,
null,
String config_filename;
// This option is selected in the dropdown
int default_clickto = Configuration.display_node_data;
- String default_config_filename = Constants.DEFAULT_CONFIGURATION_FILE_NAME;
+ String default_config_filename = AptxConstants.DEFAULT_CONFIGURATION_FILE_NAME;
// --------------
// Color set
// --------------
// Fonts
// -------
TreeFontSet tree_font_set;
- boolean verbose = Constants.VERBOSE_DEFAULT;
+ boolean verbose = AptxConstants.VERBOSE_DEFAULT;
private boolean _abbreviate_scientific_names = false;
private boolean _antialias_screen = true;
private boolean _background_color_gradient = false;
private String _base_font_family_name = "";
private int _base_font_size = -1;
- private CLADOGRAM_TYPE _cladogram_type = Constants.CLADOGRAM_TYPE_DEFAULT;
+ private CLADOGRAM_TYPE _cladogram_type = AptxConstants.CLADOGRAM_TYPE_DEFAULT;
private boolean _color_labels_same_as_parent_branch = false;
private int _default_bootstrap_samples = -1;
private NodeFill _default_node_fill = NodeFill.SOLID;
private NodeShape _default_node_shape = NodeShape.RECTANGLE;
- private short _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
+ private short _default_node_shape_size = AptxConstants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
private SortedMap<String, Color> _display_colors = null;
private boolean _display_sequence_relations = false;
private boolean _editable = true;
private int _frame_y_size;
private int _graphics_export_x = -1;
private int _graphics_export_y = -1;
- private Color _gui_background_color = Constants.GUI_BACKGROUND_DEFAULT;
- private Color _gui_button_background_color = Constants.BUTTON_BACKGROUND_COLOR_DEFAULT;
- private Color _gui_button_border_color = Constants.BUTTON_BORDER_COLOR_DEFAULT;
- private Color _gui_button_text_color = Constants.BUTTON_TEXT_COLOR_DEFAULT;
- private Color _gui_checkbox_and_button_active_color = Constants.CHECKBOX_AND_BUTTON_ACTIVE_COLOR_DEFAULT;
- private Color _gui_checkbox_text_color = Constants.CHECKBOX_TEXT_COLOR_DEFAULT;
- private Color _gui_menu_background_color = Constants.MENU_BACKGROUND_COLOR_DEFAULT;
- private Color _gui_menu_text_color = Constants.MENU_TEXT_COLOR_DEFAULT;
+ private Color _gui_background_color = AptxConstants.GUI_BACKGROUND_DEFAULT;
+ private Color _gui_button_background_color = AptxConstants.BUTTON_BACKGROUND_COLOR_DEFAULT;
+ private Color _gui_button_border_color = AptxConstants.BUTTON_BORDER_COLOR_DEFAULT;
+ private Color _gui_button_text_color = AptxConstants.BUTTON_TEXT_COLOR_DEFAULT;
+ private Color _gui_checkbox_and_button_active_color = AptxConstants.CHECKBOX_AND_BUTTON_ACTIVE_COLOR_DEFAULT;
+ private Color _gui_checkbox_text_color = AptxConstants.CHECKBOX_TEXT_COLOR_DEFAULT;
+ private Color _gui_menu_background_color = AptxConstants.MENU_BACKGROUND_COLOR_DEFAULT;
+ private Color _gui_menu_text_color = AptxConstants.MENU_TEXT_COLOR_DEFAULT;
private boolean _hide_controls_and_menus = false;
private boolean _internal_number_are_confidence_for_nh_parsing = false;
private String _label_for_get_ext_descendents_data = "";
private double _min_confidence_value = Options.MIN_CONFIDENCE_DEFAULT;
private boolean _nh_parsing_replace_underscores = false;
private NODE_LABEL_DIRECTION _node_label_direction = NODE_LABEL_DIRECTION.HORIZONTAL;
- private short _number_of_digits_after_comma_for_branch_length_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT;
- private short _number_of_digits_after_comma_for_confidence_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT;
+ private short _number_of_digits_after_comma_for_branch_length_values = AptxConstants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT;
+ private short _number_of_digits_after_comma_for_confidence_values = AptxConstants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT;
private short _ov_max_height = 80;
private short _ov_max_width = 80;
private OVERVIEW_PLACEMENT_TYPE _ov_placement = OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT;
private File _path_to_local_mafft = null;
private File _path_to_local_raxml = null;
private PHYLOGENY_GRAPHICS_TYPE _phylogeny_graphics_type = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
- private float _print_line_width = Constants.PDF_LINE_WIDTH_DEFAULT;
+ private float _print_line_width = AptxConstants.PDF_LINE_WIDTH_DEFAULT;
private boolean _show_annotation_ref_source = true;
private boolean _show_default_node_shapes_external = false;
private boolean _show_default_node_shapes_for_marked_nodes = false;
private TAXONOMY_EXTRACTION _taxonomy_extraction = TAXONOMY_EXTRACTION.NO;
private UI _ui = UI.UNKNOWN;
private boolean _use_tabbed_display = false;
- private boolean _validate_against_phyloxml_xsd_schema = Constants.VALIDATE_AGAINST_PHYLOXML_XSD_SCJEMA_DEFAULT;
+ private boolean _validate_against_phyloxml_xsd_schema = AptxConstants.VALIDATE_AGAINST_PHYLOXML_XSD_SCJEMA_DEFAULT;
private Color _vector_data_min_color = Color.BLUE;
private Color _vector_data_max_color = Color.YELLOW;
private Color _vector_data_mean_color = Color.WHITE;
private boolean _right_align_domains = false;
private boolean _allow_thick_strokes = false;
static {
- for( final String font_name : Constants.DEFAULT_FONT_CHOICES ) {
+ for( final String font_name : AptxConstants.DEFAULT_FONT_CHOICES ) {
if ( Arrays.binarySearch( AptxUtil.getAvailableFontFamiliesSorted(), font_name ) >= 0 ) {
DEFAULT_FONT_FAMILY = font_name;
break;
}
}
if ( ForesterUtil.isEmpty( DEFAULT_FONT_FAMILY ) ) {
- DEFAULT_FONT_FAMILY = Constants.DEFAULT_FONT_CHOICES[ Constants.DEFAULT_FONT_CHOICES.length - 1 ];
+ DEFAULT_FONT_FAMILY = AptxConstants.DEFAULT_FONT_CHOICES[ AptxConstants.DEFAULT_FONT_CHOICES.length - 1 ];
}
}
final BufferedReader bf = new BufferedReader( isr );
readConfig( bf );
bf.close();
- ForesterUtil.programMessage( Constants.PRG_NAME, "successfully read from configuration url ["
+ ForesterUtil.programMessage( AptxConstants.PRG_NAME, "successfully read from configuration url ["
+ config_filename + "]" );
}
catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "failed to read configuration from ["
+ config_filename + "]: " + e.getLocalizedMessage() );
}
}
catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration url ["
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "cannot find or open configuration url ["
+ config_filename + "]" );
}
}
}
catch ( final Exception e ) {
if ( verbose ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "failed to read configuration from ["
+ config_filename + "]: " + e );
}
}
}
else {
if ( verbose ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration file ["
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "cannot find or open configuration file ["
+ config_filename + "]" );
}
}
if ( name.equals( "edit_info" ) ) {
index = Configuration.display_node_data;
ForesterUtil
- .printWarningMessage( Constants.PRG_NAME,
+ .printWarningMessage( AptxConstants.PRG_NAME,
"configuration key [edit_info] is deprecated, use [display node data] instead" );
}
else if ( name.equals( "display_node_data" ) ) {
}
else if ( name.equals( "display_sequences" ) ) {
ForesterUtil
- .printWarningMessage( Constants.PRG_NAME, "configuration key [display_sequences] is deprecated" );
+ .printWarningMessage( AptxConstants.PRG_NAME, "configuration key [display_sequences] is deprecated" );
return DEPRECATED;
}
else if ( name.equals( "open_seq_web" ) ) {
index = Configuration.select_nodes;
}
else if ( name.equals( "display_node_popup" ) ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME,
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME,
"configuration key [display_node_popup] is deprecated" );
return DEPRECATED;
}
else if ( name.equals( "custom_option" ) ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "configuration key [custom_option] is deprecated" );
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "configuration key [custom_option] is deprecated" );
return DEPRECATED;
}
else if ( name.equals( "color_subtree" ) ) {
return false;
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse boolean value from [" + str + "]" );
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse boolean value from [" + str + "]" );
return false;
}
}
d = Double.parseDouble( str.trim() );
}
catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse double from [" + str + "]" );
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse double from [" + str + "]" );
d = 0.0;
}
return d;
f = Float.parseFloat( str.trim() );
}
catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse float from [" + str + "]" );
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse float from [" + str + "]" );
f = 0.0f;
}
return f;
i = Integer.parseInt( str.trim() );
}
catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse integer from [" + str + "]" );
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse integer from [" + str + "]" );
i = -1;
}
return i;
i = Short.parseShort( str.trim() );
}
catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse short from [" + str + "]" );
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse short from [" + str + "]" );
i = -1;
}
return i;
final String clickto_name = ( String ) st.nextElement();
default_clickto = getClickToIndex( clickto_name );
if ( default_clickto == -1 ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "invalid value [" + clickto_name
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "invalid value [" + clickto_name
+ "] for [default_click_to]" );
default_clickto = 0;
}
_ui = UI.UNKNOWN;
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not parse yes/no/? value from [" + my_str
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not parse yes/no/? value from [" + my_str
+ "]" );
_ui = UI.UNKNOWN;
}
}
else {
setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + type_str
+ "] for [phylogeny_graphics_type]" );
}
}
setPrintLineWidth( f );
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME,
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME,
"value for [pdf_export_line_width] cannot be zero or negative" );
}
}
}
else {
ForesterUtil
- .printWarningMessage( Constants.PRG_NAME,
+ .printWarningMessage( AptxConstants.PRG_NAME,
"value for [default_number_of_bootstrap_resamples] cannot be negative" );
}
}
setCladogramType( Options.CLADOGRAM_TYPE.TOTAL_NODE_SUM_DEP );
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + type_str
+ "] for [cladogram_type]" );
}
}
else if ( key.equals( "non_lined_up_cladogram" ) ) {
ForesterUtil
- .printWarningMessage( Constants.PRG_NAME,
+ .printWarningMessage( AptxConstants.PRG_NAME,
"configuration key [non_lined_up_cladogram] is deprecated, use [cladogram_type] instead" );
}
else if ( key.equals( "hide_controls_and_menus" ) ) {
}
else {
setOvPlacement( OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT );
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + type_str
+ "] for [overview_placement_type]" );
}
}
}
else {
setNodeLabelDirection( NODE_LABEL_DIRECTION.HORIZONTAL );
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + type_str
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + type_str
+ "] for [node_label_direction]" );
}
}
setNumberOfDigitsAfterCommaForBranchLengthValue( i );
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + i
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "illegal value [" + i
+ "] for [branch_length_value_digits]" );
}
}
setNumberOfDigitsAfterCommaForConfidenceValues( i );
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "illegal value [" + i
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "illegal value [" + i
+ "] for [confidence_value_digits]" );
}
}
final boolean r = parseBoolean( ( String ) st.nextElement() );
if ( r && ( getTaxonomyExtraction() != TAXONOMY_EXTRACTION.NO ) ) {
ForesterUtil
- .printWarningMessage( Constants.PRG_NAME,
+ .printWarningMessage( AptxConstants.PRG_NAME,
"attempt to extract taxonomies and replace underscores at the same time" );
}
else {
}
else {
ForesterUtil
- .printWarningMessage( Constants.PRG_NAME,
+ .printWarningMessage( AptxConstants.PRG_NAME,
"unknown value for \"taxonomy_extraction_in_nh_parsing\": "
+ s
+ " (must be either: no, pfam_relaxed, pfam_strict, or aggressive)" );
}
if ( ( getTaxonomyExtraction() != TAXONOMY_EXTRACTION.NO ) && isReplaceUnderscoresInNhParsing() ) {
ForesterUtil
- .printWarningMessage( Constants.PRG_NAME,
+ .printWarningMessage( AptxConstants.PRG_NAME,
"attempt to extract taxonomies and replace underscores at the same time" );
}
}
setDefaultNodeFill( NodeFill.SOLID );
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + fill_str
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + fill_str
+ "] for [default_node_fill]" );
}
}
setDefaultNodeShape( NodeShape.RECTANGLE );
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + shape_str
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + shape_str
+ "] for [default_node_shape]" );
}
}
setExtDescNodeDataToReturn( NodeDataField.GO_TERM_IDS );
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + s
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + s
+ "] for [ext_descendents_data_to_return]" );
}
}
setExtNodeDataReturnOn( EXT_NODE_DATA_RETURN_ON.BUFFER_ONLY );
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown value [" + s
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown value [" + s
+ "] for [ext_descendents_data_to_return_on]" );
}
}
else if ( key.equals( "color_branches" ) ) {
key_index = Configuration.use_style;
ForesterUtil
- .printWarningMessage( Constants.PRG_NAME,
+ .printWarningMessage( AptxConstants.PRG_NAME,
"configuration key [color_branches] is deprecated, use [use_visual_styles] instead" );
}
else if ( key.equals( "width_branches" ) ) {
// Deprecated.
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown click-to option: "
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown click-to option: "
+ click_to_name );
}
}
.put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
}
else if ( key.equals( "function_color" ) ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME,
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME,
"configuration key [function_color] is deprecated" );
}
else if ( key.equals( DISPLAY_COLOR_KEY ) ) {
putDisplayColors( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown configuration key [" + key
+ "] in: " + config_filename );
}
}
}
else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key + "] in: "
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "unknown configuration key [" + key + "] in: "
+ config_filename );
}
}
}
// Zoom buttons
else if ( e.getSource() == _zoom_in_x ) {
- zoomInX( Constants.BUTTON_ZOOM_IN_FACTOR, Constants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
+ zoomInX( AptxConstants.BUTTON_ZOOM_IN_FACTOR, AptxConstants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
displayedPhylogenyMightHaveChanged( false );
}
else if ( e.getSource() == _zoom_in_y ) {
- zoomInY( Constants.BUTTON_ZOOM_IN_FACTOR );
+ zoomInY( AptxConstants.BUTTON_ZOOM_IN_FACTOR );
displayedPhylogenyMightHaveChanged( false );
}
else if ( e.getSource() == _zoom_out_x ) {
- zoomOutX( Constants.BUTTON_ZOOM_OUT_FACTOR, Constants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
+ zoomOutX( AptxConstants.BUTTON_ZOOM_OUT_FACTOR, AptxConstants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
displayedPhylogenyMightHaveChanged( false );
}
else if ( e.getSource() == _zoom_out_y ) {
- zoomOutY( Constants.BUTTON_ZOOM_OUT_FACTOR );
+ zoomOutY( AptxConstants.BUTTON_ZOOM_OUT_FACTOR );
displayedPhylogenyMightHaveChanged( false );
}
else if ( e.getSource() == _show_whole ) {
final static SequencesFileFilter seqsfilter = new SequencesFileFilter();\r
final static DefaultFilter defaultfilter = new DefaultFilter();\r
static final String USE_MOUSEWHEEL_SHIFT_TO_ROTATE = "In this display type, use mousewheel + Shift to rotate [or A and S]";\r
- static final String PHYLOXML_REF_TOOL_TIP = Constants.PHYLOXML_REFERENCE; //TODO //FIXME\r
- static final String APTX_REF_TOOL_TIP = Constants.APTX_REFERENCE;\r
+ static final String PHYLOXML_REF_TOOL_TIP = AptxConstants.PHYLOXML_REFERENCE; //TODO //FIXME\r
+ static final String APTX_REF_TOOL_TIP = AptxConstants.APTX_REFERENCE;\r
private static final long serialVersionUID = 3655000897845508358L;\r
final static Font menu_font = new Font( Configuration.getDefaultFontFamilyName(),\r
Font.PLAIN,\r
}\r
else if ( o == _help_item ) {\r
try {\r
- AptxUtil.openWebsite( Constants.APTX_DOC_SITE, is_applet, applet );\r
+ AptxUtil.openWebsite( AptxConstants.APTX_DOC_SITE, is_applet, applet );\r
}\r
catch ( final IOException e1 ) {\r
- ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );\r
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );\r
}\r
}\r
else if ( o == _website_item ) {\r
try {\r
- AptxUtil.openWebsite( Constants.APTX_WEB_SITE, is_applet, applet );\r
+ AptxUtil.openWebsite( AptxConstants.APTX_WEB_SITE, is_applet, applet );\r
}\r
catch ( final IOException e1 ) {\r
- ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );\r
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );\r
}\r
}\r
else if ( o == _phyloxml_website_item ) {\r
try {\r
- AptxUtil.openWebsite( Constants.PHYLOXML_WEB_SITE, is_applet, applet );\r
+ AptxUtil.openWebsite( AptxConstants.PHYLOXML_WEB_SITE, is_applet, applet );\r
}\r
catch ( final IOException e1 ) {\r
- ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );\r
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );\r
}\r
}\r
else if ( o == _aptx_ref_item ) {\r
try {\r
- AptxUtil.openWebsite( Constants.APTX_REFERENCE_URL, is_applet, applet );\r
+ AptxUtil.openWebsite( AptxConstants.APTX_REFERENCE_URL, is_applet, applet );\r
}\r
catch ( final IOException e1 ) {\r
- ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );\r
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );\r
}\r
}\r
else if ( o == _phyloxml_ref_item ) {\r
try {\r
- AptxUtil.openWebsite( Constants.PHYLOXML_REFERENCE_URL, is_applet, applet );\r
+ AptxUtil.openWebsite( AptxConstants.PHYLOXML_REFERENCE_URL, is_applet, applet );\r
}\r
catch ( final IOException e1 ) {\r
- ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );\r
+ ForesterUtil.printErrorMessage( AptxConstants.PRG_NAME, e1.toString() );\r
}\r
}\r
else if ( o == _write_to_pdf_item ) {\r
+ "[current values: "\r
+ getOptions().getPrintSizeX() + ", "\r
+ getOptions().getPrintSizeY() + "]\n"\r
- + "[A4: " + Constants.A4_SIZE_X + ", "\r
- + Constants.A4_SIZE_Y + "]\n" + "[US Letter: "\r
- + Constants.US_LETTER_SIZE_X + ", "\r
- + Constants.US_LETTER_SIZE_Y + "]",\r
+ + "[A4: " + AptxConstants.A4_SIZE_X + ", "\r
+ + AptxConstants.A4_SIZE_Y + "]\n" + "[US Letter: "\r
+ + AptxConstants.US_LETTER_SIZE_X + ", "\r
+ + AptxConstants.US_LETTER_SIZE_Y + "]",\r
"Default Size for Graphics Export",\r
JOptionPane.QUESTION_MESSAGE,\r
null,\r
* Display the about box.\r
*/\r
static void about() {\r
- final StringBuffer about = new StringBuffer( "Archaeopteryx\nVersion " + Constants.VERSION + "\n" );\r
+ final StringBuffer about = new StringBuffer( "Archaeopteryx\nVersion " + AptxConstants.VERSION + "\n" );\r
about.append( "Copyright (C) 2015 Christian M Zmasek\n" );\r
about.append( "All Rights Reserved\n" );\r
about.append( "License: GNU Lesser General Public License (LGPL)\n" );\r
- about.append( "Last modified: " + Constants.PRG_DATE + "\n" );\r
+ about.append( "Last modified: " + AptxConstants.PRG_DATE + "\n" );\r
about.append( "Based on: " + ForesterUtil.getForesterLibraryInformation() + "\n" );\r
about.append( "phyloXML version : " + ForesterConstants.PHYLO_XML_VERSION + "\n" );\r
about.append( "phyloXML location: " + ForesterConstants.PHYLO_XML_LOCATION + "\n" );\r
about.append( "[free memory: " + free_memory + "MB, total memory: " + total_memory + "MB]\n" );\r
about.append( "[locale: " + Locale.getDefault() + "]\n" );\r
about.append( "References:\n" );\r
- about.append( Constants.PHYLOXML_REFERENCE_SHORT + "\n" );\r
+ about.append( AptxConstants.PHYLOXML_REFERENCE_SHORT + "\n" );\r
about.append( "For more information & download:\n" );\r
- about.append( Constants.APTX_WEB_SITE + "\n" );\r
+ about.append( AptxConstants.APTX_WEB_SITE + "\n" );\r
about.append( "Documentation:\n" );\r
- about.append( Constants.APTX_DOC_SITE + "\n" );\r
- about.append( "Comments: " + Constants.AUTHOR_EMAIL );\r
- JOptionPane.showMessageDialog( null, about, Constants.PRG_NAME, JOptionPane.PLAIN_MESSAGE );\r
+ about.append( AptxConstants.APTX_DOC_SITE + "\n" );\r
+ about.append( "Comments: " + AptxConstants.AUTHOR_EMAIL );\r
+ JOptionPane.showMessageDialog( null, about, AptxConstants.PRG_NAME, JOptionPane.PLAIN_MESSAGE );\r
}\r
\r
static void chooseNodeSize( final Options options, final Component parent ) {\r
tp.resetPreferredSize();\r
tp.repaint();\r
}\r
- final String job_name = Constants.PRG_NAME;\r
+ final String job_name = AptxConstants.PRG_NAME;\r
boolean error = false;\r
String printer_name = null;\r
try {\r
return null;\r
}\r
else {\r
- final File to = new File( file.getAbsoluteFile().toString() + Constants.BACKUP_FILE_SUFFIX );\r
+ final File to = new File( file.getAbsoluteFile().toString() + AptxConstants.BACKUP_FILE_SUFFIX );\r
try {\r
ForesterUtil.copyFile( file, to );\r
}\r
private ButtonGroup _radio_group_1;\r
private ButtonGroup _radio_group_2;\r
// Others:\r
- double _min_not_collapse = Constants.MIN_NOT_COLLAPSE_DEFAULT;\r
+ double _min_not_collapse = AptxConstants.MIN_NOT_COLLAPSE_DEFAULT;\r
double _min_not_collapse_bl = 0.001;\r
// Phylogeny Inference menu\r
private JMenu _inference_menu;\r
}\r
try {\r
boolean synth_exception = false;\r
- if ( Constants.__SYNTH_LF ) {\r
+ if ( AptxConstants.__SYNTH_LF ) {\r
try {\r
final SynthLookAndFeel synth = new SynthLookAndFeel();\r
synth.load( MainFrameApplication.class.getResourceAsStream( "/resources/synth_look_and_feel_1.xml" ),\r
}\r
catch ( final Exception ex ) {\r
synth_exception = true;\r
- ForesterUtil.printWarningMessage( Constants.PRG_NAME,\r
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME,\r
"could not create synth look and feel: "\r
+ ex.getLocalizedMessage() );\r
}\r
}\r
- if ( !Constants.__SYNTH_LF || synth_exception ) {\r
+ if ( !AptxConstants.__SYNTH_LF || synth_exception ) {\r
if ( _configuration.isUseNativeUI() ) {\r
UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );\r
}\r
setInferenceManager( InferenceManager.createInstance( _configuration ) );\r
setPhylogeneticInferenceOptions( PhylogeneticInferenceOptions.createInstance( _configuration ) );\r
// set title\r
- setTitle( Constants.PRG_NAME + " " + Constants.VERSION + " (" + Constants.PRG_DATE + ")" );\r
+ setTitle( AptxConstants.PRG_NAME + " " + AptxConstants.VERSION + " (" + AptxConstants.PRG_DATE + ")" );\r
_mainpanel = new MainPanel( _configuration, this );\r
// The file dialogs\r
_open_filechooser = new JFileChooser();\r
_jmenubar.setBackground( getConfiguration().getGuiMenuBackgroundColor() );\r
}\r
buildFileMenu();\r
- if ( Constants.__ALLOW_PHYLOGENETIC_INFERENCE ) {\r
+ if ( AptxConstants.__ALLOW_PHYLOGENETIC_INFERENCE ) {\r
buildPhylogeneticInferenceMenu();\r
}\r
buildAnalysisMenu();\r
if ( sel >= 0 ) {
if ( !getConfiguration().isUseNativeUI() ) {
if ( _tabbed_pane.getTabCount() > 0 ) {
- _tabbed_pane.setForegroundAt( sel, Constants.TAB_LABEL_FOREGROUND_COLOR_SELECTED );
+ _tabbed_pane.setForegroundAt( sel, AptxConstants.TAB_LABEL_FOREGROUND_COLOR_SELECTED );
for( int i = 0; i < _tabbed_pane.getTabCount(); ++i ) {
if ( i != sel ) {
_tabbed_pane.setBackgroundAt( i, getConfiguration().getGuiBackgroundColor() );
final JSplitPane split_pane = new JSplitPane( JSplitPane.VERTICAL_SPLIT );
split_pane.setTopComponent( tree_view );
// split_pane.setBottomComponent( data_view );
- data_view.setMinimumSize( Constants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
- tree_view.setMinimumSize( Constants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
+ data_view.setMinimumSize( AptxConstants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
+ tree_view.setMinimumSize( AptxConstants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
// split_pane.setDividerLocation( 400 );
- split_pane.setPreferredSize( Constants.NODE_PANEL_SIZE );
+ split_pane.setPreferredSize( AptxConstants.NODE_PANEL_SIZE );
add( split_pane );
getJTree().getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
getJTree().addKeyListener( new KeyListener() {
NodeFrame( final PhylogenyNode n, final Phylogeny tree, final TreePanel tp, final int x ) {
super( "Node " + ( ForesterUtil.isEmpty( n.getName() ) ? n.getId() : n.getName() ) );
_reepanel = tp;
- setSize( Constants.NODE_FRAME_SIZE );
+ setSize( AptxConstants.NODE_FRAME_SIZE );
_index = x;
final Container contentPane = getContentPane();
final NodePanel nodepanel = new NodePanel( n );
NodeFrame( final PhylogenyNode n, final Phylogeny tree, final TreePanel tp, final int x, final String dummy ) {
super( "Editable Node " + ( ForesterUtil.isEmpty( n.getName() ) ? n.getId() : n.getName() ) );
_reepanel = tp;
- setSize( Constants.NODE_FRAME_SIZE );
+ setSize( AptxConstants.NODE_FRAME_SIZE );
_index = x;
final Container contentPane = getContentPane();
final NodeEditPanel nodepanel = new NodeEditPanel( n, tp );
final JSplitPane split_pane = new JSplitPane( JSplitPane.VERTICAL_SPLIT );
split_pane.setTopComponent( tree_view );
split_pane.setBottomComponent( data_view );
- data_view.setMinimumSize( Constants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
- tree_view.setMinimumSize( Constants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
+ data_view.setMinimumSize( AptxConstants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
+ tree_view.setMinimumSize( AptxConstants.NODE_PANEL_SPLIT_MINIMUM_SIZE );
split_pane.setDividerLocation( 400 );
- split_pane.setPreferredSize( Constants.NODE_PANEL_SIZE );
+ split_pane.setPreferredSize( AptxConstants.NODE_PANEL_SIZE );
add( split_pane );
}
final private void init() {
_default_node_shape = NodeShape.CIRCLE;
_default_node_fill = NodeFill.GRADIENT;
- _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
+ _default_node_shape_size = AptxConstants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
_internal_number_are_confidence_for_nh_parsing = false;
_show_scale = false;
_antialias_screen = true;
_show_default_node_shapes_external = false;
_show_default_node_shapes_for_marked_nodes = false;
if ( AptxUtil.isUsOrCanada() ) {
- _print_size_x = Constants.US_LETTER_SIZE_X;
- _print_size_y = Constants.US_LETTER_SIZE_Y;
+ _print_size_x = AptxConstants.US_LETTER_SIZE_X;
+ _print_size_y = AptxConstants.US_LETTER_SIZE_Y;
}
else {
- _print_size_x = Constants.A4_SIZE_X;
- _print_size_y = Constants.A4_SIZE_Y;
+ _print_size_x = AptxConstants.A4_SIZE_X;
+ _print_size_y = AptxConstants.A4_SIZE_Y;
}
_min_confidence_value = MIN_CONFIDENCE_DEFAULT;
_print_black_and_white = false;
_match_whole_terms_only = false;
_search_with_regex = false;
_search_case_sensitive = false;
- _print_line_width = Constants.PDF_LINE_WIDTH_DEFAULT;
+ _print_line_width = AptxConstants.PDF_LINE_WIDTH_DEFAULT;
_show_overview = true;
_ov_placement = OVERVIEW_PLACEMENT_TYPE.UPPER_LEFT;
_node_label_direction = NODE_LABEL_DIRECTION.HORIZONTAL;
_inverse_search_result = false;
_scale_bar_length = 0.0;
- _number_of_digits_after_comma_for_branch_length_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT;
- _number_of_digits_after_comma_for_confidence_values = Constants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT;
+ _number_of_digits_after_comma_for_branch_length_values = AptxConstants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_BRANCH_LENGTH_VALUES_DEFAULT;
+ _number_of_digits_after_comma_for_confidence_values = AptxConstants.NUMBER_OF_DIGITS_AFTER_COMMA_FOR_CONFIDENCE_VALUES_DEFAULT;
_nh_parsing_replace_underscores = false;
_taxonomy_extraction = TAXONOMY_EXTRACTION.NO;
- _cladogram_type = Constants.CLADOGRAM_TYPE_DEFAULT;
+ _cladogram_type = AptxConstants.CLADOGRAM_TYPE_DEFAULT;
_show_domain_labels = true;
_show_annotation_ref_source = true;
setAbbreviateScientificTaxonNames( false );
}
Color getBinaryDomainCombinationsColor() {
- if ( Constants.SPECIAL_CUSTOM ) {
+ if ( AptxConstants.SPECIAL_CUSTOM ) {
return new Color( 50, 50, 50 );
}
return binary_domain_combinations_color;
tcs.setColorforDefault( field, color );
}
catch ( final IllegalArgumentException ex ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, ex.getMessage() );
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, ex.getMessage() );
}
}
}
private Set<Long> _current_external_nodes = null;
private StringBuilder _current_external_nodes_data_buffer = new StringBuilder();
private int _current_external_nodes_data_buffer_change_counter = 0;
- private int _domain_structure_e_value_thr_exp = Constants.DOMAIN_STRUCTURE_E_VALUE_THR_DEFAULT_EXP;
- private double _domain_structure_width = Constants.DOMAIN_STRUCTURE_DEFAULT_WIDTH;
+ private int _domain_structure_e_value_thr_exp = AptxConstants.DOMAIN_STRUCTURE_E_VALUE_THR_DEFAULT_EXP;
+ private double _domain_structure_width = AptxConstants.DOMAIN_STRUCTURE_DEFAULT_WIDTH;
private int _dynamic_hiding_factor = 0;
private boolean _edited = false;
private final Ellipse2D _ellipse = new Ellipse2D.Float();
else {
if ( notches < 0 ) {
for( int i = 0; i < ( -notches ); ++i ) {
- getControlPanel().zoomInY( Constants.WHEEL_ZOOM_IN_FACTOR );
+ getControlPanel().zoomInY( AptxConstants.WHEEL_ZOOM_IN_FACTOR );
getControlPanel().displayedPhylogenyMightHaveChanged( false );
}
}
else {
for( int i = 0; i < notches; ++i ) {
- getControlPanel().zoomOutY( Constants.WHEEL_ZOOM_OUT_FACTOR );
+ getControlPanel().zoomOutY( AptxConstants.WHEEL_ZOOM_OUT_FACTOR );
getControlPanel().displayedPhylogenyMightHaveChanged( false );
}
}
else {
if ( notches < 0 ) {
for( int i = 0; i < ( -notches ); ++i ) {
- getControlPanel().zoomInX( Constants.WHEEL_ZOOM_IN_FACTOR,
- Constants.WHEEL_ZOOM_IN_X_CORRECTION_FACTOR );
- getControlPanel().zoomInY( Constants.WHEEL_ZOOM_IN_FACTOR );
+ getControlPanel().zoomInX( AptxConstants.WHEEL_ZOOM_IN_FACTOR,
+ AptxConstants.WHEEL_ZOOM_IN_X_CORRECTION_FACTOR );
+ getControlPanel().zoomInY( AptxConstants.WHEEL_ZOOM_IN_FACTOR );
getControlPanel().displayedPhylogenyMightHaveChanged( false );
}
}
else {
for( int i = 0; i < notches; ++i ) {
- getControlPanel().zoomOutY( Constants.WHEEL_ZOOM_OUT_FACTOR );
- getControlPanel().zoomOutX( Constants.WHEEL_ZOOM_OUT_FACTOR,
- Constants.WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR );
+ getControlPanel().zoomOutY( AptxConstants.WHEEL_ZOOM_OUT_FACTOR );
+ getControlPanel().zoomOutX( AptxConstants.WHEEL_ZOOM_OUT_FACTOR,
+ AptxConstants.WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR );
getControlPanel().displayedPhylogenyMightHaveChanged( false );
}
}
|| ( e.getKeyCode() == KeyEvent.VK_LEFT ) || ( e.getKeyCode() == KeyEvent.VK_RIGHT ) ) {
if ( e.getModifiersEx() == InputEvent.SHIFT_DOWN_MASK ) {
if ( e.getKeyCode() == KeyEvent.VK_UP ) {
- getMainPanel().getControlPanel().zoomInY( Constants.WHEEL_ZOOM_IN_FACTOR );
+ getMainPanel().getControlPanel().zoomInY( AptxConstants.WHEEL_ZOOM_IN_FACTOR );
getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged( false );
}
else if ( e.getKeyCode() == KeyEvent.VK_DOWN ) {
- getMainPanel().getControlPanel().zoomOutY( Constants.WHEEL_ZOOM_OUT_FACTOR );
+ getMainPanel().getControlPanel().zoomOutY( AptxConstants.WHEEL_ZOOM_OUT_FACTOR );
getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged( false );
}
else if ( e.getKeyCode() == KeyEvent.VK_LEFT ) {
- getMainPanel().getControlPanel().zoomOutX( Constants.WHEEL_ZOOM_OUT_FACTOR,
- Constants.WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR );
+ getMainPanel().getControlPanel().zoomOutX( AptxConstants.WHEEL_ZOOM_OUT_FACTOR,
+ AptxConstants.WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR );
getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged( false );
}
else if ( e.getKeyCode() == KeyEvent.VK_RIGHT ) {
- getMainPanel().getControlPanel().zoomInX( Constants.WHEEL_ZOOM_IN_FACTOR,
- Constants.WHEEL_ZOOM_IN_FACTOR );
+ getMainPanel().getControlPanel().zoomInX( AptxConstants.WHEEL_ZOOM_IN_FACTOR,
+ AptxConstants.WHEEL_ZOOM_IN_FACTOR );
getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged( false );
}
}
}
}
else if ( ( e.getKeyCode() == KeyEvent.VK_SUBTRACT ) || ( e.getKeyCode() == KeyEvent.VK_MINUS ) ) {
- getMainPanel().getControlPanel().zoomOutY( Constants.WHEEL_ZOOM_OUT_FACTOR );
- getMainPanel().getControlPanel().zoomOutX( Constants.WHEEL_ZOOM_OUT_FACTOR,
- Constants.WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR );
+ getMainPanel().getControlPanel().zoomOutY( AptxConstants.WHEEL_ZOOM_OUT_FACTOR );
+ getMainPanel().getControlPanel().zoomOutX( AptxConstants.WHEEL_ZOOM_OUT_FACTOR,
+ AptxConstants.WHEEL_ZOOM_OUT_X_CORRECTION_FACTOR );
getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged( false );
}
else if ( plusPressed( e.getKeyCode() ) ) {
- getMainPanel().getControlPanel().zoomInX( Constants.WHEEL_ZOOM_IN_FACTOR,
- Constants.WHEEL_ZOOM_IN_FACTOR );
- getMainPanel().getControlPanel().zoomInY( Constants.WHEEL_ZOOM_IN_FACTOR );
+ getMainPanel().getControlPanel().zoomInX( AptxConstants.WHEEL_ZOOM_IN_FACTOR,
+ AptxConstants.WHEEL_ZOOM_IN_FACTOR );
+ getMainPanel().getControlPanel().zoomInY( AptxConstants.WHEEL_ZOOM_IN_FACTOR );
getMainPanel().getControlPanel().displayedPhylogenyMightHaveChanged( false );
}
else if ( e.getKeyCode() == KeyEvent.VK_S ) {
final float x = node.getXcoord();
g.setFont( getTreeFontSet().getLargeFont() );
g.setColor( getTreeColorSet().getGainedCharactersColor() );
- if ( Constants.SPECIAL_CUSTOM ) {
+ if ( AptxConstants.SPECIAL_CUSTOM ) {
g.setColor( Color.BLUE );
}
TreePanel
return;
}
int max_length = ForesterUtil.roundToInt( ( getSize().getWidth() - MOVE )
- * Constants.EXT_NODE_INFO_LENGTH_MAX_RATIO );
+ * AptxConstants.EXT_NODE_INFO_LENGTH_MAX_RATIO );
if ( max_length < 40 ) {
max_length = 40;
}
import java.net.MalformedURLException;
import java.net.URL;
-import javax.net.ssl.HttpsURLConnection;
import javax.swing.JOptionPane;
import org.forester.archaeopteryx.webservices.PhylogeniesWebserviceClient;
import org.forester.archaeopteryx.webservices.WebserviceUtil;
import org.forester.archaeopteryx.webservices.WebservicesManager;
-import org.forester.archaeopteryx.webservices.WebservicesManager.WsPhylogenyFormat;
import org.forester.io.parsers.PhylogenyParser;
import org.forester.io.parsers.nexus.NexusPhylogeniesParser;
import org.forester.io.parsers.nhx.NHXParser;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyMethods;
import org.forester.phylogeny.data.Identifier;
-import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
-import org.forester.phylogeny.factories.PhylogenyFactory;
import org.forester.util.ForesterUtil;
-import org.forester.util.TrustManager;
public class UrlTreeReader implements Runnable {
else {
_main_frame.getMainPanel().setWaitCursor();
}
- final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
-
- if (client.getReturnFormat()== WebservicesManager.WsPhylogenyFormat.TREEBASE_TREE
- || client.getReturnFormat()== WebservicesManager.WsPhylogenyFormat.TREEBASE_STUDY) {
-
- final HttpsURLConnection con = TrustManager.makeHttpsURLConnection( url );
- trees = factory.create( con.getInputStream(), parser );
- }
- else {
- trees = factory.create( url.openStream(), parser );
- }
+ trees = ForesterUtil.readPhylogeniesFromUrl( url, parser );
}
catch ( final MalformedURLException e ) {
exception = true;
import java.util.SortedMap;
import org.forester.archaeopteryx.AptxUtil;
-import org.forester.archaeopteryx.Constants;
+import org.forester.archaeopteryx.AptxConstants;
import org.forester.archaeopteryx.TreePanel;
import org.forester.phylogeny.data.DomainArchitecture;
import org.forester.phylogeny.data.PhylogenyData;
g.setColor( tree_panel.getTreeColorSet().getDomainBaseColor() );
}
else {
- g.setColor( Constants.DOMAIN_BASE_COLOR_FOR_PDF );
+ g.setColor( AptxConstants.DOMAIN_BASE_COLOR_FOR_PDF );
}
_rectangle.setFrame( start, y - 0.5, _domain_structure.getTotalLength() * f, 1 );
g.fill( _rectangle );
g.setColor( tree_panel.getTreeColorSet().getDomainLabelColor() );
}
else {
- g.setColor( Constants.DOMAIN_LABEL_COLOR_FOR_PDF );
+ g.setColor( AptxConstants.DOMAIN_LABEL_COLOR_FOR_PDF );
}
g.drawString( d.getName(), xa, y1
+ tree_panel.getMainPanel().getTreeFontSet().getFontMetricsSmall().getAscent()
import javax.imageio.ImageIO;
import org.forester.archaeopteryx.AptxUtil;
-import org.forester.archaeopteryx.Constants;
+import org.forester.archaeopteryx.AptxConstants;
import org.forester.archaeopteryx.TreePanel;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.Taxonomy;
bi = ImageIO.read( uri.getValue().toURL() );
}
catch ( final MalformedURLException e ) {
- AptxUtil.printWarningMessage( Constants.PRG_NAME,
+ AptxUtil.printWarningMessage( AptxConstants.PRG_NAME,
"could not load image from \"" + uri.getValue()
+ "\": Malformed URL Exception: "
+ e.getLocalizedMessage() );
}
catch ( final IOException e ) {
- AptxUtil.printWarningMessage( Constants.PRG_NAME,
+ AptxUtil.printWarningMessage( AptxConstants.PRG_NAME,
"could not load image from \"" + uri.getValue()
+ "\": IO Exception: " + e.getLocalizedMessage() );
}
catch ( final CMMException e ) {
- AptxUtil.printWarningMessage( Constants.PRG_NAME,
+ AptxUtil.printWarningMessage( AptxConstants.PRG_NAME,
"could not load image from \"" + uri.getValue()
+ "\": CMMException: " + e.getLocalizedMessage() );
}
package org.forester.archaeopteryx.tools;
-import org.forester.archaeopteryx.Constants;
+import org.forester.archaeopteryx.AptxConstants;
import org.forester.archaeopteryx.MainFrame;
import org.forester.util.ForesterUtil;
public void end( final MainFrame mf ) {
final boolean removed = mf.getProcessPool().removeProcess( getProcessId() );
if ( !removed ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not remove process " + getProcessId()
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "could not remove process " + getProcessId()
+ " from process pool" );
}
mf.updateProcessMenu();
public static final String TREE_FAM_INST = "tree_fam";
public static final String TREE_FAM_NAME = "TreeFam";
public static final String TREE_FAM_URL_BASE = "http://www.treefam.org/family/TF";
- public static final String TREEBASE_PHYLOWS_STUDY_URL_BASE = "http://purl.org/phylo/treebase/phylows/study/TB2:S";
- // public static final String TREEBASE_PHYLOWS_TREE_URL_BASE = "http://purl.org/phylo/treebase/phylows/tree/TB2:Tr";
+ public static final String TREEBASE_PHYLOWS_STUDY_URL_BASE = "https://treebase.org/treebase-web/phylows/study/TB2:S";
public static final String TREEBASE_PHYLOWS_TREE_URL_BASE = "https://treebase.org/treebase-web/phylows/tree/TB2:Tr";
clients.add( new BasicPhylogeniesWebserviceClient( TREE_BASE_NAME,
"Read Tree(s) from TreeBASE Study...",
"Use TreeBASE to obtain evolutionary tree(s) from a study",
- "Please enter a TreeBASE study (\"S\") identifier (without the \"S\")\n(Examples: 14909, 14525, 15613, 15632)",
+ "Please enter a TreeBASE study (\"S\") identifier (without the \"S\")\n(Examples: 13246, 11662, 562, 16424, 17878, 10190, 14909, 14525, 15613, 15632)",
WsPhylogenyFormat.TREEBASE_STUDY,
null,
TREEBASE_PHYLOWS_STUDY_URL_BASE
+ PhylogeniesWebserviceClient.QUERY_PLACEHOLDER
+ "?format=nexus",
true,
- "http://www.treebase.org",
+ "https://treebase.org",
TREE_BASE_INST ) );
clients.add( new BasicPhylogeniesWebserviceClient( TREE_BASE_NAME,
"Read Tree from TreeBASE...",
+ PhylogeniesWebserviceClient.QUERY_PLACEHOLDER
+ "?format=nexus",
true,
- "http://www.treebase.org",
+ "https://treebase.org",
TREE_BASE_INST ) );
clients.add( new BasicPhylogeniesWebserviceClient( PFAM_NAME,
"Read Domain Tree from Pfam...",
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.forester.archaeopteryx.Constants;
+import org.forester.archaeopteryx.AptxConstants;
import org.forester.io.parsers.IteratingPhylogenyParser;
import org.forester.io.parsers.PhylogenyParser;
import org.forester.io.parsers.nhx.NHXFormatException;
public final class NexusPhylogeniesParser implements IteratingPhylogenyParser, PhylogenyParser {
- final private static boolean DEBUG = true;
+ final private static boolean DEBUG = false;
final private static String begin_trees = NexusConstants.BEGIN_TREES.toLowerCase();
final private static String end = NexusConstants.END.toLowerCase();
final private static Pattern TRANSLATE_PATTERN = Pattern.compile( "([0-9A-Za-z]+)\\s+(.+)" );
final private static Pattern ALN_PATTERN = Pattern.compile( "(.+)\\s+([A-Za-z-_\\*\\?]+)" );
final private static Pattern DATATYPE_PATTERN = Pattern.compile( "datatype\\s?.\\s?([a-z]+)" );
- final private static Pattern LINK_TAXA_PATTERN = Pattern.compile( "link\\s+taxa\\s?.\\s?([^;]+)",
- Pattern.CASE_INSENSITIVE );
+ //final private static Pattern LINK_TAXA_PATTERN = Pattern.compile( "link\\s+taxa\\s?.\\s?([^;]+)",
+ // Pattern.CASE_INSENSITIVE );
final private static String utree = NexusConstants.UTREE.toLowerCase();
private BufferedReader _br;
- private boolean _ignore_quotes_in_nh_data = Constants.NH_PARSING_IGNORE_QUOTES_DEFAULT;
+ private boolean _ignore_quotes_in_nh_data = AptxConstants.NH_PARSING_IGNORE_QUOTES_DEFAULT;
private boolean _in_taxalabels;
private boolean _in_translate;
private boolean _in_tree;
}
}
else if ( line_lc.startsWith( "link" ) ) {
- final Matcher link_m = LINK_TAXA_PATTERN.matcher( line );
- if ( link_m.lookingAt() ) {
- final String link = link_m.group( 1 ); //TODO why?
- }
+ //final Matcher link_m = LINK_TAXA_PATTERN.matcher( line );
+ //if ( link_m.lookingAt() ) {
+ //final String link = link_m.group( 1 ); //TODO why?
+ // }
}
else if ( line_lc.startsWith( end ) || line_lc.startsWith( endblock ) ) {
_in_trees_block = false;
_datatype = null;
}
else if ( line_lc.startsWith( "link" ) ) {
- final Matcher link_m = LINK_TAXA_PATTERN.matcher( line );
- if ( link_m.lookingAt() ) {
- final String link = link_m.group( 1 );
- }
+ // final Matcher link_m = LINK_TAXA_PATTERN.matcher( line );
+ // if ( link_m.lookingAt() ) {
+ // final String link = link_m.group( 1 );
+ // }
}
else {
final Matcher datatype_matcher = DATATYPE_PATTERN.matcher( line_lc );
import org.forester.util.ForesterUtil;
import org.forester.util.GeneralTable;
import org.forester.util.SequenceAccessionTools;
-import org.forester.util.TrustManager;
import org.forester.ws.seqdb.SequenceDatabaseEntry;
import org.forester.ws.seqdb.SequenceDbWsTools;
import org.forester.ws.seqdb.UniProtTaxonomy;
}
final long start_time = new Date().getTime();
-
-
- System.out.print( "TreeBase acccess: " );
- if ( Test.testTreeBaseReading() ) {
- System.out.println( "OK." );
- succeeded++;
- }
- else {
- System.out.println( "failed." );
- failed++;
- }
- System.exit( -1 );
-
-
-
-
System.out.print( "Basic node methods: " );
if ( Test.testBasicNodeMethods() ) {
System.out.println( "OK." );
}
}
if ( PERFORM_WEB_TREE_ACCESS ) {
- System.out.print( "NHX parsing from URL: " );
- if ( Test.testNHXparsingFromURL() ) {
+ System.out.print( "TreeBase acccess: " );
+ if ( Test.testTreeBaseReading() ) {
System.out.println( "OK." );
succeeded++;
}
System.out.println( "failed." );
failed++;
}
- System.out.print( "NHX parsing from URL 2: " );
- if ( Test.testNHXparsingFromURL2() ) {
+ System.out.print( "ToL access: " );
+ if ( Test.testToLReading() ) {
System.out.println( "OK." );
succeeded++;
}
System.out.println( "failed." );
failed++;
}
- System.out.print( "phyloXML parsing from URL: " );
- if ( Test.testPhyloXMLparsingFromURL() ) {
+ System.out.print( "NHX parsing from URL: " );
+ if ( Test.testNHXparsingFromURL() ) {
System.out.println( "OK." );
succeeded++;
}
System.out.println( "failed." );
failed++;
}
- System.out.print( "TreeBase acccess: " );
- if ( Test.testTreeBaseReading() ) {
+ System.out.print( "NHX parsing from URL 2: " );
+ if ( Test.testNHXparsingFromURL2() ) {
System.out.println( "OK." );
succeeded++;
}
System.out.println( "failed." );
failed++;
}
- System.out.print( "ToL access: " );
- if ( Test.testToLReading() ) {
+ System.out.print( "phyloXML parsing from URL: " );
+ if ( Test.testPhyloXMLparsingFromURL() ) {
System.out.println( "OK." );
succeeded++;
}
System.out.println( "failed." );
failed++;
}
- //
System.out.print( "TreeFam access: " );
if ( Test.testTreeFamReading() ) {
System.out.println( "OK." );
System.out.println( "failed." );
failed++;
}
- //
- //
System.out.print( "Pfam tree access: " );
if ( Test.testPfamTreeReading() ) {
System.out.println( "OK." );
parser.setTaxonomyExtraction( NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_STRICT );
parser.setReplaceUnderscores( false );
parser.setGuessRootedness( true );
- final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
- final Phylogeny[] phys = factory.create( u.openStream(), parser );
+ final Phylogeny[] phys = ForesterUtil.readPhylogeniesFromUrl( u, parser);
if ( ( phys == null ) || ( phys.length != 1 ) ) {
return false;
}
if ( phys[ 0 ].getNumberOfExternalNodes() < 10 ) {
return false;
}
+ final Phylogeny[] phys2 = ForesterUtil.readPhylogeniesFromUrl( u, parser);
+ if ( ( phys2 == null ) || ( phys2.length != 1 ) ) {
+ return false;
+ }
+ if ( phys2[ 0 ].getNumberOfExternalNodes() != phys[ 0 ].getNumberOfExternalNodes() ) {
+ return false;
+ }
}
catch ( final Exception e ) {
e.printStackTrace();
+ return false;
}
return true;
}
try {
final String s = "https://sites.google.com/site/cmzmasek/home/software/archaeopteryx/examples/archaeopteryx_a/apaf_bcl2.xml";
final URL u = new URL( s );
- final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
- final Phylogeny[] phys = factory.create( u.openStream(), PhyloXmlParser.createPhyloXmlParser() );
+ final Phylogeny[] phys = ForesterUtil.readPhylogeniesFromUrl( u, PhyloXmlParser.createPhyloXmlParser() );
+
if ( ( phys == null ) || ( phys.length != 2 ) ) {
return false;
}
+ final Phylogeny[] phys2 = ForesterUtil.readPhylogeniesFromUrl( u, PhyloXmlParser.createPhyloXmlParser() );
+
+ if ( ( phys2 == null ) || ( phys2.length != 2 ) ) {
+ return false;
+ }
}
catch ( final Exception e ) {
e.printStackTrace();
+ return false;
}
return true;
}
private static final boolean testToLReading() {
try {
final URL u = new URL( WebserviceUtil.TOL_URL_BASE + "15079" );
- final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
- final Phylogeny[] phys = factory.create( u.openStream(), new TolParser() );
+ final Phylogeny[] phys = ForesterUtil.readPhylogeniesFromUrl( u, new TolParser() );
if ( ( phys == null ) || ( phys.length != 1 ) ) {
return false;
}
if ( phys[ 0 ].getNumberOfExternalNodes() < 5 ) {
return false;
}
+ //
+ final URL u2 = new URL( WebserviceUtil.TOL_URL_BASE + "17706" );
+ final Phylogeny[] phys2 = ForesterUtil.readPhylogeniesFromUrl( u2, new TolParser() );
+ if ( ( phys2 == null ) || ( phys2.length != 1 ) ) {
+ return false;
+ }
+ if ( !phys2[ 0 ].getRoot().getNodeData().getTaxonomy().getIdentifier().getValue().equals( "17706" ) ) {
+ return false;
+ }
+ if ( phys2[ 0 ].getNumberOfExternalNodes() < 5 ) {
+ return false;
+ }
}
catch ( final Exception e ) {
e.printStackTrace();
+ return false;
}
return true;
}
private static final boolean testTreeBaseReading() {
try {
- final URL u = new URL( WebserviceUtil.TREEBASE_PHYLOWS_TREE_URL_BASE + "72557?format=nexus" );
- System.out.println( u.toString() );
-
- final HttpsURLConnection con = TrustManager.makeHttpsURLConnection( u );
-
+ final URL u = new URL( WebserviceUtil.TREEBASE_PHYLOWS_TREE_URL_BASE + "72557?format=nexus" );
final NexusPhylogeniesParser parser = new NexusPhylogeniesParser();
parser.setReplaceUnderscores( true );
- final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
-
-
- final Phylogeny[] phys = factory.create( con.getInputStream(), parser );
- if ( ( phys == null ) || ( phys.length < 1 ) ) {
+ final Phylogeny[] phys = ForesterUtil.readPhylogeniesFromUrl( u, parser );
+ if ( ( phys == null ) || ( phys.length != 1 ) ) {
+ return false;
+ }
+ final URL u_1 = new URL( WebserviceUtil.TREEBASE_PHYLOWS_TREE_URL_BASE + "2406?format=nexus" );
+ final NexusPhylogeniesParser parser_1 = new NexusPhylogeniesParser();
+ final Phylogeny[] phys_1 = ForesterUtil.readPhylogeniesFromUrl( u_1, parser_1 );
+ if ( ( phys_1 == null ) || ( phys_1.length != 1 ) ) {
+ return false;
+ }
+ final URL u_2 = new URL( WebserviceUtil.TREEBASE_PHYLOWS_TREE_URL_BASE + "422?format=nexus" );
+ final NexusPhylogeniesParser parser_2 = new NexusPhylogeniesParser();
+ final Phylogeny[] phys_2 = ForesterUtil.readPhylogeniesFromUrl( u_2, parser_2 );
+ if ( ( phys_2 == null ) || ( phys_2.length != 1 ) ) {
+ return false;
+ }
+ final URL u_3 = new URL( WebserviceUtil.TREEBASE_PHYLOWS_TREE_URL_BASE + "2654?format=nexus" );
+ final NexusPhylogeniesParser parser_3 = new NexusPhylogeniesParser();
+ final Phylogeny[] phys_3 = ForesterUtil.readPhylogeniesFromUrl( u_3, parser_3 );
+ if ( ( phys_3 == null ) || ( phys_3.length != 1 ) ) {
+ return false;
+ }
+ final URL u_4 = new URL( WebserviceUtil.TREEBASE_PHYLOWS_TREE_URL_BASE + "825?format=nexus" );
+ final NexusPhylogeniesParser parser_4 = new NexusPhylogeniesParser();
+ final Phylogeny[] phys_4 = ForesterUtil.readPhylogeniesFromUrl( u_4, parser_4 );
+ if ( ( phys_4 == null ) || ( phys_4.length != 1 ) ) {
return false;
}
final URL u2 = new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "15613?format=nexus" );
final NexusPhylogeniesParser parser2 = new NexusPhylogeniesParser();
parser2.setReplaceUnderscores( true );
- final PhylogenyFactory factory2 = ParserBasedPhylogenyFactory.getInstance();
- final Phylogeny[] phys2 = factory2.create( u2.openStream(), parser2 );
+ final Phylogeny[] phys2 = ForesterUtil.readPhylogeniesFromUrl( u2, parser2 );
if ( ( phys2 == null ) || ( phys2.length != 9 ) ) {
- //return false;
+ return false;
+ }
+ final URL u3 = new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "14909?format=nexus" );
+ final NexusPhylogeniesParser parser3 = new NexusPhylogeniesParser();
+ final Phylogeny[] phys3 = ForesterUtil.readPhylogeniesFromUrl( u3, parser3 );
+ if ( ( phys3 == null ) || ( phys3.length != 2 ) ) {
+ return false;
+ }
+ final Phylogeny[] phys4 = ForesterUtil.readPhylogeniesFromUrl( new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "14525?format=nexus" ),
+ new NexusPhylogeniesParser() );
+ if ( ( phys4 == null ) || ( phys4.length != 1 ) ) {
+ return false;
+ }
+ final Phylogeny[] phys5 = ForesterUtil.readPhylogeniesFromUrl( new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "15632?format=nexus" ) ,
+ new NexusPhylogeniesParser() );
+ if ( ( phys5 == null ) || ( phys5.length != 1 ) ) {
+ return false;
+ }
+ final Phylogeny[] phys6 = ForesterUtil.readPhylogeniesFromUrl( new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "10190?format=nexus" ) ,
+ new NexusPhylogeniesParser() );
+ if ( ( phys6 == null ) || ( phys6.length != 1 ) ) {
+ return false;
+ }
+ final Phylogeny[] phys7 = ForesterUtil.readPhylogeniesFromUrl( new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "13246?format=nexus" ) ,
+ new NexusPhylogeniesParser() );
+ if ( ( phys7 == null ) || ( phys7.length != 2 ) ) {
+ return false;
+ }
+ final Phylogeny[] phys8 = ForesterUtil.readPhylogeniesFromUrl( new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "11662?format=nexus" ) ,
+ new NexusPhylogeniesParser() );
+ if ( ( phys8 == null ) || ( phys8.length != 2 ) ) {
+ return false;
+ }
+ final Phylogeny[] phys9 = ForesterUtil.readPhylogeniesFromUrl( new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "562?format=nexus" ) ,
+ new NexusPhylogeniesParser() );
+ if ( ( phys9 == null ) || ( phys9.length != 4 ) ) {
+ return false;
+ }
+ final Phylogeny[] phys16424 = ForesterUtil.readPhylogeniesFromUrl( new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "16424?format=nexus" ) ,
+ new NexusPhylogeniesParser() );
+ if ( ( phys16424 == null ) || ( phys16424.length != 1 ) ) {
+ return false;
+ }
+ final Phylogeny[] phys17878 = ForesterUtil.readPhylogeniesFromUrl( new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "17878?format=nexus" ) ,
+ new NexusPhylogeniesParser() );
+ if ( ( phys17878 == null ) || ( phys17878.length != 17 ) ) {
+ return false;
+ }
+ final Phylogeny[] phys18804 = ForesterUtil.readPhylogeniesFromUrl( new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "18804?format=nexus" ) ,
+ new NexusPhylogeniesParser() );
+ if ( ( phys18804 == null ) || ( phys18804.length != 2 ) ) {
+ return false;
+ }
+ final Phylogeny[] phys346 = ForesterUtil.readPhylogeniesFromUrl( new URL( WebserviceUtil.TREEBASE_PHYLOWS_STUDY_URL_BASE + "346?format=nexus" ) ,
+ new NexusPhylogeniesParser() );
+ if ( ( phys346 == null ) || ( phys346.length != 1 ) ) {
+ return false;
}
}
catch ( final Exception e ) {
e.printStackTrace();
+ return false;
}
return true;
}
parser.setTaxonomyExtraction( NHXParser.TAXONOMY_EXTRACTION.NO );
parser.setReplaceUnderscores( false );
parser.setGuessRootedness( true );
- final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
- final Phylogeny[] phys = factory.create( u.openStream(), parser );
+ final Phylogeny[] phys = ForesterUtil.readPhylogeniesFromUrl( u, parser );
if ( ( phys == null ) || ( phys.length != 1 ) ) {
return false;
}
}
catch ( final Exception e ) {
e.printStackTrace();
+ return false;
}
return true;
}
private static boolean testFastaParser() {
try {
- if ( !FastaParser.isLikelyFasta( new FileInputStream( PATH_TO_TEST_DATA + "fasta_0.fasta" ) ) ) {
+ FileInputStream fis1 = new FileInputStream( PATH_TO_TEST_DATA + "fasta_0.fasta" );
+ if ( !FastaParser.isLikelyFasta( fis1 ) ) {
+ fis1.close();
return false;
}
- if ( FastaParser.isLikelyFasta( new FileInputStream( PATH_TO_TEST_DATA + "msa_3.txt" ) ) ) {
+ else {
+ fis1.close();
+ }
+ FileInputStream fis2 = new FileInputStream( PATH_TO_TEST_DATA + "msa_3.txt" );
+ if ( FastaParser.isLikelyFasta( fis2 ) ) {
+ fis2.close();
return false;
}
+ else {
+ fis2.close();
+ }
final Msa msa_0 = FastaParser.parseMsa( new FileInputStream( PATH_TO_TEST_DATA + "fasta_0.fasta" ) );
if ( !msa_0.getSequenceAsString( 0 ).toString().equalsIgnoreCase( "ACGTGKXFMFDMXEXXXSFMFMF" ) ) {
return false;
public final class ForesterConstants {
public final static String FORESTER_VERSION = "1.039";
- public final static String FORESTER_DATE = "150513";
+ public final static String FORESTER_DATE = "160622";
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";
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLConnection;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.forester.archaeopteryx.Constants;
+import org.forester.archaeopteryx.AptxConstants;
+import org.forester.io.parsers.PhylogenyParser;
+import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.Distribution;
import org.forester.phylogeny.data.Sequence;
import org.forester.phylogeny.data.Taxonomy;
+import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
import org.forester.protein.BasicProtein;
import org.forester.protein.Domain;
import org.forester.protein.Protein;
return OS_NAME.toLowerCase().startsWith( "mac" );
}
catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "minor error: " + e );
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "minor error: " + e );
return false;
}
}
return OS_NAME.toLowerCase().indexOf( "win" ) > -1;
}
catch ( final Exception e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "minor error: " + e );
+ ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "minor error: " + e );
return false;
}
}
return sb.toString();
}
+
+ public final static Phylogeny[] readPhylogeniesFromUrl( final URL url,
+ final PhylogenyParser parser )
+ throws NoSuchAlgorithmException, IOException, KeyManagementException {
+ if ( url == null ) {
+ throw new IllegalArgumentException( "URL to read from must not be null" );
+ }
+ else if ( parser == null ) {
+ throw new IllegalArgumentException( "parser to use to read from URL must not be null" );
+ }
+ final URLConnection con;
+ if ( url.toString().startsWith( "https:" ) ) {
+ con = TrustManager.makeHttpsURLConnection( url );
+ }
+ else if ( url.toString().startsWith( "http:" ) ) {
+ con = url.openConnection();
+ }
+ else {
+ throw new IllegalArgumentException( "Cannot deal with URL: " + url );
+ }
+ if ( con == null ) {
+ throw new IOException( "could not create connection from " + url );
+ }
+ con.setDefaultUseCaches( false );
+ final InputStream is = con.getInputStream();
+ if ( is == null ) {
+ throw new IOException( "could not create input stream from " + url );
+ }
+ final Phylogeny[] trees = ParserBasedPhylogenyFactory.getInstance().create( is, parser );
+ try {
+ is.close();
+ }
+ catch ( final Exception e ) {
+ // ignore
+ }
+ return trees;
+ }
+
private ForesterUtil() {
}
}
import javax.net.ssl.SSLContext;\r
import javax.net.ssl.X509TrustManager;\r
\r
-public class TrustManager implements X509TrustManager {\r
+final class TrustManager implements X509TrustManager {\r
\r
@Override\r
public X509Certificate[] getAcceptedIssuers() {\r
throws CertificateException {\r
}\r
\r
- public final static HttpsURLConnection makeHttpsURLConnection( final URL url ) throws NoSuchAlgorithmException,\r
+ final static HttpsURLConnection makeHttpsURLConnection( final URL url ) throws NoSuchAlgorithmException,\r
IOException,\r
KeyManagementException {\r
\r