Revision: 20782
          http://sourceforge.net/p/jmol/code/20782
Author:   hansonr
Date:     2015-09-21 02:16:07 +0000 (Mon, 21 Sep 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.3.16_2015.09.21"

bug fix: minor fixes for DSSR

bug fix: print within(0, "XXX", ...) ignores the "XXX" entirely. Should throw 
an error (Ron Mignery)
bug fix: print within(0, "vdw", ...) ignores "vdw"; should accept that as 
"vanderwaal"
bug fix: print within(-1.0, "vanderwaal", ...) ignores "vanderwaal" and does a 
fractional-coordinate calculation  

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/dssx/DSSR1.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/dssx/DSSR1.java
===================================================================
--- trunk/Jmol/src/org/jmol/dssx/DSSR1.java     2015-09-21 01:43:27 UTC (rev 
20781)
+++ trunk/Jmol/src/org/jmol/dssx/DSSR1.java     2015-09-21 02:16:07 UTC (rev 
20782)
@@ -89,7 +89,7 @@
       "..junctions.nts_long" +
       "..kissingloops.hairpins.nts_long" +
       "..multiplets.nts_long" +
-      "..nonstacks.nts_long" +
+      "..nonstack.nts_long" +
       "..nts.nt_id" +
       "..pairs.nt*" +
       "..sssegments.nts_long" +
@@ -151,57 +151,27 @@
 
   /**
    * kissingLoops and coaxStacks use index arrays instead of duplication;
-   * hbonds need nt_ids residue unitIDs as well
    * 
    * @param map
    * @return msg
    */
-  @SuppressWarnings("unchecked")
   @Override
   public String fixDSSRJSONMap(Map<String, Object> map) {
     String s = "";
+    
     try {
-      Lst<Object>lst = (Lst<Object>) map.get("kissingLoops");
-      if (lst != null) {
-        Lst<Object>  hpins = (Lst<Object>) map.get("hairpins");
-        for (int i = lst.size(); --i >= 0;) {
-          Map<String, Object> kmap = (Map<String, Object>) lst.get(i);
-          Lst<Object> khlist = (Lst<Object>) kmap.get("hairpin_indices");
-          int n = khlist.size();
-          if (n > 0) {
-            Lst<Object> khpins = new Lst<Object>();
-            kmap.put("hairpins", khpins);
-            for (int j = n; --j >= 0;)
-              khpins.addLast(hpins.get(((Integer) khlist.get(j)).intValue() - 
1));
-          }
-        }
-      }
+
+      fixIndices(map, "kissingLoops", "hairpin");
+      fixIndices(map, "coaxStacks", "stem");
       
-      
-      lst = (Lst<Object>) map.get("coaxStacks");
-      if (lst != null) {
-        Lst<Object>  stems = (Lst<Object>) map.get("stems");
-        for (int i = lst.size(); --i >= 0;) {
-          Map<String, Object> smap = (Map<String, Object>) lst.get(i);
-          Lst<Object> slist = (Lst<Object>) smap.get("stem_indices");
-          int n =slist.size();
-          if (n > 0) {
-            Lst<Object> spins = new Lst<Object>();
-            smap.put("stems", spins);
-            for (int j = n; --j >= 0;)
-              spins.addLast(stems.get(((Integer) slist.get(j)).intValue() - 
1));
-          }
-        }
-      }
-      
-      lst = (Lst<Object>) map.get("hbonds");
-      if (lst != null) {
-        for (int i = lst.size(); --i >= 0;) {
-          Map<String, Object> smap = (Map<String, Object>) lst.get(i);
-          smap.put("nts_long", removeUnitAtom((String) smap.get("atom1_id"))
-              + "," + removeUnitAtom((String) smap.get("atom2_id")));
-        }
-      }
+//      lst = (Lst<Object>) map.get("hbonds");
+//      if (lst != null) {
+//        for (int i = lst.size(); --i >= 0;) {
+//          Map<String, Object> smap = (Map<String, Object>) lst.get(i);
+//          smap.put("res_long", removeUnitAtom((String) smap.get("atom1_id"))
+//              + "," + removeUnitAtom((String) smap.get("atom2_id")));
+//        }
+//      }
 
       if (map.containsKey("counts"))
         s += "_M.dssr.counts = " + map.get("counts").toString() + "\n";
@@ -214,24 +184,52 @@
     return s;
   }
 
-  private static String removeUnitAtom(String unitID) {
-    int pt1 = 0;
-    int pt2 = unitID.length();
-    for (int i = 0, pt = -1; i < 7 && (pt = unitID.indexOf("|", pt + 1)) >= 
0;i++) {
-      switch (i) {
-      case 4:
-        pt1 = pt + 1;
-        break;
-      case 6:
-        pt2 = pt;
-        break;
+  /**
+   * create a key/value pair root+"s" for all indices of root+"_indices"
+   * @param map
+   * @param key
+   * @param root
+   */
+  @SuppressWarnings("unchecked")
+  private void fixIndices(Map<String, Object> map, String key,
+                          String root) {
+    String indices = root + "_indices";
+    String original = root + "s";
+    Lst<Object>lst = (Lst<Object>) map.get(key);
+    if (lst != null) {
+      Lst<Object>  hpins = (Lst<Object>) map.get(original);
+      for (int i = lst.size(); --i >= 0;) {
+        Map<String, Object> kmap = (Map<String, Object>) lst.get(i);
+        Lst<Object> khlist = (Lst<Object>) kmap.get(indices);
+        int n = khlist.size();
+        if (n > 0) {
+          Lst<Object> khpins = new Lst<Object>();
+          kmap.put(original, khpins);
+          for (int j = n; --j >= 0;)
+            khpins.addLast(hpins.get(((Integer) khlist.get(j)).intValue() - 
1));
+        }
       }
     }
-    unitID = unitID.substring(0, pt1) + "|" + unitID.substring(pt2);
-    return unitID;
   }
 
-  @SuppressWarnings("unchecked")
+//  private static String removeUnitAtom(String unitID) {
+//    int pt1 = 0;
+//    int pt2 = unitID.length();
+//    for (int i = 0, pt = -1; i < 7 && (pt = unitID.indexOf("|", pt + 1)) >= 
0;i++) {
+//      switch (i) {
+//      case 4:
+//        pt1 = pt + 1;
+//        break;
+//      case 6:
+//        pt2 = pt;
+//        break;
+//      }
+//    }
+//    unitID = unitID.substring(0, pt1) + "|" + unitID.substring(pt2);
+//    return unitID;
+//  }
+
+   @SuppressWarnings("unchecked")
   @Override
   public void getBasePairs(Viewer vwr, int modelIndex) {
     ModelSet ms = vwr.ms;

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-09-21 01:43:27 UTC 
(rev 20781)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-09-21 02:16:07 UTC 
(rev 20782)
@@ -59,15 +59,16 @@
 
 TODO: image off  stops JSmol
 
-TODO: Switch to dssr1 prior to full release
+TODO: ketene messes up orbitals for O;
 
 Jmol.___JmolVersion="14.3.16_2015.09.21"
 
+bug fix: minor fixes for DSSR
+
 bug fix: print within(0, "XXX", ...) ignores the "XXX" entirely. Should throw 
an error (Ron Mignery)
 bug fix: print within(0, "vdw", ...) ignores "vdw"; should accept that as 
"vanderwaal"
 bug fix: print within(-1.0, "vanderwaal", ...) ignores "vanderwaal" and does a 
fractional-coordinate calculation  
 
-
 JmolVersion="14.3.16_2015.09.20"
 
 FEATURE CHANGE: 3DNA DSSR has switched over to JSON; some array names are 
changed.

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to