import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.Accession;
import org.forester.phylogeny.data.BranchColor;
-import org.forester.phylogeny.data.Sequence;
import org.forester.phylogeny.data.Taxonomy;
import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
import org.forester.phylogeny.factories.PhylogenyFactory;
final Configuration conf,
final TreePanel tp ) {
String uri_str = null;
- if ( node.getNodeData().isHasSequence() && ( node.getNodeData().getSequence().getAccession() != null )
- && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getSource() )
- && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getValue() )
- && conf.isHasWebLink( node.getNodeData().getSequence().getAccession().getSource().toLowerCase() ) ) {
- final Sequence seq = node.getNodeData().getSequence();
- final String source = seq.getAccession().getSource().toLowerCase();
- String url;
- if ( source.toLowerCase().equals( "ncbi" ) ) {
- url = Constants.NCBI_ALL_DATABASE_SEARCH;
- }
- else {
- final WebLink weblink = conf.getWebLink( source );
- url = weblink.getUrl().toString();
- }
+ final String upkb = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node );
+ if ( !ForesterUtil.isEmpty( upkb ) ) {
try {
- uri_str = url + URLEncoder.encode( seq.getAccession().getValue(), ForesterConstants.UTF8 );
+ uri_str = ForesterUtil.UNIPROT_KB + URLEncoder.encode( upkb, ForesterConstants.UTF8 );
}
catch ( final UnsupportedEncodingException e ) {
showErrorMessage( tp, e.toString() );
}
}
if ( ForesterUtil.isEmpty( uri_str ) ) {
- final String upkb = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node );
- if ( !ForesterUtil.isEmpty( upkb ) ) {
- try {
- uri_str = ForesterUtil.UNIPROT_KB + URLEncoder.encode( upkb, ForesterConstants.UTF8 );
- }
- catch ( final UnsupportedEncodingException e ) {
- showErrorMessage( tp, e.toString() );
- e.printStackTrace();
- }
- }
- }
- if ( ForesterUtil.isEmpty( uri_str ) ) {
final String v = ForesterUtil.extractGenbankAccessor( node );
if ( !ForesterUtil.isEmpty( v ) ) {
try {
import java.net.URL;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import java.util.NoSuchElementException;
import javax.swing.ButtonGroup;
MainFrame.about();
}
else if ( o == _help_item ) {
- help( getConfiguration().getWebLinks() );
+ help();
}
else if ( o == _website_item ) {
try {
return _options;
}
- void help( final Map<String, WebLink> weblinks ) {
+ void help() {
final StringBuilder sb = new StringBuilder();
sb.append( "Display options\n" );
sb.append( "-------------------\n" );
sb.append( "Since the Java default memory allocation is quite small, it might by necessary (for trees\n" );
sb.append( "with more than approximately 5000 external nodes) to increase the memory which Java can use, with\n" );
sb.append( "the '-Xmx' Java command line option. For example:\n" );
- sb.append( "java -Xms32m -Xmx256m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" );
- if ( ( weblinks != null ) && ( weblinks.size() > 0 ) ) {
- sb.append( "Active web links\n" );
- sb.append( "--------------------\n" );
- for( final String key : weblinks.keySet() ) {
- sb.append( " " + weblinks.get( key ).toString() + "\n" );
- }
- }
- sb.append( "\n" );
+ sb.append( "java -Xmx1024m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" );
sb.append( "phyloXML\n" );
sb.append( "-------------------\n" );
sb.append( "Reference: " + Constants.PHYLOXML_REFERENCE + "\n" );
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.Hashtable;
public final class Configuration {
static final String VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA = "validate_against_phyloxml_xsd_schema";
- private static final String WEB_LINK_KEY = "web_link";
private static final String DISPLAY_COLOR_KEY = "display_color";
private static final int DEPRECATED = -2;
private UI _ui = UI.UNKNOWN;
private boolean _use_tabbed_display = false;
private boolean _hide_controls_and_menus = false;
private CLADOGRAM_TYPE _cladogram_type = Constants.CLADOGRAM_TYPE_DEFAULT;
- private SortedMap<String, WebLink> _weblinks = null;
private SortedMap<String, Color> _display_colors = null;
private boolean _antialias_screen = true;
private PHYLOGENY_GRAPHICS_TYPE _phylogeny_graphics_type = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
private boolean _color_labels_same_as_parent_branch = false;
private boolean _show_default_node_shapes_internal = false;
private boolean _show_default_node_shapes_external = false;
- private NodeShape _default_node_shape = NodeShape.CIRCLE;
- private NodeFill _default_node_fill = NodeFill.GRADIENT;
+ private NodeShape _default_node_shape = NodeShape.RECTANGLE;
+ private NodeFill _default_node_fill = NodeFill.SOLID;
private short _default_node_shape_size = Constants.DEFAULT_NODE_SHAPE_SIZE_DEFAULT;
private boolean _taxonomy_colorize_node_shapes = false;
private int _default_bootstrap_samples = -1;
else {
config_filename = cf;
}
- setWebLinks( new TreeMap<String, WebLink>() );
setDisplayColors( new TreeMap<String, Color>() );
config_filename = config_filename.trim();
URL u = null;
return _taxonomy_extraction;
}
- WebLink getWebLink( final String source ) {
- return getWebLinks().get( source );
- }
-
- Map<String, WebLink> getWebLinks() {
- return _weblinks;
- }
-
boolean isAntialiasScreen() {
if ( AptxUtil.isMac() ) {
// Apple Macintosh graphics are slow, turn off anti-alias.
return _editable;
}
- boolean isHasWebLink( final String source ) {
- return getWebLinks().containsKey( source );
- }
-
/**
* Only used by ArchaeoptryxE.
*
_taxonomy_extraction = taxonomy_extraction;
}
- void setWebLinks( final SortedMap<String, WebLink> weblinks ) {
- _weblinks = weblinks;
- }
-
- private void createWebLink( final String url_str, final String desc, final String source_identifier ) {
- WebLink weblink = null;
- boolean ex = false;
- try {
- weblink = new WebLink( new URL( url_str.trim() ), desc.trim(), source_identifier.trim() );
- }
- catch ( final MalformedURLException e ) {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME, "could not create URL from [" + url_str + "]" );
- ex = true;
- }
- if ( !ex && ( weblink != null ) ) {
- getWebLinks().put( weblink.getSourceIdentifier().toLowerCase(), weblink );
- }
- }
-
private int getClickToIndex( final String name ) {
int index = -1;
if ( name.equals( "edit_info" ) ) {
else if ( key.equals( DISPLAY_COLOR_KEY ) ) {
putDisplayColors( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
}
- else if ( key.equals( WEB_LINK_KEY ) ) {
- if ( st.countTokens() == 3 ) {
- createWebLink( ( String ) st.nextElement(),
- ( String ) st.nextElement(),
- ( String ) st.nextElement() );
- }
- else {
- ForesterUtil.printWarningMessage( Constants.PRG_NAME,
- "illegal format in configuration file for key [" + key + "]" );
- }
- }
else {
ForesterUtil.printWarningMessage( Constants.PRG_NAME, "unknown configuration key [" + key
+ "] in: " + config_filename );
public final static boolean __SYNTH_LF = false; // TODO remove me
public final static boolean ALLOW_DDBJ_BLAST = false;
public final static String PRG_NAME = "Archaeopteryx";
- final static String VERSION = "0.9804";
- final static String PRG_DATE = "130304";
+ final static String VERSION = "0.9805 A1ST";
+ final static String PRG_DATE = "130306";
final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file";
final static String[] DEFAULT_FONT_CHOICES = { "Verdana", "Tahoma",
"Arial", "Helvetica", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" };
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;
+ final static short DEFAULT_NODE_SHAPE_SIZE_DEFAULT = 4;
}
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
-import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
about();
}
else if ( o == _help_item ) {
- help( getConfiguration().getWebLinks() );
+ help();
}
else if ( o == _website_item ) {
try {
return _jmenubar;
}
- void help( final Map<String, WebLink> weblinks ) {
+ void help() {
final StringBuilder sb = new StringBuilder();
sb.append( "Display options\n" );
sb.append( "-------------------\n" );
sb.append( "Since the Java default memory allocation is quite small, it might by necessary (for trees\n" );
sb.append( "with more than approximately 5000 external nodes) to increase the memory which Java can use, with\n" );
sb.append( "the '-Xmx' Java command line option. For example:\n" );
- sb.append( "java -Xms32m -Xmx256m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" );
- if ( ( weblinks != null ) && ( weblinks.size() > 0 ) ) {
- sb.append( "Active web links\n" );
- sb.append( "--------------------\n" );
- for( final String key : weblinks.keySet() ) {
- sb.append( " " + weblinks.get( key ).toString() + "\n" );
- }
- }
+ sb.append( "java -Xmx1024m -cp path\\to\\forester.jar org.forester.archaeopteryx.Archaeopteryx\n\n" );
// + "General remarks\n"
// + "---------------\n"
// +
// + " incorrect and need to be inferred again\n"
// +
// " with: \"SDI\"|\"SDI (Speciation Duplication Inference)\n\n"
- sb.append( "\n" );
sb.append( "phyloXML\n" );
sb.append( "-------------------\n" );
sb.append( "Reference: " + Constants.PHYLOXML_REFERENCE + "\n" );
final private boolean isCanOpenTaxWeb( final PhylogenyNode node ) {
if ( node.getNodeData().isHasTaxonomy()
- && ( ( ( node.getNodeData().getTaxonomy().getIdentifier() != null )
- && !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getIdentifier().getProvider() )
- && !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getIdentifier().getValue() ) && getConfiguration()
- .isHasWebLink( node.getNodeData().getTaxonomy().getIdentifier().getProvider().toLowerCase() ) )
- || ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getScientificName() ) )
+ && ( ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getScientificName() ) )
|| ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getTaxonomyCode() ) )
|| ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getCommonName() ) ) || ( ( node
.getNodeData().getTaxonomy().getIdentifier() != null )
}
final private String isCanOpenSeqWeb( final PhylogenyNode node ) {
- if ( node.getNodeData().isHasSequence()
- && ( node.getNodeData().getSequence().getAccession() != null )
- && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getSource() )
- && !ForesterUtil.isEmpty( node.getNodeData().getSequence().getAccession().getValue() )
- && getConfiguration().isHasWebLink( node.getNodeData().getSequence().getAccession().getSource()
- .toLowerCase() ) ) {
- return node.getNodeData().getSequence().getAccession().getSource();
- }
String v = ForesterUtil.extractUniProtKbProteinSeqIdentifier( node );
if ( ForesterUtil.isEmpty( v ) ) {
v = ForesterUtil.extractGenbankAccessor( node );
}
String uri_str = null;
final Taxonomy tax = node.getNodeData().getTaxonomy();
- if ( ( tax.getIdentifier() != null ) && !ForesterUtil.isEmpty( tax.getIdentifier().getProvider() )
- && getConfiguration().isHasWebLink( tax.getIdentifier().getProvider().toLowerCase() ) ) {
- final String type = tax.getIdentifier().getProvider().toLowerCase();
- final WebLink weblink = getConfiguration().getWebLink( type );
- try {
- uri_str = weblink.getUrl() + URLEncoder.encode( tax.getIdentifier().getValue(), ForesterConstants.UTF8 );
- }
- catch ( final UnsupportedEncodingException e ) {
- AptxUtil.showErrorMessage( this, e.toString() );
- e.printStackTrace();
- }
- }
- else if ( ( tax.getIdentifier() != null ) && !ForesterUtil.isEmpty( tax.getIdentifier().getValue() )
+ if ( ( tax.getIdentifier() != null ) && !ForesterUtil.isEmpty( tax.getIdentifier().getValue() )
&& tax.getIdentifier().getValue().startsWith( "http://" ) ) {
try {
uri_str = new URI( tax.getIdentifier().getValue() ).toString();
+++ /dev/null
-// $Id:
-// FORESTER -- software libraries and applications
-// for evolutionary biology research and applications.
-//
-// Copyright (C) 2008-2009 Christian M. Zmasek
-// Copyright (C) 2008-2009 Burnham Institute for Medical Research
-// All rights reserved
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-//
-// Contact: phylosoft @ gmail . com
-// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
-
-package org.forester.archaeopteryx;
-
-import java.net.URL;
-
-class WebLink {
-
- private final URL _url;
- private final String _desc;
- private final String _source_identifier;
-
- WebLink( final URL url, final String desc, final String source_identifier ) {
- _url = url;
- _desc = desc;
- _source_identifier = source_identifier;
- }
-
- String getDesc() {
- return _desc;
- }
-
- String getSourceIdentifier() {
- return _source_identifier;
- }
-
- URL getUrl() {
- return _url;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append( getDesc() );
- sb.append( " [" );
- sb.append( getSourceIdentifier() );
- sb.append( "]: " );
- sb.append( getUrl().toString() );
- return sb.toString();
- }
-}
final PhylogenyNode n = new PhylogenyNode();
n.setName( "tr|B3RJ64" );
if ( !AptxUtil.createUriForSeqWeb( n, null, null ).equals( ForesterUtil.UNIPROT_KB + "B3RJ64" ) ) {
- System.out.println( AptxUtil.createUriForSeqWeb( n, null, null ) );
- System.exit( -1 );
return false;
}
n.setName( "B0LM41_HUMAN" );
if ( !AptxUtil.createUriForSeqWeb( n, null, null ).equals( ForesterUtil.UNIPROT_KB + "B0LM41_HUMAN" ) ) {
- System.out.println( AptxUtil.createUriForSeqWeb( n, null, null ) );
- System.exit( -1 );
return false;
}
n.setName( "NP_001025424" );
if ( !AptxUtil.createUriForSeqWeb( n, null, null ).equals( ForesterUtil.NCBI_PROTEIN + "NP_001025424" ) ) {
- System.out.println( AptxUtil.createUriForSeqWeb( n, null, null ) );
- System.exit( -1 );
return false;
}
n.setName( "_NM_001030253-" );
if ( !AptxUtil.createUriForSeqWeb( n, null, null ).equals( ForesterUtil.NCBI_NUCCORE + "NM_001030253" ) ) {
- System.out.println( AptxUtil.createUriForSeqWeb( n, null, null ) );
- System.exit( -1 );
return false;
}
- n.setName( "NP_001025424" );
- if ( !AptxUtil.createUriForSeqWeb( n, null, null ).equals( ForesterUtil.NCBI_PROTEIN + "NP_001025424" ) ) {
- System.out.println( AptxUtil.createUriForSeqWeb( n, null, null ) );
- System.exit( -1 );
+ n.setName( "XM_002122186" );
+ if ( !AptxUtil.createUriForSeqWeb( n, null, null ).equals( ForesterUtil.NCBI_NUCCORE + "XM_002122186" ) ) {
+ return false;
+ }
+ n.setName( "AAA34956" );
+ if ( !AptxUtil.createUriForSeqWeb( n, null, null ).equals( ForesterUtil.NCBI_PROTEIN + "AAA34956" ) ) {
+ return false;
+ }
+ n.setName( "Q06891.1" );
+ if ( !AptxUtil.createUriForSeqWeb( n, null, null ).equals( ForesterUtil.NCBI_PROTEIN + "Q06891" ) ) {
return false;
}
}
public final class ForesterConstants {
public final static String FORESTER_VERSION = "1.023";
- public final static String FORESTER_DATE = "130304";
+ public final static String FORESTER_DATE = "130306";
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";