[Bioperl-guts-l] bioperl commit

Jason Stajich jason at pub.open-bio.org
Mon Jul 19 09:48:06 EDT 2004


jason
Mon Jul 19 09:48:05 EDT 2004
Update of /home/repository/bioperl/bioperl-live/Bio/TreeIO
In directory pub.open-bio.org:/tmp/cvs-serv3144/Bio/TreeIO

Modified Files:
	pag.pm 
Log Message:
print trait count based on the number of traits seen (we assume that trait have been consistently assigned for all tip nodes - better code to check this in the future

bioperl-live/Bio/TreeIO pag.pm,1.4,1.5
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/Bio/TreeIO/pag.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- /home/repository/bioperl/bioperl-live/Bio/TreeIO/pag.pm	2004/07/16 18:56:08	1.4
+++ /home/repository/bioperl/bioperl-live/Bio/TreeIO/pag.pm	2004/07/19 13:48:05	1.5
@@ -116,7 +116,7 @@
 	$no_outgroups,
 	$special_node, 
 	$outgroup_ancestor,
-	$tree_no) = (0,0);
+	$tree_no) = (0,0,1);
     if( @args ) {
 	($no_outgroups,
 	 $print_header,
@@ -137,6 +137,7 @@
     my (%chars,%names);
     my @nodes = $tree->get_nodes;
     my $species_ct;
+    my $traitct;
     for my $node ( @nodes ) {
 	if ((defined $special_node) && ($node eq $special_node)) {
 	    my $no_of_tree_nodes = scalar(@nodes);
@@ -157,6 +158,7 @@
 	    $names{$node->internal_id} = $node_name;
 	    my @tags = sort $node->get_all_tags;
 	    my @charstates = map { ($node->get_tag_values($_))[0] } @tags;
+	    $traitct = scalar @charstates unless defined $traitct;
 	    $chars{$node->internal_id} = [@charstates];
 	} else {
 	    $names{$node->internal_id} = sprintf("N%d", $newname_base++);
@@ -166,9 +168,9 @@
     # generate PAG representation
     if( $print_header ) { 
 	if ($keep_outgroup) {
-	    $self->_print(sprintf("%d 1\n",$species_ct));
+	    $self->_print(sprintf("%d %d\n",$species_ct,$traitct));
 	} else {
-	    $self->_print( sprintf("%d 1\n",$species_ct-$no_outgroups));
+	    $self->_print( sprintf("%d %d\n",$species_ct-$no_outgroups,$traitct));
 	}
     }
 



More information about the Bioperl-guts-l mailing list