Discussion:
[Bioperl-l] newick to nexus
Lewis Lukens
2003-11-27 17:45:45 UTC
Permalink
Hi,

I am trying to convert tree files from newick to nexus format. It
seems that one can do this (using the example script from
bio::factory::treefactoryI) but I have been unable to.

My the code is:

#!/usr/bin/perl
use Bio::TreeIO;
my $treeio= new Bio::TreeIO ('-format'=> 'newick', '-file'=>'bpoistree');
my $treeout= new Bio::TreeIO ('-format'=> 'nexus', '-file'=>'>outfile');

while(my $tree = $treeio->next_tree) {
$treeout->write_tree($treeout);
}


The newick tree is fine, but the "nexus" module is missing, and I get
the following error:

Bio::TreeIO: nexus cannot be found
Exception
------------- EXCEPTION -------------
MSG: Failed to load module Bio::TreeIO::nexus. Can't locate
Bio/TreeIO/nexus.pm in @INC (@INC contains:
/System/Library/Perl/darwin /System/Library/Perl /Library/Perl/darwin
/Library/Perl /Library/Perl /Network/Library/Perl/darwin
/Network/Library/Perl /Network/Library/Perl .) at
/Library/Perl/Bio/Root/Root.pm line 407.

STACK Bio::Root::Root::_load_module /Library/Perl/Bio/Root/Root.pm:409
STACK (eval) /Library/Perl/Bio/TreeIO.pm:221
STACK Bio::TreeIO::_load_format_module /Library/Perl/Bio/TreeIO.pm:220
STACK Bio::TreeIO::new /Library/Perl/Bio/TreeIO.pm:121
STACK toplevel treeswitch.pl:4

Is there another way to do this in bioperl?

Thanks much,
Lewis

P.S. Please respond to the address above, as I am not a subscriber to
the mailing list.
--
Lewis Lukens
Assistant Professor
Department of Plant Agriculture
Univ. of Guelph, Guelph, Ontario. N1G 2W1

Tel: (519) 824- 4120 ext 52304
Rob Edwards
2003-11-27 18:02:42 UTC
Permalink
You need to get a more recent version of bioperl. The nexus module was
not in earlier versions.

As you don't have the file Bio/TreeIO/nexus.pm you need to update
bioperl.

