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;
private PhylogenyNode rootNode;
- protected MatrixI distances;
+ protected DistanceMatrix distances;
protected TreeBuilder jalviewTree;
{
this.jalviewTree = calculatedTree;
this.sequences = jalviewTree.getSequences();
- this.distances = jalviewTree.getDistances();
+ this.distances = MatrixConverter.convertJalviewToForester(
+ jalviewTree.getDistances(), jalviewTree.getSequences());
}
+++ /dev/null
-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;
- }
-
-}
package jalview.ext.archaeopteryx;
-import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
import jalview.ext.forester.ForesterMatrix;
import jalview.math.MatrixI;
public static DistanceMatrix convertJalviewToForester(
final MatrixI jalviewInputMatrix,
- final Sequence[] matrixSequences)
+ final SequenceI[] matrixSequences)
{
if (jalviewInputMatrix.width() != jalviewInputMatrix.height())
{
package jalview.ext.forester;
-import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
import jalview.math.MatrixI;
import jalview.util.MessageManager;
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++;
@Override
public String getIdentifier(final int i)
{
- return identifiers[i];
+ return identifiers[i]; // add handling if index is out of bounds
}