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
            Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
            by SEQadmin2



            CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

            Despite this, “CRISPR helped turn genome editing from a specialized technique into
            ...
            07-31-2026, 11:01 AM
          • 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
            ...
            07-20-2026, 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

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, Yesterday, 10:13 AM
          0 responses
          13 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-31-2026, 02:55 AM
          0 responses
          26 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-24-2026, 12:17 PM
          0 responses
          20 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 07-23-2026, 11:41 AM
          0 responses
          19 views
          0 reactions
          Last Post SEQadmin2  
          Working...