inprogress
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 6 Mar 2013 18:40:10 +0000 (18:40 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 6 Mar 2013 18:40:10 +0000 (18:40 +0000)
forester/java/src/org/forester/archaeopteryx/AptxUtil.java
forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java
forester/java/src/org/forester/archaeopteryx/Configuration.java
forester/java/src/org/forester/archaeopteryx/Constants.java
forester/java/src/org/forester/archaeopteryx/MainFrame.java
forester/java/src/org/forester/archaeopteryx/TreePanel.java
forester/java/src/org/forester/archaeopteryx/WebLink.java [deleted file]
forester/java/src/org/forester/test/Test.java
forester/java/src/org/forester/util/ForesterConstants.java

index 823e18f..8ccd028 100644 (file)
@@ -78,7 +78,6 @@ import org.forester.phylogeny.PhylogenyMethods;
 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;
@@ -107,22 +106,10 @@ public final class AptxUtil {
                                                    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() );
@@ -130,18 +117,6 @@ public final class AptxUtil {
             }
         }
         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 {
index ba52ded..89e043f 100644 (file)
@@ -13,7 +13,6 @@ import java.io.IOException;
 import java.net.URL;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 import java.util.NoSuchElementException;
 
 import javax.swing.ButtonGroup;
@@ -280,7 +279,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
             MainFrame.about();
         }
         else if ( o == _help_item ) {
-            help( getConfiguration().getWebLinks() );
+            help();
         }
         else if ( o == _website_item ) {
             try {
@@ -816,7 +815,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         return _options;
     }
 
-    void help( final Map<String, WebLink> weblinks ) {
+    void help() {
         final StringBuilder sb = new StringBuilder();
         sb.append( "Display options\n" );
         sb.append( "-------------------\n" );
@@ -854,15 +853,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         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" );
index b487a6d..c578e05 100644 (file)
@@ -34,7 +34,6 @@ import java.io.File;
 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;
@@ -57,14 +56,12 @@ import org.forester.util.ForesterUtil;
 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;
@@ -96,8 +93,8 @@ public final class Configuration {
     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;
@@ -244,7 +241,6 @@ public final class Configuration {
         else {
             config_filename = cf;
         }
-        setWebLinks( new TreeMap<String, WebLink>() );
         setDisplayColors( new TreeMap<String, Color>() );
         config_filename = config_filename.trim();
         URL u = null;
@@ -725,14 +721,6 @@ public final class Configuration {
         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.
@@ -754,10 +742,6 @@ public final class Configuration {
         return _editable;
     }
 
-    boolean isHasWebLink( final String source ) {
-        return getWebLinks().containsKey( source );
-    }
-
     /**
      * Only used by ArchaeoptryxE.
      *
@@ -809,25 +793,6 @@ public final class Configuration {
         _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" ) ) {
@@ -1678,17 +1643,6 @@ public final class Configuration {
                 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 );
index d9723d6..bc90822 100644 (file)
@@ -42,8 +42,8 @@ public final class Constants {
     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" };
@@ -109,5 +109,5 @@ public final class Constants {
                                                                                                            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;
 }
index d4598b1..5e7a13d 100644 (file)
@@ -34,7 +34,6 @@ import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
-import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Set;
 
@@ -448,7 +447,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
             about();
         }
         else if ( o == _help_item ) {
-            help( getConfiguration().getWebLinks() );
+            help();
         }
         else if ( o == _website_item ) {
             try {
@@ -803,7 +802,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         return _jmenubar;
     }
 
-    void help( final Map<String, WebLink> weblinks ) {
+    void help() {
         final StringBuilder sb = new StringBuilder();
         sb.append( "Display options\n" );
         sb.append( "-------------------\n" );
@@ -841,14 +840,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         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"
         // +
@@ -889,7 +881,6 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         // + "    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" );
index 07a99bd..b2ec09f 100644 (file)
@@ -2912,11 +2912,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
 
     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 )
@@ -3240,14 +3236,6 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
     }
 
     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 );
@@ -3292,19 +3280,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         }
         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();
diff --git a/forester/java/src/org/forester/archaeopteryx/WebLink.java b/forester/java/src/org/forester/archaeopteryx/WebLink.java
deleted file mode 100644 (file)
index 3cab22b..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// $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();
-    }
-}
index c13523c..afab717 100644 (file)
@@ -1023,32 +1023,30 @@ public final class Test {
             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;
             }
         }
index 9cbfb09..1232c66 100644 (file)
@@ -28,7 +28,7 @@ package org.forester.util;
 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";