+ /**
+ * Constructor given a session file to be restored
+ *
+ * @param sessionFile
+ * @param alignPanel
+ * @param pdbArray
+ * @param seqsArray
+ * @param colourByPymol
+ * @param colourBySequence
+ * @param newViewId
+ */
+ public PymolViewer(StructureViewerModel viewerModel,
+ AlignmentPanel alignPanel, String sessionFile, String vid)
+ {
+ // TODO convert to base/factory class method
+ this();
+ setViewId(vid);
+ this.pymolSessionFile = sessionFile;
+ Map<File, StructureData> pdbData = viewerModel.getFileData();
+ PDBEntry[] pdbArray = new PDBEntry[pdbData.size()];
+ SequenceI[][] seqsArray = new SequenceI[pdbData.size()][];
+ int i = 0;
+ for (StructureData data : pdbData.values())
+ {
+ PDBEntry pdbentry = new PDBEntry(data.getPdbId(), null,
+ PDBEntry.Type.PDB, data.getFilePath());
+ pdbArray[i] = pdbentry;
+ List<SequenceI> sequencesForPdb = data.getSeqList();
+ seqsArray[i] = sequencesForPdb
+ .toArray(new SequenceI[sequencesForPdb.size()]);
+ i++;
+ }
+
+ openNewPymol(alignPanel, pdbArray, seqsArray);
+ if (viewerModel.isColourByViewer())
+ {
+ binding.setColourBySequence(false);
+ seqColour.setSelected(false);
+ viewerColour.setSelected(true);
+ }
+ else if (viewerModel.isColourWithAlignPanel())
+ {
+ binding.setColourBySequence(true);
+ seqColour.setSelected(true);
+ viewerColour.setSelected(false);
+ }
+ }
+