Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/java/tdg09/Analyse.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,15 @@ private void validate(Tree tree, Alignment alignment) {
System.out.printf("Alignment:\n SequenceCount: %s\n SiteCount: %s\n\n", alignment.getSequenceCount(), alignment.getSiteCount());
}

// 2. Check that all taxa have an assigned group and all groups are used
// 2. Check that group names have the right length
for (String group : options.groups) {
if (group.length() > 2) {
System.out.println("ERROR: Group names must be at most two characters long.");
System.exit(1);
}
}

// 3. Check that all taxa have an assigned group and all groups are used
List<String> taxa = Lists.newArrayList();
Set<String> usedGroups = Sets.newHashSet();

Expand Down
5 changes: 5 additions & 0 deletions src/java/tdg09/trees/TreeNodeLabeller.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Collections;

/**
* Takes a tree where taxa have been prefixed by a two-letter partition/group identifier and traverses the tree to
Expand Down Expand Up @@ -90,6 +91,10 @@ public SimpleTree label(Tree t) {
}

// now the only remaining unknown nodes are those that neighbour two different clades (and the root node)

// Iterate over unknownNodes in reverse to make sure the parent nodes are labelled before child nodes
Collections.reverse(unknownNodes);

for (Node n : unknownNodes) {
// the name of this hostshift node = parent node name (remember, could be the root node = leave unlabelled)
if (n.getParent() != null) {
Expand Down