Filtering bam file based on depth determined through samtools depth
Hi All,
I have a bam file and I calculated read depth using samtools depth and I now want to filter the bam file to have only the contigs that have a depth between a certain value. I was able to filter the samtools output to create a txt file that only contains the depth region im looking for, but Im struggling to then filter the bam file with this information. The depth file has three columns, the contig name, the POS, and the depth
I attempted to remove the depth column and use grep to search the bam file, but my output was empty. I also tried to find answers with awk, but quickly got confused as I am still a fairly novice coder. Any ideas on how to proceed would be greatly appreciated.
• 63 views
Read more here: Source link