From: Jim Procter Date: Fri, 31 Oct 2014 16:14:27 +0000 (+0000) Subject: JAL-674 JAL-961 pass row reference to handler to check calcId and any specific proper... X-Git-Tag: Jalview_2_9~155^2~15^2~9 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c4f290671231c0bf33aedceffde3354c24fc1dad;p=jalview.git JAL-674 JAL-961 pass row reference to handler to check calcId and any specific properties (e.g. originating PDB ID for the row data) --- diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index 11e7188..b22eb29 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -273,19 +273,19 @@ public class PDBfile extends jalview.io.AlignFile markCalcIds(); } - private static String calcIdPrefix = "JalviewPDB:"; + private static String calcIdPrefix = "JalviewPDB"; public static boolean isCalcIdHandled(String calcId) { return calcId != null - && (calcId.startsWith(calcIdPrefix) && calcId.indexOf( - calcIdPrefix, - calcIdPrefix.length() + 1) > -1); + && (calcIdPrefix.equals(calcId)); } - public static boolean isCalcIdForFile(String calcId, String pdbFile) + + public static boolean isCalcIdForFile(AlignmentAnnotation alan, String pdbFile) { - return (calcId != null && calcId.startsWith(calcIdPrefix + pdbFile - + ":" + calcIdPrefix)); + return alan.getCalcId() != null + && calcIdPrefix.equals(alan.getCalcId()) + && pdbFile.equals(alan.getProperty("PDBID")); } public static String relocateCalcId(String calcId, @@ -308,7 +308,9 @@ public class PDBfile extends jalview.io.AlignFile { oldId = ""; } - aa.setCalcId("JalviewPDB:" + id + ":JalviewPDB:" + oldId); + aa.setCalcId(calcIdPrefix); + aa.setProperty("PDBID", id); + aa.setProperty("oldCalcId", oldId); } } } diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 9396be1..7a1b100 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -260,11 +260,10 @@ public class StructureSelectionManager { for (AlignmentAnnotation ala : ds.getAnnotation()) { - // false if any annotation present from this structure // JBPNote this fails for jmol/chimera view because the *file* is // passed, not the structure data ID - - if (MCview.PDBfile.isCalcIdForFile(ala.getCalcId(), + if (MCview.PDBfile.isCalcIdForFile(ala, findIdForPDBFile(pdbFile))) { parseSecStr = false; diff --git a/test/jalview/io/AnnotatedPDBFileInputTest.java b/test/jalview/io/AnnotatedPDBFileInputTest.java index 7e99409..7bef5db 100644 --- a/test/jalview/io/AnnotatedPDBFileInputTest.java +++ b/test/jalview/io/AnnotatedPDBFileInputTest.java @@ -68,7 +68,7 @@ public class AnnotatedPDBFileInputTest { System.out.println("CalcId: " + aa.getCalcId()); - assertTrue(MCview.PDBfile.isCalcIdForFile(aa.getCalcId(), pdbId)); + assertTrue(MCview.PDBfile.isCalcIdForFile(aa, pdbId)); } } } @@ -160,7 +160,7 @@ public class AnnotatedPDBFileInputTest && MCview.PDBfile.isCalcIdHandled(ana.getCalcId())) { exists = true; - if (MCview.PDBfile.isCalcIdForFile(ana.getCalcId(), + if (MCview.PDBfile.isCalcIdForFile(ana, pdbentry.getId())) { found = true;