update author list in license for (JAL-826)
[jalview.git] / src / jalview / ws / dbsources / EmblCdsSouce.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
3  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
4  * \r
5  * This file is part of Jalview.\r
6  * \r
7  * Jalview is free software: you can redistribute it and/or\r
8  * modify it under the terms of the GNU General Public License \r
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
10  * \r
11  * Jalview is distributed in the hope that it will be useful, but \r
12  * WITHOUT ANY WARRANTY; without even the implied warranty \r
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
14  * PURPOSE.  See the GNU General Public License for more details.\r
15  * \r
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
17  */\r
18 package jalview.ws.dbsources;\r
19 \r
20 import java.util.Hashtable;\r
21 \r
22 import com.stevesoft.pat.Regex;\r
23 \r
24 import jalview.datamodel.AlignmentI;\r
25 import jalview.datamodel.DBRefSource;\r
26 import jalview.ws.seqfetcher.DbSourceProxy;\r
27 \r
28 public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy\r
29 {\r
30 \r
31   public EmblCdsSouce()\r
32   {\r
33     super();\r
34     addDbSourceProperty(DBRefSource.CODINGSEQDB);\r
35   }\r
36 \r
37   public String getAccessionSeparator()\r
38   {\r
39     return null;\r
40   }\r
41 \r
42   public Regex getAccessionValidator()\r
43   {\r
44     return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+");\r
45   }\r
46 \r
47   public String getDbSource()\r
48   {\r
49     return DBRefSource.EMBLCDS;\r
50   }\r
51 \r
52   public String getDbVersion()\r
53   {\r
54     return "0"; // TODO : this is dynamically set for a returned record - not\r
55     // tied to proxy\r
56   }\r
57 \r
58   public AlignmentI getSequenceRecords(String queries) throws Exception\r
59   {\r
60     if (queries.indexOf(".") > -1)\r
61     {\r
62       queries = queries.substring(0, queries.indexOf("."));\r
63     }\r
64     return getEmblSequenceRecords(DBRefSource.EMBLCDS, queries);\r
65   }\r
66 \r
67   public boolean isValidReference(String accession)\r
68   {\r
69     // most embl CDS refs look like ..\r
70     // TODO: improve EMBLCDS regex\r
71     return (accession == null || accession.length() < 2) ? false\r
72             : getAccessionValidator().search(accession);\r
73   }\r
74 \r
75   /**\r
76    * cDNA for LDHA_CHICK swissprot sequence\r
77    */\r
78   public String getTestQuery()\r
79   {\r
80     return "CAA37824";\r
81   }\r
82 \r
83   public String getDbName()\r
84   {\r
85     return "EMBL (CDS)";\r
86   }\r
87 \r
88 }\r