X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2FPdb.java;h=e6d46da5eb51900857bb29c61a6781d49bfe683b;hb=3d1147ffae5fbc5bdb7c80caa9655df656b8e67b;hp=bcf26be04aa16ed8214163f0eee333d28910a94d;hpb=5d88ae6bbf1ea113cefcb43b7918b5baf560a76e;p=jalview.git diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index bcf26be..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(); @@ -114,7 +120,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy // Get the Chain's Sequence - who's dataset includes any special features added from the PDB file SequenceI sq = pdbchain.sequence; // Specially formatted name for the PDB chain sequences retrieved from the PDB - sq.setName("PDB|" + id + "|" + sq.getName()); + sq.setName(jalview.datamodel.DBRefSource.PDB+"|" + id + "|" + sq.getName()); // Might need to add more metadata to the PDBEntry object // like below /* @@ -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(); + } + }