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
              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

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by SEQadmin2, 08-13-2026, 12:22 PM
            0 responses
            23 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 08-11-2026, 10:35 AM
            0 responses
            19 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 08-06-2026, 07:41 AM
            0 responses
            33 views
            0 reactions
            Last Post SEQadmin2  
            Started by SEQadmin2, 08-03-2026, 10:13 AM
            0 responses
            51 views
            0 reactions
            Last Post SEQadmin2  
            Working...