Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tirohia
    Member
    • Nov 2011
    • 47

    #1

    iterator in sam.pm returning nonexistant objects.

    Or, at least, that is what it looks like to me. If anyone could tell me what's going on here, I'd be grateful.

    I have aligned the reads in the transcriptome to a reference genome using bwa and stored the results in a bam file. I am then wanting to go through and count how many reads of the reads are hitting each gene.

    I attempt to access the mapped reads in the bam file like this:

    Code:
    my $sam = Bio::DB::Sam->new(-bam  =>"SRR641211.bam");
    my $iterator = $sam->features(-iterator => 1,  -flags    => {M_UNMAPPED=>0});
    
    while (my $align = $iterator->next_seq) {
            print $align->seq->id."\n";
            print $align->seq->seq."\n"
    }
    and this works fine for most of the entries in the bam file. Rougly every 20th or so entry will throw up this:
    Use of uninitialized value $start in subtraction (-) at /usr/local/lib64/perl5/Bio/DB/Sam.pm line 1452.
    Use of uninitialized value $end in subtraction (-) at /usr/local/lib64/perl5/Bio/DB/Sam.pm line 1452.

    The sequence ID that it then returns is the always the id of the last header in corresponding sam file. And the sequence returned is 'N'

    I've had a look at the relevant part of Sam.pm

    Code:
    1446 sub can_do_seq {
    1447     my $self = shift;
    1448     my $obj  = shift;
    1449     return
    1450         UNIVERSAL::can($obj,'seq') ||
    1451         UNIVERSAL::can($obj,'fetch_sequence');
    1452 }
    1453
    1454
    1455 sub seq {
    1456     my $self = shift;
    1457     my ($seqid,$start,$end) = @_;
    1458     my $fai = $self->fai or return 'N' x ($end-$start+1);
    1459     return $fai->can('seq')            ? $fai->seq($seqid,$start,$end)
    1460           :$fai->can('fetch_sequence') ? $fai->fetch_sequence($seqid,$start,$end)
    1461           :'N' x ($end-$start+1);
    1462 }
    And the fact that it's returning N for the sequence makes sense to me. Not so sure about why it's returning that last header though. Or why the error is occuring in the first place. The iterator should only be getting sequence objects from the bam file. This makes it looks like it's picking up sequence objects from the bam file that aren't there and then throws an error when it can't fetch the sequence id or sequence. Can anyone enlightne me as to what's going on here? Is there anything else I can post here that would help understand the problem?

    Cheers
    Ben.

Latest Articles

Collapse

  • SEQadmin2
    Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
    by SEQadmin2



    Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

    Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
    ...
    10-14-2026, 09:55 AM
  • SEQadmin2
    New Genomics Technologies Take Aim at Long-Standing Limits
    by SEQadmin2


    Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

    We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
    ...
    09-28-2026, 10:25 AM

ad_right_rmr

Collapse

News

Collapse

Topics Statistics Last Post
Started by SEQadmin2, Yesterday, 11:13 AM
0 responses
19 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, Yesterday, 10:48 AM
0 responses
18 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, 10-15-2026, 10:52 AM
0 responses
36 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, 10-14-2026, 05:39 AM
0 responses
42 views
0 reactions
Last Post SEQadmin2  
Working...