X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2FEmblCdsSouce.java;h=2683ba46480f7d0ea2053536bbf9d0c77eda04b4;hb=a789f790fbb3ab13f1967b42781b837b58bf9bbc;hp=65b4e21b5d0a1a6e1d7d651b7ce6ec291d9aa4e5;hpb=08fbe7c3d40a4077ab519334952a079968c07cd1;p=jalview.git diff --git a/src/jalview/ws/dbsources/EmblCdsSouce.java b/src/jalview/ws/dbsources/EmblCdsSouce.java index 65b4e21..2683ba4 100644 --- a/src/jalview/ws/dbsources/EmblCdsSouce.java +++ b/src/jalview/ws/dbsources/EmblCdsSouce.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) + * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.ws.dbsources; import java.util.Hashtable; @@ -11,20 +28,20 @@ import jalview.ws.seqfetcher.DbSourceProxy; public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy { - public EmblCdsSouce() { + public EmblCdsSouce() + { super(); - addDbSourceProperty(DBRefSource.CODINGSEQDB); + addDbSourceProperty(DBRefSource.CODINGSEQDB); } - + public String getAccessionSeparator() { - return null; + return null; } public Regex getAccessionValidator() { - // TODO Auto-generated method stub - return null; + return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+"); } public String getDbSource() @@ -34,12 +51,13 @@ public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy public String getDbVersion() { - return "0"; // TODO : this is dynamically set for a returned record - not tied to proxy + return "0"; // TODO : this is dynamically set for a returned record - not + // tied to proxy } public AlignmentI getSequenceRecords(String queries) throws Exception - { - if (queries.indexOf(".")>-1) + { + if (queries.indexOf(".") > -1) { queries = queries.substring(0, queries.indexOf(".")); } @@ -48,9 +66,12 @@ public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy public boolean isValidReference(String accession) { - // TODO Auto-generated method stub - return true; + // most embl CDS refs look like .. + // TODO: improve EMBLCDS regex + return (accession == null || accession.length() < 2) ? false + : getAccessionValidator().search(accession); } + /** * cDNA for LDHA_CHICK swissprot sequence */ @@ -58,6 +79,7 @@ public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy { return "CAA37824"; } + public String getDbName() { return "EMBL (CDS)";