Question: Bedtools Genomecoveragebed Usage : How To do per base coverage analysis for only chr21?
0
gravatar for gskbioinfo143
5.1 years ago by
India
gskbioinfo14360 wrote:

Hey any one pls explain how to do per base coverage analysis for only particular chr from given bam file using bedtools or GATK.

 

ADD COMMENTlink modified 5.1 years ago by Irsan7.1k • written 5.1 years ago by gskbioinfo14360
3
gravatar for Irsan
5.1 years ago by
Irsan7.1k
Amsterdam
Irsan7.1k wrote:

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

ADD COMMENTlink modified 5.1 years ago • written 5.1 years ago by Irsan7.1k

Hey thanks for the reply but the first command is taking time..i have given genome file which bedtools provided. need help.

can you pls explain how to do the same with GATK.

ADD REPLYlink written 5.1 years ago by gskbioinfo14360

Actually the only thing that this genome file needs to contain is:

chr1    249250621
chr10   135534747
chr11   135006516
chr12   133851895
chr13   115169878
chr14   107349540
chr15   102531392
chr16   90354753
chr17   81195210
chr18   78077248
chr19   59128983
chr2    243199373
chr20   63025520
chr21   48129895
chr22   51304566
chr3    198022430
chr4    191154276
chr5    180915260
chr6    171115067
chr7    159138663
chr8    146364022
chr9    141213431
chrX    155270560
chrY    59373566

 

Optionally you can remove the chrs for which you have no interest, can you try that?

ADD REPLYlink modified 5.1 years ago • written 5.1 years ago by Irsan7.1k

pls mention how much time it will take for first command..

ADD REPLYlink written 5.1 years ago by gskbioinfo14360
1

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!
 

ADD REPLYlink modified 5.1 years ago • written 5.1 years ago by Irsan7.1k

hey i have extracted chr21 from bam using samtools it took 1min then did per base coverage with bedtools coverage

ADD REPLYlink written 5.1 years ago by gskbioinfo14360

So it worked? Nice job!

ADD REPLYlink written 5.1 years ago by Irsan7.1k

yes it worked thanks

ADD REPLYlink written 5.1 years ago by gskbioinfo14360

how to find the no of reads matched in chr21 region? any visualization blocks?

ADD REPLYlink written 5.1 years ago by gskbioinfo14360
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1736 users visited in the last hour