Skip Menu |

This queue is for tickets about the Bio-NEXUS CPAN distribution.

Report information
The Basics
Id: 47707
Status: resolved
Worked: 30 min
Priority: 0/
Queue: Bio-NEXUS

People
Owner: stoltzfu [...] umbi.umd.edu
Requestors: jon.hill [...] imperial.ac.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug in Bio::NEXUS::Node.pm
Date: Wed, 08 Jul 2009 17:28:50 +0100
To: bug-Bio-NEXUS [...] rt.cpan.org
From: Jon Hill <jon.hill [...] imperial.ac.uk>
Hi, Spotted this bug whilst trying to remove taxa that had odd symbols in their name, e.g. Eurostopodidae+Steatornithidae Essentially, the reg exp in prune() (line 867) fails in such cases and the taxa are removed even if they shouldn't be. Attached is an example test case. To fix: $name = quotemeta $name before the reg exp. A diff is: 867,868d866 < # escape + < $name = quotemeta $name; I'm currently writing a Perl module which uses Bio::NEXUS very heavily. I plan to distribute my modified Bio::NEXUS (with the above fix) along with my module, which is also GPL. Once a fix has been issued, this will no longer be necessary. Hope that's OK. J. -- Jon Hill AMCG, Earth Science and Engineering, Imperial College London, SW7 2AZ. Phone: 020 75941351 Mob: 07748254812
#!/usr/bin/perl -w # test case to demosntrate bug in Bio::NEXUS use Bio::NEXUS; use Test::More tests =>1; # apologies for the slightly convlouted example - it's using code snippets # from my own module which have to handle more complex things :) # # # We're going to try and remove taxa_4, but 'taxa_n+taxa_2' will # dissappear too. my @quote_taxa_tree; $quote_taxa_tree = "(taxa_1, 'taxa_n+taxa_2', 'taxa_3=taxa5', taxa_4)"; # set up nexus object my $nexus_obj = new Bio::NEXUS(); my $trees_block = new Bio::NEXUS::TreesBlock('trees'); $trees_block->add_tree_from_newick( $quote_taxa_tree , "tree_1" ); $nexus_obj->add_block($trees_block); $nexus_obj->set_taxablock(); # remove taxa $nexus_obj = $nexus_obj->exclude_otus( ["taxa_4"] ); # get out trees my @trees; # generate new newick string # loop over all trees found in file and return foreach my $block ( @{ $nexus_obj->get_blocks() } ) { my $type = $block->{'type'}; if ( $type eq "trees" ) { foreach my $tree ( @{ $block->get_trees() } ) { # add to array after stripping off ; push( @trees,substr( $tree->as_string_inodes_nameless(), 0, -1 ) ); } } } $answer = "(taxa_1,'taxa_n+taxa_2','taxa_3=taxa5')"; is ($trees[0], $answer, "Removed correct taxa");
CC: Thomas Hladish <tjhladish [...] yahoo.com>
Subject: Re: [rt.cpan.org #47707] Bug in Bio::NEXUS::Node.pm
Date: Sat, 11 Jul 2009 17:22:49 -0400
To: bug-Bio-NEXUS [...] rt.cpan.org
From: Arlin Stoltzfus <stoltzfu [...] umbi.umd.edu>
I'd like to talk to you further about this. Thanks for catching the bug. We should integrate your solution and test into the next version of Bio::NEXUS. Do you think there are other spots in the code where this same kind of bug is going to happen? I would like to hear more about your project. Arlin On Jul 8, 2009, at 12:29 PM, Jon Hill via RT wrote: Show quoted text
> Wed Jul 08 12:29:25 2009: Request 47707 was acted upon. > Transaction: Ticket created by jon.hill@imperial.ac.uk > Queue: Bio-NEXUS > Subject: Bug in Bio::NEXUS::Node.pm > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: jon.hill@imperial.ac.uk > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=47707 > > > > Hi, > > Spotted this bug whilst trying to remove taxa that had odd symbols in > their name, e.g. Eurostopodidae+Steatornithidae > > Essentially, the reg exp in prune() (line 867) fails in such cases and > the taxa are removed even if they shouldn't be. > > Attached is an example test case. > > To fix: > > $name = quotemeta $name > > before the reg exp. > > A diff is: > 867,868d866 > < # escape + > < $name = quotemeta $name; > > I'm currently writing a Perl module which uses Bio::NEXUS very > heavily. > I plan to distribute my modified Bio::NEXUS (with the above fix) along > with my module, which is also GPL. Once a fix has been issued, this > will > no longer be necessary. Hope that's OK. > > J. > -- > Jon Hill > AMCG, Earth Science and Engineering, > Imperial College London, SW7 2AZ. > Phone: 020 75941351 > Mob: 07748254812 > > <bio_nexus_bug.pl>
Subject: Re: [rt.cpan.org #47707] Bug in Bio::NEXUS::Node.pm
Date: Sun, 12 Jul 2009 10:12:50 +0100
To: "bug-Bio-NEXUS [...] rt.cpan.org" <bug-Bio-NEXUS [...] rt.cpan.org>
From: Jon Hill <jon.hill [...] imperial.ac.uk>
Arlin Stoltzfus via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=47707 > > > I'd like to talk to you further about this. > > Thanks for catching the bug. We should integrate your solution and > test into the next version of Bio::NEXUS. Do you think there are > other spots in the code where this same kind of bug is going to happen?
A quick grep for '$name' shows one other location in: TaxUnitSet.pm: if ( $names =~ /\s+$name\s+/ ) { where this might be a problem as far as I can see. I have come across another issue with Bio::NEXUS, but I'll submit this as a separate issue once I've got a test written and can pinpoint the error (it might be a bit too big an issue for a quick fix though!). Show quoted text
> > I would like to hear more about your project.
STK is an implementation of a supertree processing protocol put forward by my collaborator Katie Davis. The aim is to get the best quality data possible as sources (which are Nexus files) for supertree analysis. This involves standardising taxa; removing synonyms, vernacular names, etc; checking for data independence, etc. More details can be found on our SourceForge page: https://sourceforge.net/projects/stck/ We're currently writing up a description of the software for BMC Bioinformatics. J.
CC: Thomas Hladish <tjhladish [...] yahoo.com>
Subject: Re: [rt.cpan.org #47707] Bug in Bio::NEXUS::Node.pm
Date: Thu, 13 Aug 2009 17:48:07 -0400
To: bug-Bio-NEXUS [...] rt.cpan.org
From: Arlin Stoltzfus <stoltzfu [...] umbi.umd.edu>
Jon-- I fixed this and wrote a test using your code, and uploaded the changes to SourceForge (the main repository for Bio::NEXUS). The CPAN version will be updated in a few days. Arlin On Jul 8, 2009, at 12:29 PM, Jon Hill via RT wrote: Show quoted text
> Wed Jul 08 12:29:25 2009: Request 47707 was acted upon. > Transaction: Ticket created by jon.hill@imperial.ac.uk > Queue: Bio-NEXUS > Subject: Bug in Bio::NEXUS::Node.pm > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: jon.hill@imperial.ac.uk > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=47707 > > > > Hi, > > Spotted this bug whilst trying to remove taxa that had odd symbols in > their name, e.g. Eurostopodidae+Steatornithidae > > Essentially, the reg exp in prune() (line 867) fails in such cases and > the taxa are removed even if they shouldn't be. > > Attached is an example test case. > > To fix: > > $name = quotemeta $name > > before the reg exp. > > A diff is: > 867,868d866 > < # escape + > < $name = quotemeta $name; > > I'm currently writing a Perl module which uses Bio::NEXUS very > heavily. > I plan to distribute my modified Bio::NEXUS (with the above fix) along > with my module, which is also GPL. Once a fix has been issued, this > will > no longer be necessary. Hope that's OK. > > J. > -- > Jon Hill > AMCG, Earth Science and Engineering, > Imperial College London, SW7 2AZ. > Phone: 020 75941351 > Mob: 07748254812 > > <bio_nexus_bug.pl>
I should have closed this a year ago but I was not paying attention to the tracker system. This bug was fixed in 0.72 and a test was incorporated, as per our email exchange. Let me know if there are questions. Thanks again for your attention to Bio::NEXUS. Arlin