JAL-1588 first working (?) restore of Chimera session incl bindings
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 23 Jan 2015 16:49:19 +0000 (16:49 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 23 Jan 2015 16:49:19 +0000 (16:49 +0000)
src/jalview/gui/Jalview2XML.java

index 563429f..bb4ef8b 100644 (file)
@@ -3233,10 +3233,35 @@ public class Jalview2XML
   {
     final ViewerData data = viewerData.getValue();
     String chimeraSession = data.stateData;
+    List<String> pdbfilenames = new ArrayList<String>();
+    List<SequenceI[]> seqmaps = new ArrayList<SequenceI[]>();
+    List<String> pdbids = new ArrayList<String>();
+
     if (new File(chimeraSession).exists())
     {
+      Set<Entry<File, Object[]>> fileData = data.fileData.entrySet();
+      List<PDBEntry> pdbs = new ArrayList<PDBEntry>();
+      List<SequenceI[]> allseqs = new ArrayList<SequenceI[]>();
+      for (Entry<File, Object[]> pdb : fileData)
+      {
+        String filePath = (String) pdb.getValue()[0];
+        String pdbId = (String) pdb.getValue()[1];
+        final Vector seqList = (Vector) pdb.getValue()[2];
+        PDBEntry pdbentry = new PDBEntry();
+        pdbentry.setFile(filePath);
+        pdbentry.setId(pdbId);
+        pdbs.add(pdbentry);
+        SequenceI[] seqs = new SequenceI[seqList.size()];
+        seqList.copyInto(seqs);
+        allseqs.add(seqs);
+      }
+
       // TODO can/should this be done via StructureViewer (like Jmol)?
-      ChimeraViewFrame cvf = new ChimeraViewFrame(data, af);
+      final PDBEntry[] pdbArray = pdbs.toArray(new PDBEntry[pdbs
+              .size()]);
+      final SequenceI[][] seqsArray = allseqs.toArray(new SequenceI[allseqs.size()][]);
+      ChimeraViewFrame cvf = // new ChimeraViewFrame(data, af);
+      new ChimeraViewFrame(af.alignPanel, pdbArray, seqsArray);
     }
     else
     {