JAL-1432 updated copyright notices
[jalview.git] / src / jalview / ws / dbsources / EmblSource.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10  *  
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  * The Jalview Authors are detailed in the 'AUTHORS' file.
18  */
19 package jalview.ws.dbsources;
20
21 import com.stevesoft.pat.Regex;
22
23 import jalview.datamodel.AlignmentI;
24 import jalview.datamodel.DBRefSource;
25 import jalview.ws.seqfetcher.DbSourceProxy;
26
27 /**
28  * @author JimP
29  * 
30  */
31 public class EmblSource extends EmblXmlSource implements DbSourceProxy
32 {
33
34   public EmblSource()
35   {
36     addDbSourceProperty(DBRefSource.DNASEQDB);
37     addDbSourceProperty(DBRefSource.CODINGSEQDB);
38   }
39
40   /*
41    * (non-Javadoc)
42    * 
43    * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
44    */
45   public String getAccessionSeparator()
46   {
47     // TODO Auto-generated method stub
48     return null;
49   }
50
51   /*
52    * (non-Javadoc)
53    * 
54    * @see jalview.ws.DbSourceProxy#getAccessionValidator()
55    */
56   public Regex getAccessionValidator()
57   {
58     return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+");
59   }
60
61   /*
62    * (non-Javadoc)
63    * 
64    * @see jalview.ws.DbSourceProxy#getDbSource()
65    */
66   public String getDbSource()
67   {
68     return DBRefSource.EMBL;
69   }
70
71   /*
72    * (non-Javadoc)
73    * 
74    * @see jalview.ws.DbSourceProxy#getDbVersion()
75    */
76   public String getDbVersion()
77   {
78     // TODO Auto-generated method stub
79     return "0";
80   }
81
82   /*
83    * (non-Javadoc)
84    * 
85    * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
86    */
87   public AlignmentI getSequenceRecords(String queries) throws Exception
88   {
89     return getEmblSequenceRecords(DBRefSource.EMBL, queries);
90   }
91
92   /*
93    * (non-Javadoc)
94    * 
95    * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
96    */
97   public boolean isValidReference(String accession)
98   {
99     // most embl refs look like ..
100
101     return (accession == null || accession.length() < 2) ? false
102             : getAccessionValidator().search(accession);
103
104   }
105
106   /**
107    * return LHD_CHICK coding gene
108    */
109   public String getTestQuery()
110   {
111     return "X53828";
112   }
113
114   public String getDbName()
115   {
116     return "EMBL"; // getDbSource();
117   }
118
119   @Override
120   public int getTier()
121   {
122     return 0;
123   }
124 }