From c6c81526c849833f8691761d10e1c3f79aedd362 Mon Sep 17 00:00:00 2001 From: cmzmasek Date: Tue, 5 Mar 2013 06:44:11 +0000 Subject: [PATCH] in progress --- .../src/org/forester/archaeopteryx/AptxUtil.java | 2 +- .../src/org/forester/archaeopteryx/Constants.java | 4 +- .../src/org/forester/archaeopteryx/TreePanel.java | 81 +++++++++++++------- .../src/org/forester/util/ForesterConstants.java | 4 +- 4 files changed, 60 insertions(+), 31 deletions(-) diff --git a/forester/java/src/org/forester/archaeopteryx/AptxUtil.java b/forester/java/src/org/forester/archaeopteryx/AptxUtil.java index 627e152..18e80e7 100644 --- a/forester/java/src/org/forester/archaeopteryx/AptxUtil.java +++ b/forester/java/src/org/forester/archaeopteryx/AptxUtil.java @@ -90,7 +90,7 @@ public final class AptxUtil { final static String UNIPROT_KB = "http://www.uniprot.org/uniprot/"; final static Pattern UNIPROT_KB_PATTERN_1 = Pattern - .compile( "\\bsp|tr.\\S([A-Z0-9]{5,6})\\b" ); + .compile( "\\b(sp|tr)\\W([A-Z0-9]{5,6})\\b" ); final static Pattern UNIPROT_KB_PATTERN_2 = Pattern .compile( "\\b[A-Z0-9]{5,6}_[A-Z9][A-Z]{2}[A-Z0-9]{2}|RAT|PIG|PEA\\b" ); diff --git a/forester/java/src/org/forester/archaeopteryx/Constants.java b/forester/java/src/org/forester/archaeopteryx/Constants.java index 988daf4..d9723d6 100644 --- a/forester/java/src/org/forester/archaeopteryx/Constants.java +++ b/forester/java/src/org/forester/archaeopteryx/Constants.java @@ -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.9803"; - final static String PRG_DATE = "130225"; + final static String VERSION = "0.9804"; + final static String PRG_DATE = "130304"; 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" }; diff --git a/forester/java/src/org/forester/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index 9e6fcc6..b94080f 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -3243,30 +3243,26 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee return true; } if ( !ForesterUtil.isEmpty( node.getName() ) - && ( AptxUtil.UNIPROT_KB_PATTERN_1.matcher( node.getName() ).find() - || AptxUtil.UNIPROT_KB_PATTERN_2.matcher( node.getName() ).find() - ) ) { + && ( AptxUtil.UNIPROT_KB_PATTERN_1.matcher( node.getName() ).find() || AptxUtil.UNIPROT_KB_PATTERN_2 + .matcher( node.getName() ).find() ) ) { return true; } if ( node.getNodeData().isHasSequence() ) { Sequence seq = node.getNodeData().getSequence(); - if ( !ForesterUtil.isEmpty( seq.getName() ) && ( AptxUtil.UNIPROT_KB_PATTERN_1.matcher( seq.getName() ).find() - || AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getName() ).find() - - ) ) { + if ( !ForesterUtil.isEmpty( seq.getName() ) + && ( AptxUtil.UNIPROT_KB_PATTERN_1.matcher( seq.getName() ).find() || AptxUtil.UNIPROT_KB_PATTERN_2 + .matcher( seq.getName() ).find() ) ) { return true; } if ( !ForesterUtil.isEmpty( seq.getSymbol() ) - && ( AptxUtil.UNIPROT_KB_PATTERN_1.matcher( seq.getSymbol() ).find() - || AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getSymbol() ).find() ) ) { + && ( AptxUtil.UNIPROT_KB_PATTERN_1.matcher( seq.getSymbol() ).find() || AptxUtil.UNIPROT_KB_PATTERN_2 + .matcher( seq.getSymbol() ).find() ) ) { return true; } if ( ( node.getNodeData().getSequence().getAccession() != null ) && !ForesterUtil.isEmpty( seq.getAccession().getValue() ) - && ( AptxUtil.UNIPROT_KB_PATTERN_1.matcher( seq.getAccession().getValue() ).find() - - || AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getAccession().getValue() ).find() - ) ) { + && ( AptxUtil.UNIPROT_KB_PATTERN_1.matcher( seq.getAccession().getValue() ).find() || AptxUtil.UNIPROT_KB_PATTERN_2 + .matcher( seq.getAccession().getValue() ).find() ) ) { return true; } } @@ -3307,24 +3303,57 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee String upkb = null; if ( node.getNodeData().isHasSequence() ) { Sequence seq = node.getNodeData().getSequence(); - if ( !ForesterUtil.isEmpty( seq.getSymbol() ) - && AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getSymbol() ).find() ) { - upkb = AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getSymbol() ).group(); + Matcher m; + if ( !ForesterUtil.isEmpty( seq.getSymbol() ) ) { + m = AptxUtil.UNIPROT_KB_PATTERN_1.matcher( seq.getSymbol() ); + if ( !ForesterUtil.isEmpty( seq.getSymbol() ) ) { + if ( m.find() ) { + upkb = m.group( 2 ); + } + else { + m = AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getSymbol() ); + if ( m.find() ) { + upkb = m.group(); + } + } + } } - else if ( !ForesterUtil.isEmpty( seq.getName() ) - && AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getName() ).find() ) { - upkb = AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getName() ).group(); + if ( ForesterUtil.isEmpty( upkb ) && !ForesterUtil.isEmpty( seq.getName() ) ) { + m = AptxUtil.UNIPROT_KB_PATTERN_1.matcher( seq.getName() ); + if ( m.find() ) { + upkb = m.group( 2 ); + } + else { + m = AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getName() ); + if ( m.find() ) { + upkb = m.group(); + } + } } - else if ( ( node.getNodeData().getSequence().getAccession() != null ) - && !ForesterUtil.isEmpty( seq.getAccession().getValue() ) - && AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getAccession().getValue() ).find() ) { - upkb = AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getAccession().getValue() ).group(); + if ( ForesterUtil.isEmpty( upkb ) && ( node.getNodeData().getSequence().getAccession() != null ) + && !ForesterUtil.isEmpty( seq.getAccession().getValue() ) ) { + m = AptxUtil.UNIPROT_KB_PATTERN_1.matcher( seq.getAccession().getValue() ); + if ( m.find() ) { + upkb = m.group( 2 ); + } + else { + m = AptxUtil.UNIPROT_KB_PATTERN_2.matcher( seq.getAccession().getValue() ); + if ( m.find() ) { + upkb = m.group(); + } + } } } if ( ForesterUtil.isEmpty( upkb ) && !ForesterUtil.isEmpty( node.getName() ) ) { - final Matcher m = AptxUtil.UNIPROT_KB_PATTERN_2.matcher( node.getName() ); - if ( m.find() ) { - upkb = m.group(); + final Matcher m1 = AptxUtil.UNIPROT_KB_PATTERN_1.matcher( node.getName() ); + if ( m1.find() ) { + upkb = m1.group( 2 ); + } + else { + final Matcher m2 = AptxUtil.UNIPROT_KB_PATTERN_2.matcher( node.getName() ); + if ( m2.find() ) { + upkb = m2.group(); + } } } try { diff --git a/forester/java/src/org/forester/util/ForesterConstants.java b/forester/java/src/org/forester/util/ForesterConstants.java index b0c862d..9cbfb09 100644 --- a/forester/java/src/org/forester/util/ForesterConstants.java +++ b/forester/java/src/org/forester/util/ForesterConstants.java @@ -27,8 +27,8 @@ package org.forester.util; public final class ForesterConstants { - public final static String FORESTER_VERSION = "1.022"; - public final static String FORESTER_DATE = "130225"; + public final static String FORESTER_VERSION = "1.023"; + public final static String FORESTER_DATE = "130304"; 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"; -- 1.7.10.2