X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2FPdb.java;h=ae1f7941b7431d3fa2b78bfe5f4d4c1df2e76bf4;hb=153dd62dc91da13ae732600e6ea55ddbe15eab39;hp=e6d46da5eb51900857bb29c61a6781d49bfe683b;hpb=54e003f9b2fff47dbfea6401c3944afdb7bd37b3;p=jalview.git diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index e6d46da..ae1f794 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -1,5 +1,19 @@ -/** +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) + * Copyright (C) 2010 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; @@ -27,16 +41,19 @@ import jalview.ws.seqfetcher.DbSourceProxyImpl; /** * @author JimP - * + * */ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy { - public Pdb() { + public Pdb() + { super(); addDbSourceProperty(DBRefSource.PROTSEQDB); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#getAccessionSeparator() */ public String getAccessionSeparator() @@ -45,7 +62,9 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy return null; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#getAccessionValidator() */ public Regex getAccessionValidator() @@ -53,7 +72,9 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy return new Regex("([1-9][0-9A-Za-z]{3}):?([ _A-Za-z0-9]?)"); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#getDbSource() */ public String getDbSource() @@ -61,14 +82,19 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy return DBRefSource.PDB; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#getDbVersion() */ public String getDbVersion() { return "0"; } - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#getSequenceRecords(java.lang.String[]) */ public AlignmentI getSequenceRecords(String queries) throws Exception @@ -88,18 +114,17 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy } if (queries.length() > 4 && chain == null) { - chain = queries.substring(4,5); + chain = queries.substring(4, 5); id = queries.substring(0, 4); } if (!isValidReference(id)) { - System.err.println("Ignoring invalid pdb query: '"+id+"'"); + System.err.println("Ignoring invalid pdb query: '" + id + "'"); stopQuery(); return null; } EBIFetchClient ebi = new EBIFetchClient(); - file = ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw") - .getAbsolutePath(); + file = ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw").getAbsolutePath(); stopQuery(); if (file == null) { @@ -107,7 +132,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy } try { - + PDBfile pdbfile = new PDBfile(file, jalview.io.AppletFormatAdapter.FILE); for (int i = 0; i < pdbfile.chains.size(); i++) @@ -117,27 +142,27 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy .toUpperCase().equals(chain)) { PDBChain pdbchain = (PDBChain) pdbfile.chains.elementAt(i); - // Get the Chain's Sequence - who's dataset includes any special features added from the PDB file + // 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(jalview.datamodel.DBRefSource.PDB+"|" + id + "|" + sq.getName()); + // Specially formatted name for the PDB chain sequences retrieved from + // the PDB + sq.setName(jalview.datamodel.DBRefSource.PDB + "|" + id + "|" + + sq.getName()); // Might need to add more metadata to the PDBEntry object // like below /* - * PDBEntry entry = new PDBEntry(); - // Construct the PDBEntry - entry.setId(id); - if (entry.getProperty() == null) - entry.setProperty(new Hashtable()); - entry.getProperty().put("chains", - pdbchain.id - + "=" + sq.getStart() - + "-" + sq.getEnd()); - sq.getDatasetSequence().addPDBId(entry); + * PDBEntry entry = new PDBEntry(); // Construct the PDBEntry + * entry.setId(id); if (entry.getProperty() == null) + * entry.setProperty(new Hashtable()); + * entry.getProperty().put("chains", pdbchain.id + "=" + sq.getStart() + * + "-" + sq.getEnd()); sq.getDatasetSequence().addPDBId(entry); */ // Add PDB DB Refs - // We make a DBRefEtntry because we have obtained the PDB file from a verifiable source - // JBPNote - PDB DBRefEntry should also carry the chain and mapping information + // We make a DBRefEtntry because we have obtained the PDB file from a + // verifiable source + // JBPNote - PDB DBRefEntry should also carry the chain and mapping + // information DBRefEntry dbentry = new DBRefEntry(getDbSource(), getDbVersion(), id + pdbchain.id); sq.addDBRef(dbentry); @@ -166,7 +191,9 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy return new Alignment(results); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String) */ public boolean isValidReference(String accession)