I have a very large bam file and I want to filter it to keep only a handfull of positions as defined in a bed file. Can I do this with sambamba or do i need another tool?
Thanks
Bioinformatics Stack Exchange is a question and answer site for researchers, developers, students, teachers, and end users interested in bioinformatics. It only takes a minute to sign up.
Sign up to join this communityI have a very large bam file and I want to filter it to keep only a handfull of positions as defined in a bed file. Can I do this with sambamba or do i need another tool?
Thanks
I think it is possible:
sambamba view --regions regions.bed --with-header --format=bam reads.bam > filtered.bam
You need bedtools
, specifically bedtools intersect command, not sambamba
:
bedtools intersect -abam A.bam -b B.bed > A_in_N.bam