1
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Jun 6, 2022 at 10:55

2 Answers 2

1
$\begingroup$

I think it is possible:

sambamba view --regions regions.bed --with-header --format=bam reads.bam  > filtered.bam
$\endgroup$
1
  • $\begingroup$ Hi @Pablo could you kindly edit your question inserting this as a suggestion? $\endgroup$
    – M__
    Jun 6, 2022 at 19:17
0
$\begingroup$

You need bedtools, specifically bedtools intersect command, not sambamba:

bedtools intersect -abam A.bam -b B.bed > A_in_N.bam
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.