Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • boetsie
    Senior Member
    • Feb 2010
    • 245

    #1

    base coverage per position on scaffolds

    Hi all,

    i've mapped my reads with Bowtie to a number of scaffolds, and now i want to know on every position on the scaffolds what the coverage is. Does anyone know how to do this, or is there a script/program available?

    As output I want something like;

    scaffold pos coverage
    scaffold1 1 4
    scaffold1 2 6
    scaffold1 3 10
    ...
    scaffold2 1 5
    scaffold2 2 15
    ...

    Thanks in advance,
    Marten
  • natstreet
    Member
    • Nov 2009
    • 83

    #2
    If you produced a sam file using bowtie, you can convert this to bam using samtools and then use bedtools to get per position coverage information.

    Comment

    • drio
      Senior Member
      • Oct 2008
      • 323

      #3
      Use samtools pileup:

      Code:
      $ samtools pileup -f your_ref.fa your.bam
      Column # 4 is what you wanted.
      -drd

      Comment

      • boetsie
        Senior Member
        • Feb 2010
        • 245

        #4
        Thanks both for your reply. I've used Drio's method since it's the easiest one. It works very good!

        Comment

        • bfantinatti
          Member
          • Aug 2012
          • 22

          #5
          Different values

          Hello there, I had the same problem, and previous posts solved my problems. But there is an little detail:
          I have a bam file, and used mpileup to list the per position coverage. Resulted in a file with some columns where the column #4 is the coverage. But opening in Tablet the same bam file using the same reference genome, the coverage number are not the same. Some one knows what is happening?
          Thank you a lot

          Comment

          • whataBamBam
            Member
            • May 2013
            • 27

            #6
            I'm doing this sort of thing at the moment and just as the following snippet of Perl is really useful for working with Bam files..

            Code:
            #!/usr/bin/perl
            open(INFILE,"samtools view $ARGV[0] |");
            while(<INFILE>)
            {
            	#do something with $_;
            
            }
            You can also say..

            Code:
            #!/usr/bin/perl
            open(INFILE,"samtools mpileup $ARGV[0] |");
            while(<INFILE>)
            {
            	#do something with $_;
            
            }
            And the coverage is in column 4. I'm just adding this post to caution that mpileup doesn't report the positions where coverage is zero (my source of this info being some other posts on seqanswers).. but samtools depth does report the zero's.

            Does anyone have a nice way to deal with multiply mapping reads here? The standard way to deal with a read that maps to multiple contigs is to count it towards the coverage at every position where it maps right?

            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-15-2026, 10:52 AM
            0 responses
            17 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-14-2026, 05:39 AM
            0 responses
            26 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-13-2026, 09:56 AM
            0 responses
            22 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-09-2026, 11:14 AM
            0 responses
            28 views
            0 reactions
            Last Post SEQadmin2  
            Working...