From: jprocter Date: Tue, 4 Nov 2008 13:29:50 +0000 (+0000) Subject: implemented embl validation properly X-Git-Tag: Jalview_2_4_0b2~45 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=18099e521fde283ebe0f03491876c686333adf81;p=jalview.git implemented embl validation properly --- diff --git a/src/jalview/ws/dbsources/EmblCdsSouce.java b/src/jalview/ws/dbsources/EmblCdsSouce.java index 1ac5c76..0dfc924 100644 --- a/src/jalview/ws/dbsources/EmblCdsSouce.java +++ b/src/jalview/ws/dbsources/EmblCdsSouce.java @@ -68,8 +68,10 @@ public class EmblCdsSouce extends EmblXmlSource implements DbSourceProxy public boolean isValidReference(String accession) { - // TODO Auto-generated method stub - return true; + // most embl CDS refs look like .. + // TODO: improve EMBLCDS regex + return (accession==null || accession.length()<2) ? false : new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+").search(accession); + } /** diff --git a/src/jalview/ws/dbsources/EmblSource.java b/src/jalview/ws/dbsources/EmblSource.java index 5eac1c0..344182f 100644 --- a/src/jalview/ws/dbsources/EmblSource.java +++ b/src/jalview/ws/dbsources/EmblSource.java @@ -99,7 +99,7 @@ public class EmblSource extends EmblXmlSource implements DbSourceProxy { return getEmblSequenceRecords(DBRefSource.EMBL, queries); } - + /* * (non-Javadoc) * @@ -107,8 +107,10 @@ public class EmblSource extends EmblXmlSource implements DbSourceProxy */ public boolean isValidReference(String accession) { - // TODO Auto-generated method stub - return false; + // most embl refs look like .. + + return (accession==null || accession.length()<2) ? false : new com.stevesoft.pat.Regex("^[A-Z]+[0-9]+$").search(accession); + } /**