This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Split One Bam File Into Multiple Ones (One Per Feature From A Gff File)

Hi,

I've a bam file and a gff file containing features (like coordinates of ncRNA). Is it possible to split this bam file into multiple bam files to have one bam file per feature (And maybe specify parameters like -f in intersectBed )

Thanks a lot,

N.

bam split gff feature

1 answer

loop over the features of your gff and use samtools view to save each bam.

Usage:   samtools view [options] in.bam region

Options: -b       output BAM
         -o FILE  output file name [stdout]

Log in to answer this question.