apply gpl development license
[jalview.git] / src / jalview / ws / dbsources / EmblSource.java
index 5ae7a72..ac4a988 100644 (file)
@@ -1,5 +1,20 @@
-/**\r
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)\r
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * \r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * \r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
  * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
  */\r
 package jalview.ws.dbsources;\r
 \r
@@ -21,17 +36,20 @@ import jalview.ws.seqfetcher.DbSourceProxyImpl;
 \r
 /**\r
  * @author JimP\r
- *\r
+ * \r
  */\r
 public class EmblSource extends EmblXmlSource implements DbSourceProxy\r
 {\r
 \r
-  public EmblSource() {\r
+  public EmblSource()\r
+  {\r
     addDbSourceProperty(DBRefSource.DNASEQDB);\r
     addDbSourceProperty(DBRefSource.CODINGSEQDB);\r
   }\r
-  \r
-  /* (non-Javadoc)\r
+\r
+  /*\r
+   * (non-Javadoc)\r
+   * \r
    * @see jalview.ws.DbSourceProxy#getAccessionSeparator()\r
    */\r
   public String getAccessionSeparator()\r
@@ -40,7 +58,9 @@ public class EmblSource extends EmblXmlSource implements DbSourceProxy
     return null;\r
   }\r
 \r
-  /* (non-Javadoc)\r
+  /*\r
+   * (non-Javadoc)\r
+   * \r
    * @see jalview.ws.DbSourceProxy#getAccessionValidator()\r
    */\r
   public Regex getAccessionValidator()\r
@@ -49,14 +69,19 @@ public class EmblSource extends EmblXmlSource implements DbSourceProxy
     return null;\r
   }\r
 \r
-  /* (non-Javadoc)\r
+  /*\r
+   * (non-Javadoc)\r
+   * \r
    * @see jalview.ws.DbSourceProxy#getDbSource()\r
    */\r
   public String getDbSource()\r
   {\r
     return DBRefSource.EMBL;\r
   }\r
-  /* (non-Javadoc)\r
+\r
+  /*\r
+   * (non-Javadoc)\r
+   * \r
    * @see jalview.ws.DbSourceProxy#getDbVersion()\r
    */\r
   public String getDbVersion()\r
@@ -65,28 +90,39 @@ public class EmblSource extends EmblXmlSource implements DbSourceProxy
     return "0";\r
   }\r
 \r
-  /* (non-Javadoc)\r
+  /*\r
+   * (non-Javadoc)\r
+   * \r
    * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[])\r
    */\r
   public AlignmentI getSequenceRecords(String queries) throws Exception\r
   {\r
     return getEmblSequenceRecords(DBRefSource.EMBL, queries);\r
   }\r
-  /* (non-Javadoc)\r
+  \r
+  /*\r
+   * (non-Javadoc)\r
+   * \r
    * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)\r
    */\r
   public boolean isValidReference(String accession)\r
   {\r
-    // TODO Auto-generated method stub\r
-    return false;\r
+    // most embl refs look like ..\r
+    \r
+    return (accession==null || accession.length()<2) ? false : new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+$").search(accession);\r
+    \r
   }\r
 \r
   /**\r
-   * return LHD_CHICK coding gene \r
+   * return LHD_CHICK coding gene\r
    */\r
   public String getTestQuery()\r
   {\r
     return "X53828";\r
   }\r
 \r
+  public String getDbName()\r
+  {\r
+    return "EMBL"; // getDbSource();\r
+  }\r
 }\r