2a3d7bb831bfd7752c1bc5872dffb2d8ead18396
[jalview.git] / src / jalview / ws / dbsources / GeneDbSource.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3  * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
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  */
18 package jalview.ws.dbsources;
19
20 import java.io.File;
21 import java.util.Hashtable;
22 import java.util.Iterator;
23 import java.util.StringTokenizer;
24
25 import com.stevesoft.pat.Regex;
26
27 import jalview.datamodel.Alignment;
28 import jalview.datamodel.AlignmentI;
29 import jalview.datamodel.DBRefSource;
30 import jalview.datamodel.SequenceI;
31 import jalview.datamodel.xdb.embl.EmblEntry;
32 import jalview.ws.ebi.EBIFetchClient;
33 import jalview.ws.seqfetcher.DbSourceProxy;
34 import jalview.ws.seqfetcher.DbSourceProxyImpl;
35
36 /**
37  * Test class for accessing GeneDB - not yet finished.
38  * 
39  * @author JimP
40  * 
41  */
42 public class GeneDbSource extends EmblXmlSource implements DbSourceProxy
43 {
44
45   public GeneDbSource()
46   {
47     addDbSourceProperty(DBRefSource.DNASEQDB);
48     addDbSourceProperty(DBRefSource.CODINGSEQDB);
49   }
50
51   /*
52    * (non-Javadoc)
53    * 
54    * @see jalview.ws.DbSourceProxy#getAccessionSeparator()
55    */
56   public String getAccessionSeparator()
57   {
58     // TODO Auto-generated method stub
59     return null;
60   }
61
62   /*
63    * (non-Javadoc)
64    * 
65    * @see jalview.ws.DbSourceProxy#getAccessionValidator()
66    */
67   public Regex getAccessionValidator()
68   {
69     // TODO Auto-generated method stub
70     return null;
71   }
72
73   /*
74    * (non-Javadoc)
75    * 
76    * @see jalview.ws.DbSourceProxy#getDbSource()
77    */
78   public String getDbSource()
79   {
80     return DBRefSource.GENEDB;
81   }
82
83   /*
84    * (non-Javadoc)
85    * 
86    * @see jalview.ws.DbSourceProxy#getDbVersion()
87    */
88   public String getDbVersion()
89   {
90     // TODO Auto-generated method stub
91     return "0";
92   }
93
94   /*
95    * (non-Javadoc)
96    * 
97    * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])
98    */
99   public AlignmentI getSequenceRecords(String queries) throws Exception
100   {
101     // query of form
102     // http://www.genedb.org/genedb/ArtemisFormHandler?id=&dest=EMBL
103     //
104     return getEmblSequenceRecords(DBRefSource.GENEDB, queries);
105   }
106
107   /*
108    * (non-Javadoc)
109    * 
110    * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
111    */
112   public boolean isValidReference(String accession)
113   {
114     // TODO Auto-generated method stub
115     return false;
116   }
117
118   /**
119    * return T.Brucei Mannosyl-Transferase TbPIG-M
120    */
121   public String getTestQuery()
122   {
123     return "Tb927.6.3300";
124   }
125
126   public String getDbName()
127   {
128     return "GeneDB"; // getDbSource();
129   }
130 }