X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2FEmblSource.java;h=9573f72e3ad2e05da0b92cbe2b4441cc4646897f;hb=a45774ee31d9f35d4eff46d54d7deab719afb092;hp=57818a00ee4f2c3ab7e984404a8a7949a09609ce;hpb=5d88ae6bbf1ea113cefcb43b7918b5baf560a76e;p=jalview.git diff --git a/src/jalview/ws/dbsources/EmblSource.java b/src/jalview/ws/dbsources/EmblSource.java index 57818a0..9573f72 100644 --- a/src/jalview/ws/dbsources/EmblSource.java +++ b/src/jalview/ws/dbsources/EmblSource.java @@ -1,5 +1,19 @@ -/** +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 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; @@ -15,23 +29,26 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefSource; import jalview.datamodel.SequenceI; import jalview.datamodel.xdb.embl.EmblEntry; -import jalview.ws.DbSourceProxy; -import jalview.ws.DbSourceProxyImpl; -import jalview.ws.EBIFetchClient; +import jalview.ws.ebi.EBIFetchClient; +import jalview.ws.seqfetcher.DbSourceProxy; +import jalview.ws.seqfetcher.DbSourceProxyImpl; /** * @author JimP - * + * */ public class EmblSource extends EmblXmlSource implements DbSourceProxy { - public EmblSource() { + public EmblSource() + { addDbSourceProperty(DBRefSource.DNASEQDB); addDbSourceProperty(DBRefSource.CODINGSEQDB); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#getAccessionSeparator() */ public String getAccessionSeparator() @@ -40,23 +57,29 @@ public class EmblSource extends EmblXmlSource implements DbSourceProxy return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#getAccessionValidator() */ public Regex getAccessionValidator() { - // TODO Auto-generated method stub - return null; + return new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+"); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#getDbSource() */ public String getDbSource() { return DBRefSource.EMBL; } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#getDbVersion() */ public String getDbVersion() @@ -65,28 +88,40 @@ public class EmblSource extends EmblXmlSource implements DbSourceProxy return "0"; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[]) */ public AlignmentI getSequenceRecords(String queries) throws Exception { return getEmblSequenceRecords(DBRefSource.EMBL, queries); } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String) */ public boolean isValidReference(String accession) { - // TODO Auto-generated method stub - return false; + // most embl refs look like .. + + return (accession == null || accession.length() < 2) ? false + : getAccessionValidator().search(accession); + } /** - * return LHD_CHICK coding gene + * return LHD_CHICK coding gene */ public String getTestQuery() { return "X53828"; } + public String getDbName() + { + return "EMBL"; // getDbSource(); + } }