X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2FPdb.java;h=e6d46da5eb51900857bb29c61a6781d49bfe683b;hb=3d1147ffae5fbc5bdb7c80caa9655df656b8e67b;hp=07df2c4512dfd12ca6680cd27bec416f70a39684;hpb=fefbeb6a7ff8cdce3580749e016bf7980e76679c;p=jalview.git diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index 07df2c4..e6d46da 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -21,9 +21,9 @@ import com.stevesoft.pat.Regex; import jalview.datamodel.AlignmentI; import jalview.io.FileParse; -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 @@ -50,7 +50,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy */ public Regex getAccessionValidator() { - return new Regex("[1-9][0-9A-Za-z]{3}[ _A-Za-z0-9]?"); + return new Regex("([1-9][0-9A-Za-z]{3}):?([ _A-Za-z0-9]?)"); } /* (non-Javadoc) @@ -88,9 +88,15 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy } if (queries.length() > 4 && chain == null) { - chain = queries.substring(4); + chain = queries.substring(4,5); id = queries.substring(0, 4); } + if (!isValidReference(id)) + { + System.err.println("Ignoring invalid pdb query: '"+id+"'"); + stopQuery(); + return null; + } EBIFetchClient ebi = new EBIFetchClient(); file = ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw") .getAbsolutePath(); @@ -143,7 +149,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy if (result.size() < 1) { throw new Exception("No PDB Records for " + id + " chain " - + ((chain == null) ? " " : chain)); + + ((chain == null) ? "' '" : chain)); } } catch (Exception ex) // Problem parsing PDB file { @@ -177,4 +183,9 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy return "1QIPA"; } + public String getDbName() + { + return "PDB"; // getDbSource(); + } + }