Hey any one pls explain how to do per base coverage analysis for only particular chr from given bam file using bedtools or GATK.
As a start, you need a file with the start and end coordinates of your chromosomes. Then prepare a bed-file for your given chr, e.g. chr21:
bedtools makewindows -g hg19-chrLengths.txt -w 1 | grep '^chr21\t' > chr21-bases.bed
Calculate coverage for each base
bedtools coverage -abam yourFile.bam -b chr21-bases.bed
You can circumvent the grep-part if you make sure that in the hg19-chrLengths.txt file only chr21 is there
Hey thanks for the reply but the first command is taking time..i have given genome file which bedtools provided. need help.
Can you please explain how to do the same with GATK.
Actually the only thing that this genome file needs to contain is:
Optionally you can remove the chrs for which you have no interest, can you try that?
pls mention how much time it will take for first command..
I did it only for chr21 produced an output file of 1.1 Gb and it took 3 minutes on 1 cpu at 2.67 Ghz. The more chromosomes you include and the longer they are, the longer it will take. Note: when you do this for the complete human genome, (1 row per base in the output) you get a file of 3 billion rows!
hey i have extracted chr21 from bam using samtools it took 1min then did per base coverage with bedtools coverage
So it worked? Nice job!
yes it worked thanks
how to find the no of reads matched in chr21 region? any visualization blocks?
Login before adding your answer.
Use of this site constitutes acceptance of our User Agreement and Privacy