X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fws%2Fseqfetcher%2FDbSourceProxyImpl.java;h=ab4644ebff4bd86d859020784d4447e4e15017c9;hb=3d0101179759ef157b088ea135423cd909512d9f;hp=1e1468fefdcc76e28d74d77f8e4f35290aa3e989;hpb=409fd993c6e32e999b24082aae107a043a590f8f;p=jalview.git diff --git a/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java b/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java index 1e1468f..ab4644e 100644 --- a/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java +++ b/src/jalview/ws/seqfetcher/DbSourceProxyImpl.java @@ -20,12 +20,13 @@ */ package jalview.ws.seqfetcher; +import jalview.api.FeatureSettingsModelI; import jalview.datamodel.AlignmentI; +import jalview.io.DataSourceType; +import jalview.io.FileFormatI; import jalview.io.FormatAdapter; import jalview.io.IdentifyFile; -import com.stevesoft.pat.Regex; - /** * common methods for implementations of the DbSourceProxy interface. * @@ -93,32 +94,30 @@ public abstract class DbSourceProxyImpl implements DbSourceProxy protected AlignmentI parseResult(String result) throws Exception { AlignmentI sequences = null; - String format = new IdentifyFile().identify(result, "Paste"); - if (FormatAdapter.isValidFormat(format)) + FileFormatI format = new IdentifyFile().identify(result, + DataSourceType.PASTE); + if (format != null) { - sequences = new FormatAdapter().readFile(result.toString(), "Paste", - format); + sequences = new FormatAdapter().readFile(result.toString(), + DataSourceType.PASTE, format); } return sequences; } + /** + * Returns the first accession id in the query (up to the first accession id + * separator), or the whole query if there is no separator or it is not found + */ @Override public String getAccessionIdFromQuery(String query) { - Regex vgr = getAccessionValidator(); - if (vgr == null) + String sep = getAccessionSeparator(); + if (sep == null) { return query; } - vgr.search(query); - if (vgr.numSubs() > 0) - { - return (vgr.stringMatched(1)); - } - else - { - return (vgr.stringMatched()); - } + int sepPos = query.indexOf(sep); + return sepPos == -1 ? query : query.substring(0, sepPos); } /** @@ -147,4 +146,16 @@ public abstract class DbSourceProxyImpl implements DbSourceProxy { return false; } + + @Override + public String getDescription() + { + return ""; + } + + @Override + public FeatureSettingsModelI getFeatureColourScheme() + { + return null; + } }