How to compute average depth of coverage for expression matrix
So I am trying to find the average depth of coverage of 100 genes from a given reference genome in a given time interval 1 - 10.
I have 10 sorted, indexed bam files, and using samtools depth I was able to find each corresponding avg coverage for coverage base and the total base coverage, but how would I be able to find each gene's avg coverage from this data?
• 4,460 views
•
link
1 answer
To sort bam file:
samtools sort file.bam file.sortedInstall and run bedtools to get coverage:
coverageBed -d -abam file.sorted.bam -b /path/to/.bed/file/ref.bed > output.covThis will include names to the columns of the output: (reference, start position, end position, base, coverage at the position)
sed -i 1i" ref\tstart\tend\tbase\tcov " file.cov
You can use the output to calculate average coverages.
• 0 views
•
link
Log in to answer this question.
Check out bedtools: http://bedtools.readthedocs.org/en/latest/content/tools/coverage.html