From ac5827eb3ea6f1c671dc2c952ed632b2aabe7e45 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Wed, 1 Nov 2017 16:13:18 +0000 Subject: [PATCH] JAL-2795 Sequence[] references now as SequenceI[] & deleted double class --- .../archaeopteryx/ArchaeopteryxTreeConverter.java | 7 ++- .../ext/archaeopteryx/MatrixConversionFactory.java | 66 -------------------- src/jalview/ext/archaeopteryx/MatrixConverter.java | 4 +- src/jalview/ext/forester/ForesterMatrix.java | 9 ++- 4 files changed, 10 insertions(+), 76 deletions(-) delete mode 100644 src/jalview/ext/archaeopteryx/MatrixConversionFactory.java diff --git a/src/jalview/ext/archaeopteryx/ArchaeopteryxTreeConverter.java b/src/jalview/ext/archaeopteryx/ArchaeopteryxTreeConverter.java index 689d5cd..9542397 100644 --- a/src/jalview/ext/archaeopteryx/ArchaeopteryxTreeConverter.java +++ b/src/jalview/ext/archaeopteryx/ArchaeopteryxTreeConverter.java @@ -2,9 +2,9 @@ package jalview.ext.archaeopteryx; import jalview.analysis.TreeBuilder; import jalview.datamodel.SequenceI; -import jalview.math.MatrixI; import jalview.util.MessageManager; +import org.forester.evoinference.matrix.distance.DistanceMatrix; import org.forester.phylogeny.Phylogeny; import org.forester.phylogeny.PhylogenyNode; @@ -16,7 +16,7 @@ public class ArchaeopteryxTreeConverter private PhylogenyNode rootNode; - protected MatrixI distances; + protected DistanceMatrix distances; protected TreeBuilder jalviewTree; @@ -28,7 +28,8 @@ public class ArchaeopteryxTreeConverter { this.jalviewTree = calculatedTree; this.sequences = jalviewTree.getSequences(); - this.distances = jalviewTree.getDistances(); + this.distances = MatrixConverter.convertJalviewToForester( + jalviewTree.getDistances(), jalviewTree.getSequences()); } diff --git a/src/jalview/ext/archaeopteryx/MatrixConversionFactory.java b/src/jalview/ext/archaeopteryx/MatrixConversionFactory.java deleted file mode 100644 index 19409e0..0000000 --- a/src/jalview/ext/archaeopteryx/MatrixConversionFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -package jalview.ext.archaeopteryx; - -import jalview.math.MatrixI; - -import org.forester.evoinference.matrix.distance.DistanceMatrix; - -public class MatrixConversionFactory -{ - DistanceMatrix foresterMatrix; - - MatrixI jalviewMatrix; - - public static MatrixConversionFactory createConverter( - DistanceMatrix foresterInputMatrix) - { - MatrixConversionFactory converter = new MatrixConversionFactory(); - converter.convertForesterToJalview(foresterInputMatrix); - return converter; - - } - - public static MatrixConversionFactory createConverter(MatrixI jalviewInputMatrix) - { - MatrixConversionFactory converter = new MatrixConversionFactory(); - converter.convertJalviewToForester(jalviewInputMatrix); - return converter; - - } - - private DistanceMatrix convertJalviewToForester( - MatrixI jalviewMatrix) - { - this.jalviewMatrix = jalviewMatrix; - return foresterMatrix; - - } - - private MatrixI convertForesterToJalview( - DistanceMatrix foresterMatrix) - { - this.foresterMatrix = foresterMatrix; - - return jalviewMatrix; - } - - protected DistanceMatrix getForesterMatrix() - { - return foresterMatrix; - } - - protected void setForesterMatrix(DistanceMatrix foresterMatrix) - { - this.foresterMatrix = foresterMatrix; - } - - protected MatrixI getJalviewMatrix() - { - return jalviewMatrix; - } - - protected void setJalviewMatrix(MatrixI jalviewMatrix) - { - this.jalviewMatrix = jalviewMatrix; - } - -} diff --git a/src/jalview/ext/archaeopteryx/MatrixConverter.java b/src/jalview/ext/archaeopteryx/MatrixConverter.java index 9eaece8..ef44030 100644 --- a/src/jalview/ext/archaeopteryx/MatrixConverter.java +++ b/src/jalview/ext/archaeopteryx/MatrixConverter.java @@ -1,6 +1,6 @@ package jalview.ext.archaeopteryx; -import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceI; import jalview.ext.forester.ForesterMatrix; import jalview.math.MatrixI; @@ -19,7 +19,7 @@ public final class MatrixConverter public static DistanceMatrix convertJalviewToForester( final MatrixI jalviewInputMatrix, - final Sequence[] matrixSequences) + final SequenceI[] matrixSequences) { if (jalviewInputMatrix.width() != jalviewInputMatrix.height()) { diff --git a/src/jalview/ext/forester/ForesterMatrix.java b/src/jalview/ext/forester/ForesterMatrix.java index e48ee27..e0f2994 100644 --- a/src/jalview/ext/forester/ForesterMatrix.java +++ b/src/jalview/ext/forester/ForesterMatrix.java @@ -1,6 +1,6 @@ package jalview.ext.forester; -import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceI; import jalview.math.MatrixI; import jalview.util.MessageManager; @@ -22,18 +22,17 @@ public class ForesterMatrix implements DistanceMatrix private final MatrixI jalviewMatrix; - private final String[] identifiers; public ForesterMatrix(final MatrixI jalviewInputMatrix, - final Sequence[] matrixSequences) + final SequenceI[] matrixSequences) { this.jalviewMatrix = jalviewInputMatrix; this.identifiers = new String[matrixSequences.length]; int i = 0; - for (Sequence sequence : matrixSequences) + for (SequenceI sequence : matrixSequences) { identifiers[i] = sequence.getName(); i++; @@ -52,7 +51,7 @@ public class ForesterMatrix implements DistanceMatrix @Override public String getIdentifier(final int i) { - return identifiers[i]; + return identifiers[i]; // add handling if index is out of bounds } -- 1.7.10.2