/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
{
if (ResidueProperties.getScoreMatrix(pwtype) == null)
{
- type = "BLOSUM62";
+ pwtype = "BLOSUM62";
}
}
}
/**
- * DOCUMENT ME!
+ * Generate a string representation of the Tree
*
- * @return DOCUMENT ME!
+ * @return Newick File with all tree data available
*/
public String toString()
{
jalview.io.NewickFile fout = new jalview.io.NewickFile(getTopNode());
- return fout.print(false, true); // distances only
+ return fout.print(isHasBootstrap(),
+ isHasDistances(), isHasRootDistance()); // output all data available for tree
}
/**
*
* used when the alignment associated to a tree has changed.
*
- * @param alignment
- * Vector
+ * @param list
+ * Sequence set to be associated with tree nodes
*/
- public void UpdatePlaceHolders(Vector alignment)
+ public void UpdatePlaceHolders(List<SequenceI> list)
{
Vector leaves = new Vector();
findLeaves(top, leaves);
{
SequenceNode leaf = (SequenceNode) leaves.elementAt(i++);
- if (alignment.contains(leaf.element()))
+ if (list.contains(leaf.element()))
{
leaf.setPlaceholder(false);
}
if (seqmatcher == null)
{
// Only create this the first time we need it
- SequenceI[] seqs = new SequenceI[alignment.size()];
+ SequenceI[] seqs = new SequenceI[list.size()];
for (int j = 0; j < seqs.length; j++)
{
- seqs[j] = (SequenceI) alignment.elementAt(j);
+ seqs[j] = (SequenceI) list.get(j);
}
seqmatcher = new SequenceIdMatcher(seqs);
}
}
}
+ /**
+ * rename any nodes according to their associated sequence.
+ * This will modify the tree's metadata! (ie the original NewickFile or newly generated BinaryTree's label data)
+ */
+ public void renameAssociatedNodes() {
+ applyToNodes(new NodeTransformI() {
+ @Override
+ public void transform(BinaryNode node)
+ {
+ Object el = node.element();
+ if (el!=null && el instanceof SequenceI)
+ {
+ node.setName(((SequenceI)el).getName());
+ }
+ }
+ });
+ }
/**
* DOCUMENT ME!
*/
{
try
{
- score += pwmatrix.getPairwiseScore(sequenceString[i]
- .charAt(k), sequenceString[j].charAt(k));
+ score += pwmatrix.getPairwiseScore(
+ sequenceString[i].charAt(k),
+ sequenceString[j].charAt(k));
} catch (Exception ex)
{
System.err.println("err creating BLOSUM62 tree");