package jalview.analysis;
-import jalview.api.analysis.DistanceScoreModelI;
import jalview.api.analysis.ScoreModelI;
import jalview.api.analysis.SimilarityParamsI;
-import jalview.api.analysis.SimilarityScoreModelI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.CigarArray;
import jalview.datamodel.SeqCigar;
Vector<SequenceNode> node;
+ private AlignmentView seqStrings;
+
/**
* Constructor
*
int start, end;
boolean selview = av.getSelectionGroup() != null
&& av.getSelectionGroup().getSize() > 1;
- AlignmentView seqStrings = av.getAlignmentView(selview);
+ seqStrings = av.getAlignmentView(selview);
if (!selview)
{
start = 0;
findMaxDist(top);
}
+ /**
+ * Returns the minimum distance between two clusters, and also sets the
+ * indices of the clusters in fields mini and minj
+ *
+ * @return
+ */
protected abstract double findMinDistance();
/**
*/
protected void computeTree(ScoreModelI sm, SimilarityParamsI scoreOptions)
{
- if (sm instanceof DistanceScoreModelI)
- {
- distances = ((DistanceScoreModelI) sm).findDistances(seqData,
- scoreOptions);
- }
- else if (sm instanceof SimilarityScoreModelI)
- {
- /*
- * compute similarity and invert it to give a distance measure
- */
- MatrixI result = ((SimilarityScoreModelI) sm).findSimilarities(
- seqData, scoreOptions);
- result.reverseRange(true);
- distances = result;
- }
+ distances = sm.findDistances(seqData, scoreOptions);
makeLeaves();
}
/**
- * DOCUMENT ME!
+ * Finds the node, at or below the given node, with the maximum distance, and
+ * saves the node and the distance value
*
* @param nd
- * DOCUMENT ME!
*/
void findMaxDist(SequenceNode nd)
{
}
/**
- * DOCUMENT ME!
+ * Calculates and returns r, whatever that is
*
* @param i
- * DOCUMENT ME!
* @param j
- * DOCUMENT ME!
*
- * @return DOCUMENT ME!
+ * @return
*/
protected double findr(int i, int j)
{
{
double dist = distances.getValue(i, j);
- /*
- * add the members of cluster(j) to cluster(i)
- */
- clusters.get(i).or(clusters.get(j));
-
ri = findr(i, j);
rj = findr(j, i);
node.setElementAt(sn, i);
/*
- * mark cluster j as disposed of
+ * move the members of cluster(j) to cluster(i)
+ * and mark cluster j as out of the game
*/
+ clusters.get(i).or(clusters.get(j));
+ clusters.get(j).clear();
done.set(j);
- clusters.setElementAt(null, j);
}
- protected abstract void findNewDistances(SequenceNode tmpi, SequenceNode tmpj,
- double dist);
+ /*
+ * Computes and stores new distances for nodei and nodej, given the previous
+ * distance between them
+ */
+ protected abstract void findNewDistances(SequenceNode nodei,
+ SequenceNode nodej, double previousDistance);
/**
* Calculates and saves the distance between the combination of cluster(i) and
}
}
+ public AlignmentView getOriginalData()
+ {
+ return seqStrings;
+ }
+
}