From 8afad69b0e7f4b0bb854279fc62b578acbec439e Mon Sep 17 00:00:00 2001 From: MorellThomas Date: Sat, 16 Sep 2023 13:41:56 +0200 Subject: [PATCH] Correctly working implementation of the PaSiMap pipeline --- src/jalview/analysis/PaSiMap.java | 20 +++----------------- src/jalview/analysis/ccAnalysis.java | 13 +++++++------ 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/jalview/analysis/PaSiMap.java b/src/jalview/analysis/PaSiMap.java index 4235779..13bc3d2 100755 --- a/src/jalview/analysis/PaSiMap.java +++ b/src/jalview/analysis/PaSiMap.java @@ -114,12 +114,6 @@ public class PaSiMap implements Runnable float z = (float) component(i, mm) * factor; out[i] = new Point(x, y, z); } - //&! - System.out.println("Points:"); - for (Point point : out) - { - System.out.println(point.toString()); - } return out; } @@ -174,16 +168,10 @@ public class PaSiMap implements Runnable PrintStream ps = wrapOutputBuffer(sb); /* - * pairwise similarity scores - */ - sb.append(" --- OrigT * Orig ---- \n"); - pairwiseScores.print(ps, "%8.2f"); - - /* - * eigenvalues matrix, with D vector + * coordinates matrix, with D vector */ - sb.append(" --- New diagonalization matrix ---\n"); - eigenMatrix.print(ps, "%8.2f"); + sb.append(" --- Coordinates ---\n"); + eigenMatrix.print(ps, "%8.6f "); sb.append(" --- Eigenvalues ---\n"); eigenMatrix.printD(ps, "%15.4e"); ps.println(); @@ -219,10 +207,8 @@ public class PaSiMap implements Runnable ccAnalysis cc = new ccAnalysis(pairwiseScores, dim); pairwiseScores = cc.run(); - /** perform the eigendecomposition for the plot */ eigenMatrix = pairwiseScores.copy(); eigenMatrix.setD(pairwiseScores.getD()); - System.out.println(getDetails()); } catch (Exception q) diff --git a/src/jalview/analysis/ccAnalysis.java b/src/jalview/analysis/ccAnalysis.java index f7d5c58..4922a54 100755 --- a/src/jalview/analysis/ccAnalysis.java +++ b/src/jalview/analysis/ccAnalysis.java @@ -337,6 +337,7 @@ public class ccAnalysis System.out.println(); System.out.println("uncorrected eigenvalues"); eigenMatrix.printD(System.out, "%2.4f "); + System.out.println(); double[] eigenVals = eigenMatrix.getD(); @@ -445,7 +446,7 @@ public class ccAnalysis q.printStackTrace(); } System.out.println("final coordinates:"); - repMatrix.print(System.out, "%8.2f"); + repMatrix.print(System.out, "%1.8f "); return repMatrix; } @@ -744,13 +745,13 @@ public class ccAnalysis double alpha = 0.0; // "Levenberg-Marquardt" parameter double gNorm = 0; - byte terminationStatus = 0; + boolean terminationStatus = false; int iteration = 0; while (true) { gNorm = MiscMath.norm(g); - if (terminationStatus != 0 || nfev == maxNfev) + if (terminationStatus || nfev == maxNfev) { break; } @@ -796,9 +797,9 @@ public class ccAnalysis // default ftol and xtol = 1e-8 boolean ftolSatisfied = actualReduction < (1e-8 * cost) && ratio > 0.25; - boolean xtolSatisfied = stepHnorm < (1e-8 * (1e-8 + xNorm)); - terminationStatus = (ftolSatisfied || xtolSatisfied) ? (byte) 1 : (byte) 0; - if (terminationStatus != 0) + boolean xtolSatisfied = stepHnorm < (1e-8 * (1e-8 + MiscMath.norm(hA))); + terminationStatus = ftolSatisfied || xtolSatisfied; + if (terminationStatus) { break; } -- 1.7.10.2