This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to calculate per base coverage from the .bam file?

Hi all, I have some genes which are expressed in differentially compare to wild type, so i want to calculate perbase coverage from the BAM files. How to calculate that one.

rna-seq next-gen r

samtools depth but may I ask why you want to do that?

I have to plot that expression. I have RPKM values for that gene but if I plot in the excel file it comes like a point. my idea is like showing the distribution of the expression. lets say x-axis is a length of the gene in the y-axis expression of the gene.

I do not really see how this would make sense. Gene coverage in RNA-seq is the sum of transcript/exon coverage so you cannot easily get a representative per-base coverage. Yes, gene expression is commonly reported as one value per gene, be it the RPKM metric or any other normalized expression value. What do you think would you gain from plotting a per-base coverage of a gene? Are you referring to exon usage?

actually it is not a gene. it is a snoRNA. Just for saying i wrote as a gene. but when i try samtool depth

samtools depth -b missed_bed.bed -f PC1_Yale_PRS_sorted.bam

i got error

"Does the file "PC1_Yale_PRS_sorted.bam" really contain a list of files and do all exist?"

I really don't know???

1 answer

Purely from the technical side the command is samtools depth -b missed_bed.bed PC1_Yale_PRS_sorted.bam without -f. Explore if -a might help as well.

got it....now its fine

Log in to answer this question.