This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to extract specific location in .bam files

I would like to make a minimal example of my wgs .bam and .bam.bai files to accelerate pipeline testing. For example, i would like to select chr1:1-1e7 & chr1:1-1e7 regions and create that same .bam .bai file from them. How to accomplish that?

bam

1 answer

Using samtools view : Extract Reads From A Bam File That Fall Within A Given Region Check help page for samtools view for detailed options.

Log in to answer this question.