From: Jim Procter Date: Mon, 15 Aug 2022 11:29:20 +0000 (+0100) Subject: JAL-4059 update Jmol and JSmol to 15.2.69 - revised Jalview classes interating with... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Ftask%2FJAL-4059_updateJmolandSwingJS;p=jalview.git JAL-4059 update Jmol and JSmol to 15.2.69 - revised Jalview classes interating with Jmol API to handle double precision structure data --- diff --git a/THIRDPARTYLIBS b/THIRDPARTYLIBS index 72ff49e..9c5187b 100644 --- a/THIRDPARTYLIBS +++ b/THIRDPARTYLIBS @@ -42,7 +42,7 @@ jetty-util-9.2.10.v20150310.jar jfreesvg-2.1.jar GPL v3 licensed library from the JFree suite - http://www.jfree.org/jfreesvg/ JGoogleAnalytics_0.3.jar APL 2.0 License - http://code.google.com/p/jgoogleanalytics/ jhall.jar -Jmol-14.31.53.jar GPL/LGPLv2 built manually from commit https://github.com/BobHanson/Jmol-SwingJS/commit/a6a2fb767e3fc2a73e72d926a11fd93a0e4c9f23 (excluded jspecview/application to compile) +Jmol-15.2.69-NOLOG4J.jar GPL/LGPLv2 Jmol.jar and JSMol dist built manually from commit https://github.com/BobHanson/Jmol-SwingJS/commit/789ec9f0792931c6a1cb9ba7e4a82d360372260c and subsequent removal of org/apache/log4j directory json_simple-1.1.jar Apache 2.0 license - downloaded from https://code.google.com/p/json-simple/downloads/list (will move to 1.1.1 version when jalview is mavenised and osgi-ised) jsoup-1.8.1.jar jsr311-api-1.1.1.jar diff --git a/j8lib/Jmol-NO_LOG4J-14.31.53.jar b/j11lib/Jmol-15.2.69-NOLOG4J.jar similarity index 61% rename from j8lib/Jmol-NO_LOG4J-14.31.53.jar rename to j11lib/Jmol-15.2.69-NOLOG4J.jar index ff69d31..1336aa2 100644 Binary files a/j8lib/Jmol-NO_LOG4J-14.31.53.jar and b/j11lib/Jmol-15.2.69-NOLOG4J.jar differ diff --git a/j11lib/Jmol-NO_LOG4J-14.31.53.jar b/j8lib/Jmol-15.2.69-NOLOG4J.jar similarity index 61% rename from j11lib/Jmol-NO_LOG4J-14.31.53.jar rename to j8lib/Jmol-15.2.69-NOLOG4J.jar index bc3c77f..1336aa2 100644 Binary files a/j11lib/Jmol-NO_LOG4J-14.31.53.jar and b/j8lib/Jmol-15.2.69-NOLOG4J.jar differ diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 895db9a..46e17ec 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -173,13 +173,13 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel // ////////////////////////// @Override - public float[][] functionXY(String functionName, int x, int y) + public double[][] functionXY(String functionName, int x, int y) { return null; } @Override - public float[][][] functionXYZ(String functionName, int nx, int ny, + public double[][][] functionXYZ(String functionName, int nx, int ny, int nz) { // TODO Auto-generated method stub diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index ab6bbcc..45f3d7c 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -20,23 +20,11 @@ */ package jalview.ext.jmol; -import java.util.Locale; - -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.Annotation; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.SequenceI; -import jalview.io.DataSourceType; -import jalview.io.FileParse; -import jalview.io.StructureFile; -import jalview.schemes.ResidueProperties; -import jalview.util.Format; -import jalview.util.MessageManager; - import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Vector; @@ -49,6 +37,16 @@ import org.jmol.viewer.Viewer; import com.stevesoft.pat.Regex; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.Annotation; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.io.DataSourceType; +import jalview.io.FileParse; +import jalview.io.StructureFile; +import jalview.schemes.ResidueProperties; +import jalview.util.Format; +import jalview.util.MessageManager; import mc_view.Atom; import mc_view.PDBChain; import mc_view.Residue; @@ -662,7 +660,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener * Not implemented - returns null */ @Override - public float[][] functionXY(String functionName, int x, int y) + public double[][] functionXY(String functionName, int x, int y) { return null; } @@ -671,7 +669,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener * Not implemented - returns null */ @Override - public float[][][] functionXYZ(String functionName, int nx, int ny, + public double[][][] functionXYZ(String functionName, int nx, int ny, int nz) { return null; diff --git a/src/mc_view/AppletPDBCanvas.java b/src/mc_view/AppletPDBCanvas.java index fe1aca1..768f1d6 100644 --- a/src/mc_view/AppletPDBCanvas.java +++ b/src/mc_view/AppletPDBCanvas.java @@ -20,21 +20,6 @@ */ package mc_view; -import jalview.analysis.AlignSeq; -import jalview.appletgui.AlignmentPanel; -import jalview.appletgui.FeatureRenderer; -import jalview.appletgui.SequenceRenderer; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.SequenceI; -import jalview.io.DataSourceType; -import jalview.io.StructureFile; -import jalview.renderer.seqfeatures.FeatureColourFinder; -import jalview.structure.AtomSpec; -import jalview.structure.StructureListener; -import jalview.structure.StructureMapping; -import jalview.structure.StructureSelectionManager; -import jalview.util.MessageManager; - import java.awt.Color; import java.awt.Dimension; import java.awt.Event; @@ -52,6 +37,21 @@ import java.io.PrintStream; import java.util.List; import java.util.Vector; +import jalview.analysis.AlignSeq; +import jalview.appletgui.AlignmentPanel; +import jalview.appletgui.FeatureRenderer; +import jalview.appletgui.SequenceRenderer; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.io.DataSourceType; +import jalview.io.StructureFile; +import jalview.renderer.seqfeatures.FeatureColourFinder; +import jalview.structure.AtomSpec; +import jalview.structure.StructureListener; +import jalview.structure.StructureMapping; +import jalview.structure.StructureSelectionManager; +import jalview.util.MessageManager; + public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotionListener, StructureListener { @@ -82,13 +82,13 @@ public class AppletPDBCanvas extends Panel Dimension prefsize; - float[] centre = new float[3]; + double[] centre = new double[3]; - float[] width = new float[3]; + double[] width = new double[3]; - float maxwidth; + double maxwidth; - float scale; + double scale; String inStr; @@ -178,7 +178,7 @@ public class AppletPDBCanvas extends Panel colourBySequence(); - float max = -10; + double max = -10; int maxchain = -1; int pdbstart = 0; int pdbend = 0; @@ -317,16 +317,16 @@ public class AppletPDBCanvas extends Panel public void findWidth() { - float[] max = new float[3]; - float[] min = new float[3]; + double[] max = new double[3]; + double[] min = new double[3]; - max[0] = (float) -1e30; - max[1] = (float) -1e30; - max[2] = (float) -1e30; + max[0] = -1e30; + max[1] = -1e30; + max[2] = -1e30; - min[0] = (float) 1e30; - min[1] = (float) 1e30; - min[2] = (float) 1e30; + min[0] = 1e30; + min[1] = 1e30; + min[2] = 1e30; for (int ii = 0; ii < pdb.getChains().size(); ii++) { @@ -418,7 +418,7 @@ public class AppletPDBCanvas extends Panel // System.out.println("Maxwidth = " + maxwidth); } - public float findScale() + public double findScale() { int dim; int width; @@ -444,14 +444,14 @@ public class AppletPDBCanvas extends Panel dim = height; } - return (float) (dim / (1.5d * maxwidth)); + return dim / (1.5d * maxwidth); } public void findCentre() { - float xtot = 0; - float ytot = 0; - float ztot = 0; + double xtot = 0; + double ytot = 0; + double ztot = 0; int bsize = 0; @@ -473,9 +473,9 @@ public class AppletPDBCanvas extends Panel } } - centre[0] = xtot / (2 * (float) bsize); - centre[1] = ytot / (2 * (float) bsize); - centre[2] = ztot / (2 * (float) bsize); + centre[0] = xtot / (2 * (double) bsize); + centre[1] = ytot / (2 * (double) bsize); + centre[2] = ztot / (2 * (double) bsize); } @Override @@ -733,7 +733,7 @@ public class AppletPDBCanvas extends Panel { if (!wire) { - if (((float) Math.abs(y2 - y1) / (float) Math.abs(x2 - x1)) < 0.5) + if (((double) Math.abs(y2 - y1) / (double) Math.abs(x2 - x1)) < 0.5) { g.drawLine(x1, y1, x2, y2); g.drawLine(x1 + 1, y1 + 1, x2 + 1, y2 + 1); @@ -767,13 +767,13 @@ public class AppletPDBCanvas extends Panel { if (evt.getKeyCode() == KeyEvent.VK_UP) { - scale = (float) (scale * 1.1); + scale = scale * 1.1; redrawneeded = true; repaint(); } else if (evt.getKeyCode() == KeyEvent.VK_DOWN) { - scale = (float) (scale * 0.9); + scale = scale * 0.9; redrawneeded = true; repaint(); } diff --git a/src/mc_view/Atom.java b/src/mc_view/Atom.java index 3b4f409..2416270 100755 --- a/src/mc_view/Atom.java +++ b/src/mc_view/Atom.java @@ -20,17 +20,17 @@ */ package mc_view; -import jalview.schemes.ResidueProperties; - import java.awt.Color; +import jalview.schemes.ResidueProperties; + public class Atom { - public float x; + public double x; - public float y; + public double y; - public float z; + public double z; public int number; @@ -60,9 +60,9 @@ public class Atom public int atomIndex; - public float occupancy = 0; + public double occupancy = 0; - public float tfactor = 0; + public double tfactor = 0; // need these if we ever want to export Atom data // public boolean tfacset=true,occset=true; @@ -127,10 +127,10 @@ public class Atom return false; } - public Atom(float x, float y, float z) + public Atom(double x2, double y2, double z2) { - this.x = x; - this.y = y; - this.z = z; + this.x = x2; + this.y = y2; + this.z = z2; } } diff --git a/src/mc_view/Bond.java b/src/mc_view/Bond.java index e609506..0714ae3 100755 --- a/src/mc_view/Bond.java +++ b/src/mc_view/Bond.java @@ -24,9 +24,9 @@ import java.awt.Color; public class Bond { - float[] start; + double[] start; - float[] end; + double[] end; Color startCol = Color.lightGray; @@ -38,8 +38,8 @@ public class Bond public Bond(Atom at1, Atom at2) { - this.start = new float[] { at1.x, at1.y, at1.z }; - this.end = new float[] { at2.x, at2.y, at2.z }; + this.start = new double[] { at1.x, at1.y, at1.z }; + this.end = new double[] { at2.x, at2.y, at2.z }; this.startCol = at1.color; this.endCol = at2.color; this.at1 = at1; @@ -68,7 +68,7 @@ public class Bond * return len; } */ - public void translate(float x, float y, float z) + public void translate(double x, double y, double z) { start[0] = start[0] + x; end[0] = end[0] + x; diff --git a/src/mc_view/MCMatrix.java b/src/mc_view/MCMatrix.java index 01be1f9..61c46cc 100755 --- a/src/mc_view/MCMatrix.java +++ b/src/mc_view/MCMatrix.java @@ -22,31 +22,31 @@ package mc_view; public class MCMatrix { - float[][] matrix; + double[][] matrix; - float[][] tmp; + double[][] tmp; - float mycos; + double mycos; - float mysin; + double mysin; - float myconst = (float) (Math.PI / 180); + double myconst = Math.PI / 180; public MCMatrix(int rows, int cols) { - matrix = new float[rows][cols]; - tmp = new float[rows][cols]; + matrix = new double[rows][cols]; + tmp = new double[rows][cols]; } - public void addElement(int i, int j, float value) + public void addElement(int i, int j, double value) { matrix[i][j] = value; } - public void rotatex(float degrees) + public void rotatex(double degrees) { - mycos = (float) (Math.cos(degrees * myconst)); - mysin = (float) (Math.sin(degrees * myconst)); + mycos = (Math.cos(degrees * myconst)); + mysin = (Math.sin(degrees * myconst)); tmp[0][0] = 1; tmp[0][1] = 0; @@ -60,10 +60,10 @@ public class MCMatrix preMultiply(tmp); } - public void rotatez(float degrees) + public void rotatez(double degrees) { - mycos = (float) (Math.cos(degrees * myconst)); - mysin = (float) (Math.sin(degrees * myconst)); + mycos = (Math.cos(degrees * myconst)); + mysin = (Math.sin(degrees * myconst)); tmp[0][0] = mycos; tmp[0][1] = -mysin; @@ -78,10 +78,10 @@ public class MCMatrix preMultiply(tmp); } - public void rotatey(float degrees) + public void rotatey(double degrees) { - mycos = (float) (Math.cos(degrees * myconst)); - mysin = (float) (Math.sin(degrees * myconst)); + mycos = (Math.cos(degrees * myconst)); + mysin = (Math.sin(degrees * myconst)); tmp[0][0] = mycos; tmp[0][1] = 0; @@ -96,9 +96,9 @@ public class MCMatrix preMultiply(tmp); } - public float[] vectorMultiply(float[] vect) + public double[] vectorMultiply(double[] vect) { - float[] temp = new float[3]; + double[] temp = new double[3]; temp[0] = vect[0]; temp[1] = vect[1]; @@ -106,9 +106,8 @@ public class MCMatrix for (int i = 0; i < 3; i++) { - temp[i] = ((float) matrix[i][0] * vect[0]) - + ((float) matrix[i][1] * vect[1]) - + ((float) matrix[i][2] * vect[2]); + temp[i] = (matrix[i][0] * vect[0]) + (matrix[i][1] * vect[1]) + + (matrix[i][2] * vect[2]); } vect[0] = temp[0]; @@ -118,9 +117,9 @@ public class MCMatrix return vect; } - public void preMultiply(float[][] mat) + public void preMultiply(double[][] mat) { - float[][] tmp = new float[3][3]; + double[][] tmp = new double[3][3]; for (int i = 0; i < 3; i++) { @@ -140,9 +139,9 @@ public class MCMatrix } } - public void postMultiply(float[][] mat) + public void postMultiply(double[][] mat) { - float[][] tmp = new float[3][3]; + double[][] tmp = new double[3][3]; for (int i = 0; i < 3; i++) { diff --git a/src/mc_view/PDBCanvas.java b/src/mc_view/PDBCanvas.java index c15b54f..ca0b533 100644 --- a/src/mc_view/PDBCanvas.java +++ b/src/mc_view/PDBCanvas.java @@ -20,20 +20,6 @@ */ package mc_view; -import jalview.analysis.AlignSeq; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.SequenceI; -import jalview.gui.AlignmentPanel; -import jalview.gui.FeatureRenderer; -import jalview.gui.SequenceRenderer; -import jalview.io.DataSourceType; -import jalview.io.StructureFile; -import jalview.renderer.seqfeatures.FeatureColourFinder; -import jalview.structure.AtomSpec; -import jalview.structure.StructureListener; -import jalview.structure.StructureMapping; -import jalview.structure.StructureSelectionManager; - import java.awt.Color; import java.awt.Dimension; import java.awt.Event; @@ -55,6 +41,20 @@ import java.util.Vector; import javax.swing.JPanel; import javax.swing.ToolTipManager; +import jalview.analysis.AlignSeq; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.gui.AlignmentPanel; +import jalview.gui.FeatureRenderer; +import jalview.gui.SequenceRenderer; +import jalview.io.DataSourceType; +import jalview.io.StructureFile; +import jalview.renderer.seqfeatures.FeatureColourFinder; +import jalview.structure.AtomSpec; +import jalview.structure.StructureListener; +import jalview.structure.StructureMapping; +import jalview.structure.StructureSelectionManager; + public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListener, StructureListener { @@ -80,13 +80,13 @@ public class PDBCanvas extends JPanel Dimension prefsize; - float[] centre = new float[3]; + double[] centre = new double[3]; - float[] width = new float[3]; + double[] width = new double[3]; - float maxwidth; + double maxwidth; - float scale; + double scale; String inStr; @@ -298,8 +298,8 @@ public class PDBCanvas extends JPanel public void findWidth() { - float[] max = new float[3]; - float[] min = new float[3]; + double[] max = new double[3]; + double[] min = new double[3]; max[0] = (float) -1e30; max[1] = (float) -1e30; @@ -433,9 +433,9 @@ public class PDBCanvas extends JPanel public void findCentre() { - float xtot = 0; - float ytot = 0; - float ztot = 0; + double xtot = 0; + double ytot = 0; + double ztot = 0; int bsize = 0; diff --git a/src/mc_view/PDBChain.java b/src/mc_view/PDBChain.java index 72d276e..e854247 100755 --- a/src/mc_view/PDBChain.java +++ b/src/mc_view/PDBChain.java @@ -20,6 +20,11 @@ */ package mc_view; +import java.awt.Color; +import java.util.List; +import java.util.Locale; +import java.util.Vector; + import jalview.analysis.AlignSeq; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; @@ -33,11 +38,6 @@ import jalview.structure.StructureImportSettings; import jalview.structure.StructureMapping; import jalview.util.Comparison; -import java.awt.Color; -import java.util.List; -import java.util.Locale; -import java.util.Vector; - public class PDBChain { public static final String RESNUM_FEATURE = "RESNUM"; @@ -441,7 +441,7 @@ public class PDBChain SequenceFeature sf = new SequenceFeature(RESNUM_FEATURE, desc, offset + count, offset + count, pdbid); resFeatures.addElement(sf); - resAnnotation.addElement(new Annotation(tmpat.tfactor)); + resAnnotation.addElement(new Annotation((float) tmpat.tfactor)); // Keep totting up the sequence if ((symbol = ResidueProperties.getAA3Hash() @@ -694,8 +694,8 @@ public class PDBChain // Useful for debugging mappings - adds annotation for mapped position float min = -1, max = 0; Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1]; - for (int i = sq.getStart(), j = sq - .getEnd(), k = 0; i <= j; i++, k++) + for (int i = sq.getStart(), j = sq.getEnd(), + k = 0; i <= j; i++, k++) { int prn = mapping.getPDBResNum(k + 1); diff --git a/src/mc_view/Zsort.java b/src/mc_view/Zsort.java index a2080eb..96cd16b 100755 --- a/src/mc_view/Zsort.java +++ b/src/mc_view/Zsort.java @@ -49,7 +49,7 @@ public class Zsort private int partition(Vector bonds, int p, int r) { - float x = bonds.elementAt(p).start[2]; + double x = bonds.elementAt(p).start[2]; int i = p - 1; int j = r + 1; Bond tmp; diff --git a/utils/jalviewjs/libjs/jmol-app.zip b/utils/jalviewjs/libjs/jmol-app.zip index 65732a4..e864d3b 100644 Binary files a/utils/jalviewjs/libjs/jmol-app.zip and b/utils/jalviewjs/libjs/jmol-app.zip differ