Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • m_elena_bioinfo
    Member
    • Oct 2009
    • 99

    #1

    bioperl for samtools

    Hi users,
    I'm using Bio:B::Sam to analyse my data from Illumina.
    I have bam, sam and fasta files,but I don't know how use bio-samtools and its modules to interface to the pileup routines.
    Anyone could help me?!
    thanks a lot,
    ME
  • krobison
    Senior Member
    • Nov 2007
    • 734

    #2
    Which of the examples from the online documentation have you tried? The SNP caller example is a good illustration of writing a "walker" which will visit regions of the alignment and compute something.

    Comment

    • m_elena_bioinfo
      Member
      • Oct 2009
      • 99

      #3
      Hi Krobison, thanx for oyur quick reply! I'm using the indications from this site: http://search.cpan.org/~lds/Bio-SamT.../Bio/DB/Sam.pm . But the examples are not so easy to understand...How can I extract pileup from bam? Or from my pileup file, how can I extract the information? I really can't understand the example or the module!

      Comment

      • bbl
        Member
        • Jul 2010
        • 16

        #4
        Hello there,
        I recently have encoutered the same problem. Have you got it sorted? Perhaps, you can divulge a bit information... thanx

        Comment

        • krobison
          Senior Member
          • Nov 2007
          • 734

          #5
          Okay, here is one possible exam answer :-) The $sam argument needs to be the Perl object created from the .bam file. The callback scheme is probably not how I would have designed things, but that's a matter of personal design taste & one must work with the way the Perl interface is.

          This code could be a little rusty; I mostly use another tool now for SNP calling. Wouldn't shock me if there is a more compact & clever way to code this either.

          Code:
          package SnpCaller;
          ## please give Keith Robison, Infinity Pharmaceuticals & Omics! Omics! credit
          ## if you find this useful. 
          ## If you don't please post your improvement or criticism!
          
          sub new
          {
              my ($class)=@_;
              my $this={'minQ'=>25, 'minMinor'=>2, 'minDepth'=>4};
              bless $this,$class;
              return $this;
          }
          
          ### variation on "extremely stupid" SNP caller from Sam.pm docs
          
          sub callSnps
          {
              my ($this,$sam,$region)=@_;
              # region in form chr2:1-10
              my @SNPs=();
              my $snpCaller=sub 
              {
                  my ($seqid,$pos,$p)=@_;
                  # any speed gain from fetching long segment at start?
                  my $refbase=$sam->segment($seqid,$pos,$pos)->dna;
          
                  $refbase=~tr/a-z/A-Z/;
                  my %bases=();
                  my %maxQual=();
                  return if (scalar(@{$p})<$this->{'minDepth'});
                  for my $pileup(@{$p})
                  {
                      my $b=$pileup->b;
                      next if ($pileup->indel); # doesn't handle indels; need to in future
                      my $qbase=substr($b->qseq,$pileup->qpos,1);
                      next unless ($qbase=~/[ATCG]/i);
                      my $qscore=ord(substr($b->qscore,$pileup->qpos,1))-33;
                      next unless ($qscore>$this->{'minQ'});
                      $bases{$qbase}++;
                      $maxQual{$qbase}=$qscore if ($qscore>$maxQual{$qbase});
                  }
                  my $store=1;
                  if (scalar(keys %bases)==1)
                  {
                      $store=0 if (defined $bases{$refbase});
                  }
                  else
                  {
                      my @counts=sort {$b<=>$a} values %bases;
                      $store=0 if ($counts[1]<$this->{'minMinor'});
                  }
                  push(@SNPs,{'pos'=>$pos,'ref'=>$refbase, 'bases'=>\%bases,'maxQual'=>\%maxQual}) if ($store); 
              };
              $sam->pileup($region,$snpCaller);
              return @SNPs;
          }

          Comment

          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, 10-22-2026, 11:13 AM
          0 responses
          23 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-22-2026, 10:48 AM
          0 responses
          20 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...