Hi I want to calculate how many reads from a BAM file (150bp paired end illumina) are in each 20kb non-overlapping windows across the genome. I have constructed the bed files of 20kb windows using bedtools makewindows. I am using bedtools intersect to calculate the number of reads from the bam files. Here is the exact command that I use:
bedtools intersect -a myBAMfile -b my bedfile of 20kb windows -c -bed > output.bed
I used - c to output the counts and -bed to force output a bed file basically. I wanted some result like this
chr start end counts
1 a b n
however the results output was a huge (45GB) file that looks something like this
1 9999 10047 HWI-ST208:510:C2PKUACXX:1:1307:7971:38840/2 0 + 9999 10047 0,0,0 1 48, 0, 0
1 10000 10051 HWI-ST208:510:C2PKUACXX:1:1101:10183:165157/2 0 + 10000 10051 0,0,0 1 51, 0, 0
1 10001 10052 HWI-ST208:510:C2PKUACXX:1:1105:4675:14114/2 0 + 10001 10052 0,0,0 1 51, 0, 0
1 10001 10052 HWI-ST208:510:C2PKUACXX:1:2108:19598:121982/1 0 + 10001 10052 0,0,0 1 51, 0, 0
1 10002 10053 HWI-ST208:510:C2PKUACXX:1:1302:15349:25257/2 0 + 10002 10053 0,0,0 1 51, 0, 0
1 10003 10054 HWI-ST208:510:C2PKUACXX:1:1104:15953:82940/2 0 + 10003 10054 0,0,0 1 51, 0, 0
1 10003 10054 HWI-ST208:510:C2PKUACXX:1:1306:9147:59251/1 0 + 10003 10054 0,0,0 1 51, 0, 0
1 10004 10055 HWI-ST208:510:C2PKUACXX:1:1202:10485:85215/1 0 + 10004 10055 0,0,0 1 51, 0, 0
1 10004 10054 HWI-ST208:510:C2PKUACXX:1:1303:7159:34459/2 0 + 10004 10054 0,0,0 1 50, 0, 0
1 10004 10039 HWI-ST208:510:C2PKUACXX:1:2103:9398:104872/2 0 + 10004 10039 0,0,0 1 35, 0, 0
Can anyone tell me what I went wrong using bedtools?
Hi sorry this is the output I have from running my command