From d7bdcee2035d5aee9bec9f8b5e5230dbab6f1c45 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 18 Feb 2011 17:18:25 +0000 Subject: [PATCH] bugfixing for JAL-778 --- src/jalview/gui/Jalview2XML.java | 53 +++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index a93e84c..1fe6bf4 100755 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -580,7 +580,6 @@ public class Jalview2XML { if (frames[f] instanceof AppJmol) { - // TODO: revise schema to allow many:one PDB id binding to viewer jmol = (AppJmol) frames[f]; for (int peid = 0; peid < jmol.jmb.pdbentry.length; peid++) { @@ -621,6 +620,9 @@ public class Jalview2XML state.setWidth(jmol.getWidth()); state.setHeight(jmol.getHeight()); state.setViewId(jmol.getViewId()); + state.setAlignwithAlignPanel(jmol.isUsedforaligment(ap)); + state.setColourwithAlignPanel(jmol + .isUsedforcolourby(ap)); if (!jmolViewIds.contains(state.getViewId())) { // Make sure we only store a Jmol state once in each XML @@ -2498,14 +2500,33 @@ public class Jalview2XML if (!jmolViewIds.containsKey(sviewid)) { jmolViewIds.put(sviewid, new Object[] - { new int[] - { x, y, width, height }, "", - new Hashtable() }); + { + new int[] + { x, y, width, height }, + "", + new Hashtable(), + new boolean[] + { + false,false} }); + // Legacy->2.7 conversion: if there is no attribute for + // colouring with the alignPanel then by default we set the + // first encountered view to be the default source of colour + // information. } // TODO: assemble String[] { pdb files }, String[] { id for each // file }, orig_fileloc, SequenceI[][] {{ seqs_file 1 }, { - // seqs_file 2}} from hash + // seqs_file 2}, boolean[] { + // linkAlignPanel,superposeWithAlignpanel}} from hash Object[] jmoldat = (Object[]) jmolViewIds.get(sviewid); + ((boolean[]) jmoldat[3])[0] |= ids[p].getStructureState(s) + .hasAlignwithAlignPanel() ? ids[p].getStructureState( + s).getAlignwithAlignPanel() : false; + // always colour by linked panel if not specified + ((boolean[]) jmoldat[3])[1] |= ids[p].getStructureState(s) + .hasColourwithAlignPanel() ? ids[p] + .getStructureState(s).getColourwithAlignPanel() + : false; + if (((String) jmoldat[1]).length() < ids[p] .getStructureState(s).getContent().length()) { @@ -2544,7 +2565,7 @@ public class Jalview2XML int[] geom = (int[]) svattrib[0]; String state = (String) svattrib[1]; Hashtable oldFiles = (Hashtable) svattrib[2]; - + final boolean useinJmolsuperpos = ((boolean[]) svattrib[3])[0], usetoColourbyseq = ((boolean[]) svattrib[3])[1]; int x = geom[0], y = geom[1], width = geom[2], height = geom[3]; // collate the pdbfile -> sequence mappings from this view Vector pdbfilenames = new Vector(); @@ -2700,8 +2721,8 @@ public class Jalview2XML try { sview = new AppJmol(pdbf, id, sq, alf.alignPanel, + useinJmolsuperpos, usetoColourbyseq, fileloc, - rect, vid); } catch (OutOfMemoryError ex) { @@ -2748,6 +2769,24 @@ public class Jalview2XML jalview.io.AppletFormatAdapter.FILE); ((AppJmol) comp).jmb.addSequenceForStructFile(pdbFile, seq); } + // and add the AlignmentPanel's reference to the Jmol view + ((AppJmol) comp).addAlignmentPanel(ap); + if (useinJmolsuperpos) + { + ((AppJmol) comp).useAlignmentPanelForSuperposition(ap); + } + else + { + ((AppJmol) comp).excludeAlignmentPanelForSuperposition(ap); + } + if (usetoColourbyseq) + { + ((AppJmol) comp).useAlignmentPanelForColourbyseq(ap); + } + else + { + ((AppJmol) comp).excludeAlignmentPanelForColourbyseq(ap); + } } } } -- 1.7.10.2