[Bioperl-l] unblessed reference in $sam->pileup error.

Mark Aquino maquino at knome.com
Mon Apr 30 19:15:26 UTC 2012


Hi all,

I'm trying to call all bases from a bam and count their depths, at first I was doing this getting all alignments that cover a certain region, but realized that writing the logic to detect indels via the cigar string was a bit more complicated than I thought so I decided to try this with the pileup method from Bio::DB::Sam / Bio::DB::Bam::Pileup however I am getting this error:
Can't call method "b" on unblessed reference at ./coverageDepths.pl line 114, <STDIN> line 1. 


when trying to use the $pileup->alignment method.  Does anyone have any idea what I'm missing?
109	      $sam->pileup('1:550968-550969',
110         sub {
111             my ($seqid,$pos,$pileup) = @_;
112                 for my $p (@$pileup){
113                     if ($p->indel){ print "INDEL!\n"};
114                         my $b = $pileup->b;
115                         my $qbase = substr($b->qseq, $pileup->qpos,1);
116                         print "$qbase\n";
117                 }
118         });

Thanks,
Mark



More information about the Bioperl-l mailing list