Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: soungalo <soungalo <at> walla.com>
Subject: Converting newick to nexus
Newsgroups: gmane.comp.lang.perl.bio.general
Date: Thursday 20th June 2013 08:30:29 UTC (over 3 years ago)
Dear mailing list members,
Could you please help me with this somewhat trivial task ?
I'm trying to convert a multi-tree newick format file to nexus format,
using
the TreeIO module. I used the following code:

################
#!/usr/bin/perl -w
use strict;
use Bio::TreeIO;
my $usage = "script.pl INFILE OUTFILE\n";
my $infile = shift or die $usage;
my $outfile = shift or die $usage;

my ($filein,$fileout) = @ARGV;
my ($format,$oformat) = qw(newick nexus);
my $in = Bio::TreeIO->new(-file => $infile, -format => $format);
my $out= Bio::TreeIO->new(-format => $oformat, -file => ">$outfile");

while( my $t = $in->next_tree ) {
	$out->write_tree($t);
}
################

However, results are coming out a bit weird, since the nexus translation,
header etc are repeated for every tree in the file, instead of creating a
single trees block containing all trees.
Could you please explain how to change this code in order to perform the
conversion properly, or suggest a different way of doing this ?
Any help will be appreciated. Thank you! 



--
View this message in context: http://bioperl.996286.n3.nabble.com/Converting-newick-to-nexus-tp17013.html
Sent from the Bioperl-L mailing list archive at Nabble.com.
 
CD: 2ms