[Bioperl-l] Convert newick to nexus format

Neha Nahar nehadnahar at yahoo.co.in
Mon Feb 5 18:05:26 UTC 2007


Hello everyone,

I am trying to convert newick tree to nexus format.
Using the script (refered from and email from George dated Wed Sep 22 11:52:47 EDT 2004) :

/*------------------------------------------------------------*/

$ cat nexus.pl
#!/usr/bin/perl -w

use Bio::TreeIO;

($NEWICKFILE, $NEXUSFILE) = @ARGV;
print "newickfile=$NEWICKFILE, nexusfile=$NEXUSFILE\n";
my $treeio = new Bio::TreeIO(-format => 'newick', -file   => "$NEWICKFILE");
my $treeout = new Bio::TreeIO(-format => 'nexus', -file   => ">$NEXUSFILE");
while(my $tree = $treeio->next_tree) {
        $treeout->write_tree($treeout);
    }

exit 0;


/*------------------------------------------------------------*/

Running the script through command line:
Gives the following error:

$  ./nexus.pl mrp-input.txt nexus.out
newickfile=mrp-input.txt, nexusfile=nexus.out

------------- EXCEPTION  -------------
MSG: Cannot call method write_tree on Bio::TreeIO object must use a subclass
STACK Bio::TreeIO::nexus::write_tree /usr/lib/perl5/vendor_perl/5.8.8/Bio/TreeIO/nexus.pm:170
STACK toplevel ./nexus.pl:23

--------------------------------------


Using  bioperl-1.5.2_101.tar.gz module from http://search.cpan.org/~sendu/bioperl/Bio/TreeIO.pm

Questions:-

1. Please let me know if I am using the correct version.
If not, please point me to the latest one.

2. Provided that the version I am using is the right one, please let me know what is wrong with the script.

Thank  you.
Regards,
Neha.



-Neha Nahar
  " Work for cause and not for applause, live to express and not to impress !"
 				
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 



More information about the Bioperl-l mailing list