Subject: | $index undefined prior to coverage call |
Date: | Fri, 15 Jan 2010 09:01:53 +1030 |
To: | bug-Bio-SamTools [...] rt.cpan.org |
From: | Dan Kortschak <dan.kortschak [...] adelaide.edu.au> |
Hi Lincoln,
Preamble:
I'm writing a bioperl wrapper for bowtie that makes use of the
Bio::DB::Sam module to parse the bowtie output (via
Bio::Assembly::IO::sam).
There is a weird dependency issue that I don't understand between the
bioperl WrapperBase/CommandExts module the bowtie module uses that has
cause B:DB:Sam to fail (error below) - this was not the case in my first
version that did not use CommandExts nor in a kludge version that
modifies the inheritance of CommandExts to be a derived class from
WrapperBase rather than MAJ's designed case where it is an extension to
WrapperBase.
Details:
$ uname -a # debian lenny
Linux spawn 2.6.26-2-amd64 #1 SMP Wed Aug 19 22:33:18 UTC 2009 x86_64 GNU/Linux
$ perl -v
This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi
Details for 'Bio::DB::Sam'
Author Lincoln D. Stein (lincoln.stein@gmail.com)
Description None given
Development Stage Unknown
Installed File /usr/local/lib/perl/5.10.0/Bio/DB/Sam.pm
Interface Style Unknown
Language Used Unknown
Package Bio-SamTools-1.09.tar.gz
Public License Unknown
Support Level Unknown
Version Installed 1.09
Version on CPAN 1.09
Non-working bioperl version: r16693 (bioperl-run) and r16692 (bioperl-live)
Working bioperl version: r16689 (bioperl-run) and r16690 (bioperl-live)
Test script - requires bowtie to be install. All necessary data files
are in the bioperl-run t/ filesystem or the bowtie src package:
#!/usr/bin/perl
use strict;
use warnings;
use Bio::Tools::Run::Bowtie;
# these will depend on your src location for bioperl-live and bioperl-run
my $rdq = '/usr/local/src/bioperl-run/t/data/bowtie/reads/e_coli_1000.fq';
my $refseq = '/usr/local/src/bioperl-run/t/data/bowtie/indexes/e_coli';
my $buildfac = Bio::Tools::Run::Bowtie->new(
-command => 'build'
);
# located in bowtie src directory
my $index = $buildfac->run('/usr/local/src/bowtie-0.11.3/genomes/NC_008253.fna','e_coli');
my $bowtiefac = Bio::Tools::Run::Bowtie->new(
-command => 'single',
-max_seed_mismatches => 2,
-seed_length => 28,
-max_qual_mismatch => 70,
-sam_format => 0
);
my $align = $bowtiefac->run($rdq,$index);
print "$align\n";
open (IN,$align);
my $lines =(my @lines)= <IN>;
print @lines;
print "\n\n$lines\n";
close IN;
$bowtiefac = Bio::Tools::Run::Bowtie->new(
-command => 'single',
-max_seed_mismatches => 2,
-seed_length => 28,
-max_qual_mismatch => 70
);
$align = $bowtiefac->run($rdq,$index);
print $align,"\n";
print "Contigs: ", $align->get_nof_contigs, "\tSinglets: ", $align->get_nof_singlets, "\n";
print "In index: $index\n";
print "Contigs:\n";
for ($align->all_contigs) {
print $_->get_consensus_sequence->seq,"\n";
}
Returned error:
[fai_load] build FASTA index.
[bam_index_build] creating index for /tmp/zJZ0YTTQ0F/JcG1TNxxJI.srt.bam
[bam_index_load] fail to load BAM index.
Can't call method "coverage" on an undefined value at /usr/local/lib/perl/5.10.0/Bio/DB/Sam.pm line 1778.
I have looked into offending code and the seems to be the result of
$index not be returned with a defined value at 1777 in
`Bio::DB::Sam.pm'. I'm afraid even after an hour of following it with
the debugger I have no idea why or why it depends on the inheritance of
an indirectly calling object. Sorry.
It may be an issue with bioperl itself (the Bio::Assembly::IO module
most likely, though the files appear to be present after B:A:IO has
passed control to B:DB:Sam, so I'm unclear on this).
thanks for your time
Dan Kortchak