[Bioperl-l] Fwd: Problem with Bio::Tree::Draw::Cladogram

Sari Khaleel sari.khalil at gmail.com
Wed Mar 14 00:47:55 UTC 2012


Hello,
 My name is Sari Khaleel, I'm a master's student at UD and I've been playing with this module. My problem is that the cladogram shows the node's taxid instead of the node's name, as in the attached picture below. 
 I went through the code and it seems that print() function prints the node's id (its taxid) instead of its name. Is there anyway around that.

Here's a simplified version of what I'm trying to do .. it's a simple script that tries to build a tree and print from a list of taxids:

my $db = Bio::DB::Taxonomy->new(-source => 'entrez'); # use NCBI Entrez over HTTP
my @taxids = qw(296483 398577 269482 331272 331271 266265);
my @names = qw (a b c d e f);

# Get taxons from entrez
	my %taxid2taxon;
       foreach my $taxid (@taxids){
           $taxid2taxon{$taxid} = $db->get_taxon(-taxonid => $taxid);
       }

       my $tree; my $c =0;
       foreach my $taxid (@taxids){
           my $node = $taxid2taxon{$taxid};
           $node->name('supplied', $name[$c]);

           if (! $tree){
               $tree = Bio::Tree::Tree->new(-verbose => $db->verbose, -node => $node);
           }
           else{
               $tree->merge_lineage($node);
           }
	    $c++;
       }


   # Print the tree as a cladogram
       my $obj1 = Bio::Tree::Draw::Cladogram->new(-tree => $tree);
       $obj1->print(-file => "cladogram.eps");

# DONE


Sari

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cladogram.eps
Type: image/eps
Size: 1419 bytes
Desc: not available
URL: <http://lists.open-bio.org/pipermail/bioperl-l/attachments/20120313/e9f37082/attachment-0004.bin>


More information about the Bioperl-l mailing list