From 18099e521fde283ebe0f03491876c686333adf81 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 4 Nov 2008 13:29:50 +0000 Subject: [PATCH] implemented embl validation properly --- src/jalview/ws/dbsources/EmblCdsSouce.java | 6 ++++-- src/jalview/ws/dbsources/EmblSource.java | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) 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); + } /** -- 1.7.10.2