Skip Menu |
 

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

Report information
The Basics
Id: 81949
Status: open
Priority: 0/
Queue: Bio-SamTools

People
Owner: Nobody in particular
Requestors: miker [...] htblis.com
Cc:
AdminCc:

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



Subject: Documentation bug
Date: Thu, 13 Dec 2012 12:02:06 -0800
To: bug-Bio-SamTools [...] rt.cpan.org
From: Michael Rogoff <miker [...] htblis.com>
In the pileup example at http://search.cpan.org/~lds/Bio-SamTools/lib/Bio/DB/Sam.pm#The_generic_fetch()_and_pileup()_methods I believe the example code is incorrect. my $depth = 0; my $positions = 0; my $callback = sub { my ($seqid,$pos,$pileup) = @_; next unless $pos >= 501 && $pos <= 600; $positions++; $depth += @$pileup; } $sam->pileup('seq1:501-600',$callback); print "coverage = ",$depth/$positions; Specifically, the callback method. I think the 'next' is out of context and will cause unexpected results if the callback is defined in a loop. I think the callback should simply do nothing if the reported position is outside the requested range, as shown below. As a side note a semi-colon is needed after the callback definition. my $depth = 0; my $positions = 0; my $callback = sub { my ($seqid,$pos,$pileup) = @_; if ($pos >= 501 && $pos <= 600) { $positions++; $depth += @$pileup; } }; $sam->pileup('seq1:501-600',$callback); print "coverage = ",$depth/$positions;
Download (untitled) / with headers
text/html 11.4k
From: dan.bolser [...] gmail.com
Is the code in GitHub or similar? You could submit this as a patch.
From: dan.bolser [...] gmail.com
Download (untitled) / with headers
text/plain 252b
On Thu Aug 20 08:32:35 2015, dan.bolser wrote: Show quoted text
> Is the code in GitHub or similar? You could submit this as a patch.
Finally found it here: https://github.com/GMOD/GBrowse-Adaptors Can you submit a pull request there (else I can do it for you)? Ta,


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.