public class get_subtree_specific_chars {
+ final static boolean SIMPLE = true;
+
public static void main( final String args[] ) {
if ( args.length != 1 ) {
System.err.println();
System.out.println();
for( final PhylogenyNodeIterator iter = phy.iteratorPostorder(); iter.hasNext(); ) {
final PhylogenyNode node = iter.next();
+ if ( !SIMPLE && node.isExternal() ) {
+ continue;
+ }
if ( !node.isRoot() ) {
System.out.println();
if ( node.getNodeData().isHasTaxonomy()
final SortedSet<String> unique_chars = new TreeSet<String>();
for( final String node_char : node_chars ) {
if ( !not_node_chars.contains( node_char ) ) {
- unique_chars.add( node_char );
+ if ( SIMPLE ) {
+ unique_chars.add( node_char );
+ }
+ else {
+ boolean found = true;
+ for( final int external_id : external_ids ) {
+ if ( !phy.getNode( external_id ).getNodeData().getBinaryCharacters()
+ .getGainedCharacters().contains( node_char )
+ && !phy.getNode( external_id ).getNodeData().getBinaryCharacters()
+ .getPresentCharacters().contains( node_char ) ) {
+ found = false;
+ break;
+ }
+ }
+ if ( found ) {
+ unique_chars.add( node_char );
+ }
+ }
}
}
System.out.println( "\tSUM:\t" + unique_chars.size() );