Thank you very much, updating to the lastest version right now.
Hi,
I am trying to subsample from a bam file using the samtools view -s command. This is working when sampling 50% or lower (-s 42.50, 42 being the seed), but anything higher fails (returns an empty file).
He are the exact commands I use
samtools view -s 0.25 -b chr6_all.bam > chr6_25p.sam #works
samtools view -s 0.50 -b chr6_all.bam > chr6_50p.sam #works
samtools view -s 0.75 -b chr6_all.bam > chr6_75p.sam #does not work
I also made sure that 49% is working, but 51% is not. Any ideas, suggestions, or is this an intended mechanic? There doesn't seem to be any documentation about the subsampling parameter in samtools docfile.
Thanks
2 answers
Subsampling not working for fractions above 50% is a known bug in samtools 0.1.18. (See [Samtools-help] Randomized Subsampling Bam File / Subsampling above 50%.)
The bug was fixed in March last year; samtools 0.1.19 contains the corrected version.
You could accept one of the answers as the final answer.
When subsampling with samtools or sambamba do all the mappings (uniques, multiple and null) of a read are included in the new bam file?
Log in to answer this question.
Hi! This post was very useful to me. I am trying however to visualise my reduced bam file on IGV but an index is required. Is there a way to create a index for the bam file that is randomly subsampled with samtools -s ?
Thanks
Giulia
samtools index, nothing special here
Thank you very much