Unconfigured Ad

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

    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
            Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
            by SEQadmin2


            Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

            The systematic characterization of the human proteome has
            ...
            Yesterday, 11:48 AM
          • SEQadmin2
            Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
            by SEQadmin2



            Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
            ...
            07-09-2026, 11:10 AM
          • SEQadmin2
            Cancer Drug Resistance: The Lingering Barrier to Rising Survival
            by SEQadmin2



            Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

            There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
            07-08-2026, 05:17 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, Yesterday, 11:10 AM
          0 responses
          9 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-13-2026, 10:26 AM
          0 responses
          30 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-09-2026, 10:04 AM
          0 responses
          41 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-08-2026, 10:08 AM
          0 responses
          26 views
          0 reactions
          Last Post SEQadmin2  
          Working...