From 7b71f8b227ba45794d2ba9cc9d0572a84da299f5 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Wed, 9 Apr 2014 01:47:30 +0000 Subject: [PATCH] inprogress --- .../org/forester/analysis/TaxonomyDataManager.java | 23 ++++++++++---------- .../org/forester/archaeopteryx/UrlTreeReader.java | 2 +- .../archaeopteryx/webservices/WebserviceUtil.java | 6 ++--- .../org/forester/io/parsers/util/ParserUtils.java | 1 + forester/java/src/org/forester/test/Test.java | 4 ++++ 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/forester/java/src/org/forester/analysis/TaxonomyDataManager.java b/forester/java/src/org/forester/analysis/TaxonomyDataManager.java index ad9ee25..4e88a61 100644 --- a/forester/java/src/org/forester/analysis/TaxonomyDataManager.java +++ b/forester/java/src/org/forester/analysis/TaxonomyDataManager.java @@ -33,6 +33,7 @@ import java.util.HashMap; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; +import java.util.regex.Matcher; import javax.swing.JOptionPane; @@ -349,17 +350,17 @@ public final class TaxonomyDataManager extends RunnableProcess { ut = obtainTaxonomy( TaxonomyDataManager.getIdTaxCacheMap(), id, qt ); } } - // - // qt = QUERY_TYPE.SN; - // UniProtTaxonomy ut = obtainTaxonomy( TaxonomyDataManager.getSnTaxCacheMap(), simple_name, qt ); - // if ( ut == null ) { - // qt = QUERY_TYPE.CODE; - // ut = obtainTaxonomy( TaxonomyDataManager.getCodeTaxCacheMap(), simple_name, qt ); - // } - // if ( ut == null ) { - // qt = QUERY_TYPE.CN; - // ut = obtainTaxonomy( TaxonomyDataManager.getCnTaxCacheMap(), simple_name, qt ); - // } + if ( ut == null ) { + String sn = ""; + final Matcher m = ParserUtils.TAXOMONY_SN_PATTERN_I.matcher( simple_name ); + if ( m.matches() ) { + sn = m.group( 1 ); + } + if ( !ForesterUtil.isEmpty( sn ) ) { + qt = QUERY_TYPE.SN; + ut = obtainTaxonomy( TaxonomyDataManager.getSnTaxCacheMap(), sn, qt ); + } + } return ut; } diff --git a/forester/java/src/org/forester/archaeopteryx/UrlTreeReader.java b/forester/java/src/org/forester/archaeopteryx/UrlTreeReader.java index caf9ad8..1779119 100644 --- a/forester/java/src/org/forester/archaeopteryx/UrlTreeReader.java +++ b/forester/java/src/org/forester/archaeopteryx/UrlTreeReader.java @@ -255,7 +255,7 @@ public class UrlTreeReader implements Runnable { + "]", 80 ), "Error", JOptionPane.ERROR_MESSAGE ); } _main_frame.getContentPane().repaint(); - if ( ( ( trees != null ) && ( trees.length > 0 ) ) && ( ( new Date().getTime() - start_time ) > 20000 ) ) { + if ( ( trees != null ) && ( trees.length > 0 ) ) { try { JOptionPane.showMessageDialog( null, ForesterUtil.wordWrap( "Successfully read in " + trees.length diff --git a/forester/java/src/org/forester/archaeopteryx/webservices/WebserviceUtil.java b/forester/java/src/org/forester/archaeopteryx/webservices/WebserviceUtil.java index ea6ff4f..ce35430 100644 --- a/forester/java/src/org/forester/archaeopteryx/webservices/WebserviceUtil.java +++ b/forester/java/src/org/forester/archaeopteryx/webservices/WebserviceUtil.java @@ -73,9 +73,9 @@ public final class WebserviceUtil { "http://tolweb.org", null ) ); clients.add( new BasicPhylogeniesWebserviceClient( TREE_BASE_NAME, - "Read Tree(s) from TreeBASE study...", + "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: 15613, 15632, 14525, 14909)", + "Please enter a TreeBASE study (\"S\") identifier (without the \"S\")\n(Examples: 14909, 14525, 15613, 15632)", WsPhylogenyFormat.TREEBASE_STUDY, null, TREEBASE_PHYLOWS_STUDY_URL_BASE @@ -87,7 +87,7 @@ public final class WebserviceUtil { clients.add( new BasicPhylogeniesWebserviceClient( TREE_BASE_NAME, "Read Tree from TreeBASE...", "Use TreeBASE to obtain a evolutionary tree", - "Please enter a TreeBASE tree (\"Tr\") identifier (without the \"Tr\")\n(Examples: 422, 2654, 825, 4931, 2518, 2406, 4934)", + "Please enter a TreeBASE tree (\"Tr\") identifier (without the \"Tr\")\n(Examples: 2406, 422, 2654, 825, 4931, 2518, 4934)", WsPhylogenyFormat.TREEBASE_TREE, null, TREEBASE_PHYLOWS_TREE_URL_BASE diff --git a/forester/java/src/org/forester/io/parsers/util/ParserUtils.java b/forester/java/src/org/forester/io/parsers/util/ParserUtils.java index 6ad78db..c10efb7 100644 --- a/forester/java/src/org/forester/io/parsers/util/ParserUtils.java +++ b/forester/java/src/org/forester/io/parsers/util/ParserUtils.java @@ -64,6 +64,7 @@ public final class ParserUtils { .compile( "(?:\\b|_)[a-zA-Z0-9]{3,}_([A-Z][a-z]+_[a-z]{2,}(?:_[a-z][a-z0-9_]+)?)\\b" ); final public static Pattern TAXOMONY_SN_PATTERN_SN = Pattern .compile( "\\b([A-Z][a-z]+[_ ][a-z]{2,}(?:[_ ][a-z]+)?)(?:\\b|_)" ); + final public static Pattern TAXOMONY_SN_PATTERN_I = Pattern.compile( "([A-Z][a-z]{2,})" ); final private static Pattern TAXOMONY_CODE_PATTERN_PFS = Pattern.compile( "(?:\\b|_)[A-Z0-9]{4,}_(" + TAX_CODE + ")/\\d+-\\d+\\b" ); final private static Pattern TAXOMONY_UNIPROT_ID_PATTERN_PFR = Pattern diff --git a/forester/java/src/org/forester/test/Test.java b/forester/java/src/org/forester/test/Test.java index c7c8641..c347106 100644 --- a/forester/java/src/org/forester/test/Test.java +++ b/forester/java/src/org/forester/test/Test.java @@ -7581,6 +7581,10 @@ public final class Test { if ( phylogenies.length != 3 ) { return false; } + if ( !isEqual( phylogenies[ 2 ].getNode( "Aloysia lycioides 251-76-02169" ).getDistanceToParent(), + 0.00100049 ) ) { + return false; + } } catch ( final Exception e ) { e.printStackTrace( System.out ); -- 1.7.10.2