Rob
Post by Lewis Lukens
Hi,
I am trying to convert tree files from newick to nexus format. It
seems that one can do this (using the example script from
bio::factory::treefactoryI) but I have been unable to.
#!/usr/bin/perl
use Bio::TreeIO;
my $treeio= new Bio::TreeIO ('-format'=> 'newick',
'-file'=>'bpoistree');
my $treeout= new Bio::TreeIO ('-format'=> 'nexus',
'-file'=>'>outfile');
while(my $tree = $treeio->next_tree) {
$treeout->write_tree($treeout);
}
The newick tree is fine, but the "nexus" module is missing, and I get
Bio::TreeIO: nexus cannot be found
Exception
------------- EXCEPTION -------------
MSG: Failed to load module Bio::TreeIO::nexus. Can't locate
/System/Library/Perl/darwin /System/Library/Perl /Library/Perl/darwin
/Library/Perl /Library/Perl /Network/Library/Perl/darwin
/Network/Library/Perl /Network/Library/Perl .) at
/Library/Perl/Bio/Root/Root.pm line 407.
STACK Bio::Root::Root::_load_module /Library/Perl/Bio/Root/Root.pm:409
STACK (eval) /Library/Perl/Bio/TreeIO.pm:221
STACK Bio::TreeIO::_load_format_module /Library/Perl/Bio/TreeIO.pm:220
STACK Bio::TreeIO::new /Library/Perl/Bio/TreeIO.pm:121
STACK toplevel treeswitch.pl:4
Is there another way to do this in bioperl?
Thanks much,
Lewis
P.S. Please respond to the address above, as I am not a subscriber to
the mailing list.
--
Lewis Lukens
Assistant Professor
Department of Plant Agriculture
Univ. of Guelph, Guelph, Ontario. N1G 2W1
Tel: (519) 824- 4120 ext 52304
_______________________________________________
Bioperl-l mailing list
http://portal.open-bio.org/mailman/listinfo/bioperl-l
Shawn Hoon
2003-11-27 18:04:43 UTC
Permalink
Post by Lewis Lukens
Hi,
I am trying to convert tree files from newick to nexus format. It
seems that one can do this (using the example script from
bio::factory::treefactoryI) but I have been unable to.
#!/usr/bin/perl
use Bio::TreeIO;
my $treeio= new Bio::TreeIO ('-format'=> 'newick',
'-file'=>'bpoistree');
my $treeout= new Bio::TreeIO ('-format'=> 'nexus',
'-file'=>'>outfile');
while(my $tree = $treeio->next_tree) {
$treeout->write_tree($treeout);
}
I think you wanna do $treeout->write_tree($tree) but thats probably
just a typo.
Post by Lewis Lukens
The newick tree is fine, but the "nexus" module is missing, and I get
Bio::TreeIO: nexus cannot be found
Exception
------------- EXCEPTION -------------
MSG: Failed to load module Bio::TreeIO::nexus. Can't locate
/System/Library/Perl/darwin /System/Library/Perl /Library/Perl/darwin
/Library/Perl /Library/Perl /Network/Library/Perl/darwin
/Network/Library/Perl /Network/Library/Perl .) at
/Library/Perl/Bio/Root/Root.pm line 407.
Jason added nexus 2 months ago so probably you don't have it.
Check that you have Bio/TreeIO/nexus.pm, if not do a cvs update or
download a newer bioperl package.
(I checked mine and I didn't have it)


cheers,

shawn
Post by Lewis Lukens
STACK Bio::Root::Root::_load_module /Library/Perl/Bio/Root/Root.pm:409
STACK (eval) /Library/Perl/Bio/TreeIO.pm:221
STACK Bio::TreeIO::_load_format_module /Library/Perl/Bio/TreeIO.pm:220
STACK Bio::TreeIO::new /Library/Perl/Bio/TreeIO.pm:121
STACK toplevel treeswitch.pl:4
Is there another way to do this in bioperl?
Thanks much,
Lewis
P.S. Please respond to the address above, as I am not a subscriber to
the mailing list.
--
Lewis Lukens
Assistant Professor
Department of Plant Agriculture
Univ. of Guelph, Guelph, Ontario. N1G 2W1
Tel: (519) 824- 4120 ext 52304
_______________________________________________
Bioperl-l mailing list
http://portal.open-bio.org/mailman/listinfo/bioperl-l
Jason Stajich
2003-11-27 18:09:22 UTC
Permalink
The TreeIO::nexus parser is not in bioperl 1.2.x but only in bioperl 1.3.x
so you'd need to get the latest code from the dev releases to achieve
this.

However, all that said I don't think I implemented nexus tree writing,
just nexus tree parsing at this time. Will be able to check this weekend
I expect.

-jason
Post by Lewis Lukens
Hi,
I am trying to convert tree files from newick to nexus format. It
seems that one can do this (using the example script from
bio::factory::treefactoryI) but I have been unable to.
#!/usr/bin/perl
use Bio::TreeIO;
my $treeio= new Bio::TreeIO ('-format'=> 'newick', '-file'=>'bpoistree');
my $treeout= new Bio::TreeIO ('-format'=> 'nexus', '-file'=>'>outfile');
while(my $tree = $treeio->next_tree) {
$treeout->write_tree($treeout);
}
The newick tree is fine, but the "nexus" module is missing, and I get
Bio::TreeIO: nexus cannot be found
Exception
------------- EXCEPTION -------------
MSG: Failed to load module Bio::TreeIO::nexus. Can't locate
/System/Library/Perl/darwin /System/Library/Perl /Library/Perl/darwin
/Library/Perl /Library/Perl /Network/Library/Perl/darwin
/Network/Library/Perl /Network/Library/Perl .) at
/Library/Perl/Bio/Root/Root.pm line 407.
STACK Bio::Root::Root::_load_module /Library/Perl/Bio/Root/Root.pm:409
STACK (eval) /Library/Perl/Bio/TreeIO.pm:221
STACK Bio::TreeIO::_load_format_module /Library/Perl/Bio/TreeIO.pm:220
STACK Bio::TreeIO::new /Library/Perl/Bio/TreeIO.pm:121
STACK toplevel treeswitch.pl:4
Is there another way to do this in bioperl?
Thanks much,
Lewis
P.S. Please respond to the address above, as I am not a subscriber to
the mailing list.
--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu

Loading...