Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lv Ray
    Member
    • Jun 2014
    • 42

    #1

    Calculate depth of every base position

    I have the sorted bam file, and I want to calculate the depth of every position on genome including some positions uncovered by reads(marked as: chr pos 0). I have tried samtools depth, but it seems don't count some position(because I count the row number, and not equal to the total number of genome bases).
    Any advice about this would be much appreciated, thank you.
  • blakeoft
    Member
    • Oct 2013
    • 79

    #2
    I use bedtools genomecov. There are several output options, but I prefer to run
    Code:
    bedtools genomecov -bg -ibam your_bam.bam > your_bam.bedgraph
    The fields in the output are chr, start, end and then depth. For example, you might see something like
    Code:
    chr1  554304  554309  5
    chr1  554309  554313  6
    This means that the depth is 5 from 554304 to 554309 and then the depth is 6 from 554309 to 554313 (I'm pretty sure it's not inclusive on the right endpoint) on chromosome 1.

    There are some other options that I haven't actually explored myself, including adding "-d" to the code above that seems to output the depth at every single position, but this would make the file much larger than it would need to be and still contain exactly the same information that you'd have without "-d".

    Read more about genomecov here.

    Edit: samtools depth might do the same thing as I described above. I don't know since I haven't actually used it. You might want examine its output and see if it's presented in (what I like to call) the RLE way, like genomecov does with just the "-bg" parameter.
    Last edited by blakeoft; 10-16-2014, 12:25 PM.

    Comment

    • WhatsOEver
      Senior Member
      • Apr 2012
      • 215

      #3
      Just a small addition:

      You need to call bedtools genomcov with -bga to get regions with 0 coverage. The rest blakeoft explained is correct.

      Comment

      • blakeoft
        Member
        • Oct 2013
        • 79

        #4
        Oops. I misread what Lv Ray posted. I thought that "marked as: chr pos 0" meant that you wanted to start the indexing at zero rather than one. Yes, WhatsOEver is correct. Thanks for clarifying that by the way.

        For the record, this is the line you'll want to execute
        Code:
        bedtools genomecov -bga -ibam your_bam.bam > your_bam.bedgraph

        Comment

        • Brian Bushnell
          Super Moderator
          • Jan 2014
          • 2709

          #5
          BBTools contains a tool called pileup.sh, which can also do this rapidly from an unsorted sam or bam file.

          pileup.sh -Xmx16g in=mapped.sam basecov=coverage.txt

          It can also generate the coverage while mapping, if desired.

          Comment

          • Lv Ray
            Member
            • Jun 2014
            • 42

            #6
            Thank you all. I will try the bedtools, and i will let u know what my result. Thanks again.

            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
            28 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-22-2026, 10:48 AM
            0 responses
            21 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-15-2026, 10:52 AM
            0 responses
            38 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 10-14-2026, 05:39 AM
            0 responses
            44 views
            0 reactions
            Last Post SEQadmin2  
            Working...