X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fanalysis%2FNJTree.java;h=144ec2c6ea14328cb69c066c38a6d06b9663f2ee;hb=c3583f7ab67ddb450f61af4d36af839ddf485a09;hp=e9e1cd77f0e0de79270d96f5dee251fa5803d64f;hpb=a45774ee31d9f35d4eff46d54d7deab719afb092;p=jalview.git diff --git a/src/jalview/analysis/NJTree.java b/src/jalview/analysis/NJTree.java index e9e1cd7..144ec2c 100644 --- a/src/jalview/analysis/NJTree.java +++ b/src/jalview/analysis/NJTree.java @@ -1,13 +1,13 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -275,18 +275,18 @@ public class NJTree { jalview.io.NewickFile fout = new jalview.io.NewickFile(getTopNode()); - return fout.print(isHasBootstrap(), - isHasDistances(), isHasRootDistance()); // output all data available for tree + 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 list) { Vector leaves = new Vector(); findLeaves(top, leaves); @@ -299,7 +299,7 @@ public class NJTree { SequenceNode leaf = (SequenceNode) leaves.elementAt(i++); - if (alignment.contains(leaf.element())) + if (list.contains(leaf.element())) { leaf.setPlaceholder(false); } @@ -308,11 +308,11 @@ public class NJTree 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); @@ -346,24 +346,29 @@ public class NJTree } } } + /** - * 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) + * 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() { + public void renameAssociatedNodes() + { + applyToNodes(new NodeTransformI() + { @Override public void transform(BinaryNode node) { Object el = node.element(); - if (el!=null && el instanceof SequenceI) + if (el != null && el instanceof SequenceI) { - node.setName(((SequenceI)el).getName()); + node.setName(((SequenceI) el).getName()); } } }); } + /** * DOCUMENT ME! */