import jalview.util.MappingUtils;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyNode;
+import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
public class LoadedTreeSequenceAssociation
implements ExternalLoadedTreeAssociationI
{
SequenceIdMatcher algnIds = new SequenceIdMatcher(alignSequences);
-
- List<PhylogenyNode> leaves = tree.getExternalNodes();
SequenceI nodeSequence;
String nodeSequenceName;
- for (PhylogenyNode treeNode : leaves)
+ if (!tree.isEmpty())
{
- nodeSequenceName = treeNode.getName();
-
- nodeSequence = algnIds.findIdMatch(nodeSequenceName);
- if (nodeSequence != null)
+ for (final PhylogenyNodeIterator iter = tree.iteratorPreorder(); iter
+ .hasNext();)
{
- org.forester.phylogeny.data.Sequence foresterNodeSeq = DataConversions
- .createForesterSequence(nodeSequence, true);
- treeNode.getNodeData().setSequence(foresterNodeSeq);
+ PhylogenyNode treeNode = iter.next();
+ nodeSequenceName = treeNode.getName();
- MappingUtils.putWithDuplicationCheck(alignmentWithNodes,
- nodeSequence, treeNode);
- MappingUtils.putWithDuplicationCheck(nodesWithAlignment,
- treeNode, nodeSequence);
+ nodeSequence = algnIds.findIdMatch(nodeSequenceName);
+ if (nodeSequence != null)
+ {
+ org.forester.phylogeny.data.Sequence foresterNodeSeq = DataConversions
+ .createForesterSequence(nodeSequence, true);
+ treeNode.getNodeData().setSequence(foresterNodeSeq);
+ MappingUtils.putWithDuplicationCheck(alignmentWithNodes,
+ nodeSequence, treeNode);
+ MappingUtils.putWithDuplicationCheck(nodesWithAlignment, treeNode,
+ nodeSequence);
- }
+
+ }
}
+ }
}