JAL-3881 split on any nonalphanumeric symbol (plus _) to generate putative sequence...
authorJim Procter <j.procter@dundee.ac.uk>
Wed, 29 Sep 2021 14:32:09 +0000 (15:32 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Wed, 29 Sep 2021 14:32:09 +0000 (15:32 +0100)
src/jalview/ws/DBRefFetcher.java

index 9420465..67b44d7 100644 (file)
@@ -31,6 +31,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
 import java.util.Vector;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import jalview.analysis.AlignSeq;
 import jalview.api.FeatureSettingsModelI;
@@ -404,12 +406,14 @@ public class DBRefFetcher implements Runnable
             }
             else
             {
+              Pattern possibleIds = Pattern.compile("[A-Za-z0-9_]+"); 
               // generate queries from sequence ID string
-              StringTokenizer st = new StringTokenizer(sequence.getName(),
-                      "|");
-              while (st.hasMoreTokens())
+              Matcher tokens = possibleIds.matcher(sequence.getName());
+              int p=0;
+              while (tokens.find(p))
               {
-                String token = st.nextToken();
+                String token = tokens.group();
+                p = tokens.end();
                 UPEntry[] presp = null;
                 if (picrClient != null)
                 {