JAL-1500 JAL-1265 patch to parse PDB database refs in PFAM stockholm
authorJim Procter <j.procter@dundee.ac.uk>
Mon, 6 Oct 2014 14:51:25 +0000 (15:51 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Mon, 6 Oct 2014 15:17:26 +0000 (16:17 +0100)
src/jalview/util/DBRefUtils.java

index d6965f5..4cc888d 100755 (executable)
@@ -418,11 +418,15 @@ public class DBRefUtils
         // check for chaincode and mapping
         // PFAM style stockhom PDB citation
         com.stevesoft.pat.Regex r = new com.stevesoft.pat.Regex(
-                "([0-9][0-9A-Za-z]{3})\\s*(.?)\\s*;([0-9]+)-([0-9]+)");
+                "([0-9][0-9A-Za-z]{3})\\s*(.?)\\s*;\\s*([0-9]+)-([0-9]+)");
         if (r.search(acn.trim()))
         {
           String pdbid = r.stringMatched(1);
           String chaincode = r.stringMatched(2);
+          if (chaincode==null)
+          {
+            chaincode = " ";
+          }
           String mapstart = r.stringMatched(3);
           String mapend = r.stringMatched(4);
           if (chaincode.equals(" "))
@@ -433,8 +437,11 @@ public class DBRefUtils
           ref = new DBRefEntry(locsrc, version, pdbid + chaincode);
           PDBEntry pdbr = new PDBEntry();
           pdbr.setId(pdbid);
+          pdbr.setProperty(new Hashtable());
           pdbr.getProperty().put("CHAIN", chaincode);
           seq.addPDBId(pdbr);
+        } else {
+          System.err.println("Malformed PDB DR line:"+acn);
         }
       }
       else