inprogress
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 9 Apr 2014 01:47:30 +0000 (01:47 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 9 Apr 2014 01:47:30 +0000 (01:47 +0000)
forester/java/src/org/forester/analysis/TaxonomyDataManager.java
forester/java/src/org/forester/archaeopteryx/UrlTreeReader.java
forester/java/src/org/forester/archaeopteryx/webservices/WebserviceUtil.java
forester/java/src/org/forester/io/parsers/util/ParserUtils.java
forester/java/src/org/forester/test/Test.java

index ad9ee25..4e88a61 100644 (file)
@@ -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;
     }
 
index caf9ad8..1779119 100644 (file)
@@ -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
index ea6ff4f..ce35430 100644 (file)
@@ -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
index 6ad78db..c10efb7 100644 (file)
@@ -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
index c7c8641..c347106 100644 (file)
@@ -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 );