View Single Post
Old 07-29-2013, 03:02 AM   #5
dlawrence
Junior Member
 
Location: South Australia

Join Date: Mar 2012
Posts: 8
Default

Install bedtools and then a small script like the below should do it:

Code:
BAM=foo.bam
MIN_DEPTH=10

genomeCoverageBed -ibam ${BAM} -bg | awk -v "min_depth=${MIN_DEPTH}" '{split($0, cols,"\t"); if (int(cols[4]) > min_depth) { print $0; }}' > min_depth_regions.bedgraph

intersectBed -abam ${BAM} -b min_depth_regions.bedgraph > minimum_depth.bam
dlawrence is offline   Reply With Quote