From c99e5757c9c199687f6e3cdbbdb500f2cbb3cf89 Mon Sep 17 00:00:00 2001 From: MorellThomas Date: Thu, 7 Mar 2024 10:00:38 +0100 Subject: [PATCH] Inlcude 8 dimensions --- src/jalview/analysis/PaSiMap.java | 4 ++-- src/jalview/gui/PaSiMapPanel.java | 2 +- src/jalview/math/Matrix.java | 19 +++++++++++++++++++ src/jalview/math/MatrixI.java | 7 +++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/jalview/analysis/PaSiMap.java b/src/jalview/analysis/PaSiMap.java index 89bfff0..07256a3 100755 --- a/src/jalview/analysis/PaSiMap.java +++ b/src/jalview/analysis/PaSiMap.java @@ -52,7 +52,7 @@ public class PaSiMap implements Runnable final private SimilarityParamsI similarityParams; - final private byte dim = 3; + final private byte dim = 8; /* * outputs @@ -215,7 +215,7 @@ public class PaSiMap implements Runnable eigenMatrix = pairwiseScores.copy(); ccAnalysis cc = new ccAnalysis(pairwiseScores, dim); - eigenMatrix = cc.run(); + eigenMatrix = cc.run().mirrorCol(); } catch (Exception q) { diff --git a/src/jalview/gui/PaSiMapPanel.java b/src/jalview/gui/PaSiMapPanel.java index 832bbad..b3b5750 100644 --- a/src/jalview/gui/PaSiMapPanel.java +++ b/src/jalview/gui/PaSiMapPanel.java @@ -91,7 +91,7 @@ public class PaSiMapPanel extends GPaSiMapPanel public PaSiMapPanel(AlignmentPanel alignPanel, String modelName, SimilarityParamsI params) { - super(3); // dim = 3 + super(8); // dim = 8 this.av = alignPanel.av; this.ap = alignPanel; boolean nucleotide = av.getAlignment().isNucleotide(); diff --git a/src/jalview/math/Matrix.java b/src/jalview/math/Matrix.java index 7870c14..b7d225a 100755 --- a/src/jalview/math/Matrix.java +++ b/src/jalview/math/Matrix.java @@ -1415,4 +1415,23 @@ public class Matrix implements MatrixI return result; } + /** + * mirrors columns of the matrix + * + * @return + */ + @Override + public MatrixI mirrorCol() + { + double[][] result = new double[rows][cols]; + for (int i = 0; i < rows; i++) + { + int k = cols - 1; // reverse col + for (int j = 0; j < cols; j++) + { + result[i][k--] = this.getValue(i,j); + } + } + return new Matrix(result); + } } diff --git a/src/jalview/math/MatrixI.java b/src/jalview/math/MatrixI.java index a42c75c..7faac73 100644 --- a/src/jalview/math/MatrixI.java +++ b/src/jalview/math/MatrixI.java @@ -307,4 +307,11 @@ public interface MatrixI * if this.cols and v do not have the same length */ double[] sumProduct(double[] v); + + /** + * mirrors the columns of this matrix + * + * @return + */ + MatrixI mirrorCol(); } -- 1.7.10.2