Subject: | Error when opening tree files |
I get the following error when I open tree files with Phylo:
Show quoted text
-------------------------- EXCEPTION ----------------------------
Message: Inappropriate ioctl for device
An exception of type Bio::Phylo::Util::Exceptions::FileError
was thrown.
This kind of error happens when a file can not be accessed.
------------------------- STACK TRACE ---------------------------
STACK: Bio::Phylo::IO::parse('Bio::Phylo::IO', '-file',
'simple_tree.tre', '-format', 'newick') called at phylo_read_file_bug.pl
line 6
This problem seems to be fixable by editing the Bio::Phylo->parse
function and replacing:
if ($!) {
Bio::Phylo::Util::Exceptions::FileError->throw( error => $! );
}
by:
if ( (not defined $fh) || $fh->error) {
Bio::Phylo::Util::Exceptions::FileError->throw( error => $! );
}
After editing, no error occurs and the Bio::Phylo::Forest::Tree is
created and populated properly.
Subject: | simple_tree.tre |
Message body not shown because it is not plain text.
Subject: | phylo_read_file_bug.pl |
# Read tree file in Phylo
use Bio::Phylo::IO;
use Data::Dumper;
my $file = 'simple_tree.tre';
my $tree = Bio::Phylo::IO->parse(
'-file' => $file,
'-format' => 'newick',
)->first;
print Dumper($tree);