Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

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

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


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


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


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


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

            Comment

            Latest Articles

            Collapse

            • seqadmin
              Essential Discoveries and Tools in Epitranscriptomics
              by seqadmin




              The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
              04-22-2024, 07:01 AM
            • seqadmin
              Current Approaches to Protein Sequencing
              by seqadmin


              Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
              04-04-2024, 04:25 PM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, Yesterday, 11:49 AM
            0 responses
            15 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-24-2024, 08:47 AM
            0 responses
            16 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-11-2024, 12:08 PM
            0 responses
            61 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 04-10-2024, 10:19 PM
            0 responses
            60 views
            0 likes
            Last Post seqadmin  
            Working...
            X