Entering edit mode
3.3 years ago
hivemind
▴
20
Hi,
I have .bam files for blood samples from which I extract signals. Let's assume my samples have a 30x coverage and my signal of interest is nicely detectable. To see how well the signal is detectable with lower coverage samples, I want to downsample to 20x, 10x, etc. Is there an easy way to do this?
So far I had a closer look at samtools view -s, but it takes only the target fraction and not a target coverage. Is there a program that lets me specify the target coverage that generalizes well for multiple samples with different start coverage?
If you want to downsample from 30x to 20x then then just do
samtools --subsample 0.66 .....
This assumes that unaligned reads are not in the BAM file? If they are then it may be best to filter those out first.
someX
coverage is a fluid term and subject to interpretation so it could mean different things to different people.I know... If I had one sample or even five samples this would be my solution. I have hundreds of samples, all with different coverage and I was wondering whether there is a simpler solution that for example caps the max coverage to a certain value so that I don't have to calculate the fraction for each sample.