[Bioperl-l] Nexus tree format and nexus.pm version 1.8

Jason Stajich jason.stajich at duke.edu
Wed Sep 22 13:11:10 EDT 2004


Well you are almost there, but you are calling it wrong.  The error  
message gives a hint.
> Can't locate object method "get_nodes" via package  
> "Bio::TreeIO::nexus" at  
> /usr/lib/perl5/site_perl/5.8.0/Bio/TreeIO/nexus.pm line 212, <GEN0>  
> line 1.

Now look at your code
> my $treeout = new Bio::TreeIO(-format => 'nexus', -file   =>  
> ">$NEXUSFILE");
>
>  while(my $tree = $treeio->next_tree) {
>
>       $treeout->write_tree($treeout);
>
>   }

What type of object are you passing to $treeout->write_tree method.  
Look like $treeout which is Bio::TreeIO::nexus object.   Should be  
$tree instead as you want a Bio::Tree::Tree object passed in.

So the fixed code should be:

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


-jason
On Sep 22, 2004, at 11:52 AM, George Magklaras wrote:

> Hi,
>
> ===The Question===
> With regards to Bio::TreeIO, are there still issues with writing nexus  
> format trees by means of calling write_tree on BioPerl 1.4? Or in the  
> case below, what am I doing wrong?
>
> ==THE background:==
>
> A small script that tries to convert newick to nexus format goes:
> #########
> 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;
>
>
> #####
>
> Initially, running this script with the nexus.pm module that comes  
> with the default BioPerl 1.4 (version 1.2) produces the exception
>
> ------------- EXCEPTION  -------------
> MSG: Cannot call method write_tree on Bio::TreeIO object must use a  
> subclass
>
> That prompted me to upgrade to version 1.8 of the nexus.pm , according  
> to Jason's suggestions to Csaba Ortutay on the 3rd of August 2004.  
> Re-running the script with the latest module produces a different  
> exception:
>
> Can't locate object method "get_nodes" via package  
> "Bio::TreeIO::nexus" at  
> /usr/lib/perl5/site_perl/5.8.0/Bio/TreeIO/nexus.pm line 212, <GEN0>  
> line 1.
>
> My PERL details:
>
> Summary of my perl5 (revision 5.0 version 8 subversion 0)  
> configuration:
>   Platform:
>     osname=linux, osvers=2.4.20-8smp, archname=i386-linux
>     uname='linux storeslem.uio.no 2.4.20-8smp #1 smp thu mar 13  
> 17:45:54 est 2003 i686 unknown unknown gnulinux '
>     config_args='-Darchname='i386-linux'  
> -Dperladmin=unix-drift at usit.uio.no -Dcc=cc-wrapper  
> -Dlocincpth=/local/include -Dloclibpth=/local/lib -Uinstallusrbinperl  
> -Dprefix=/local -Dsiteprefix=/local -Dinstallprefix=/local  
> -Darchlib=/local/lib/perl5/5.8.0 -Dprivlib=/local/share/perl5/5.8.0  
> -Dsitearch=/local/lib/perl5/site_perl/5.8.0  
> -Dsitelib=/local/share/perl5/site_perl/5.8.0  
> -Dotherlibdirs=/site/lib/perl5/site_perl/5.8.0:/site/share/perl5/ 
> site_perl/5.8.0:/site/lib/perl5/site_perl  
> -Dman1dir=/local/share/man/man1 -Dman3dir=/local/share/man/man3 -de'
>     hint=recommended, useposix=true, d_sigaction=define
>     usethreads=undef use5005threads=undef useithreads=undef  
> usemultiplicity=undef
>     useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
>     use64bitint=undef use64bitall=undef uselongdouble=undef
>     usemymalloc=n, bincompat5005=undef
>   Compiler:
>     cc='cc-wrapper', ccflags ='-fno-strict-aliasing  
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
>     optimize='-O3',
>     cppflags='-fno-strict-aliasing -I/usr/include/gdbm'
>     ccversion='', gccversion='3.2.2 20030222 (Red Hat Linux 3.2.2-5)',  
> gccosandvers=''
>     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
>     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
>     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',  
> lseeksize=8
>     alignbytes=4, prototype=define
>   Linker and Libraries:
>     ld='cc-wrapper', ldflags =' -L/local/lib'
>     libpth=/local/lib /lib /usr/lib /usr/local/lib
>     libs=-lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt -lutil
>     perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
>     libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
>     gnulibc_version='2.3.2'
>   Dynamic Linking:
>     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef,  
> ccdlflags='-rdynamic'
>     cccdlflags='-fpic', lddlflags='-shared -L/local/lib'
>
>
>
> Thanks.
>
>
> -- 
> --
> George
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
--
Jason Stajich
jason.stajich at duke.edu
http://www.duke.edu/~jes12/



More information about the Bioperl-l mailing list