This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Calculate Mapping Density Along Chromosome Coordinates

As title I hope to calculate mapping density for chromosome 2,(doubt there's some hotspot for mapping). And eventually plot the histogram for visualization.

How can I do this? Use python or R? thx

r

2 answers

You give very little information, so I can only give you a general answer and assume you have a mapping in SAM or BAM format for which you want to know the vertical coverage.

There are many possibilities, depending on what you want exactly and size of your data among others. One of them is using genomeCoverageBed from BEDtools:

genomeCoverageBed -ibam sample.bam -d -g genome.bed

Another is looking at the fourth or so column of samtools mpileup results.

Just one note - if you are using BAM, the -g option is no longer needed (as of v2.13.1), as the chrom sizes are identified in the BAM header

Have you looked at:

  • BEDtools
  • pysam (python)
  • IRanges (R/Bioconductor)
  • samtools

Log in to answer this question.