arq5x / bedtools

A powerful toolset for genome arithmetic.
http://code.google.com/p/bedtools/
GNU General Public License v2.0
139 stars 86 forks source link

Piping BAM file between bedtools commands #126

Closed jma1991 closed 6 years ago

jma1991 commented 6 years ago

I am filtering reads in a BAM file based on their intersection with regions in two BED files. Separately the commands both work, but when I use a pipe to connect them, the command doesn't finish and an empty BAM file is created:

# Working 1 bedtools intersect -v -g Mmusculus_UCSC_mm10_SEQUIN.fasta.fai -sorted -abam Dam_Sequin_ESC_1M_Rep1_raw.bam -b Mmusculus_UCSC_mm10_ENCODE.bed > working1.bam

# Working 2 bedtools intersect -f 1.0 -g Mmusculus_UCSC_mm10_SEQUIN.fasta.fai -sorted -abam Dam_Sequin_ESC_1M_Rep1_raw.bam -b Mmusculus_UCSC_mm10_SEQUIN.bed > working2.bam

# Broken bedtools intersect -v -g Mmusculus_UCSC_mm10_SEQUIN.fasta.fai -sorted -abam Dam_Sequin_ESC_1M_Rep1_raw.bam -b Mmusculus_UCSC_mm10_ENCODE.bed | bedtools intersect -f 1.0 -g Mmusculus_UCSC_mm10_SEQUIN.fasta.fai -sorted -abam stdin -b Mmusculus_UCSC_mm10_SEQUIN.bed > broken.bam

I am using version: bedtools v2.26.0-148-gd1953b6

jma1991 commented 6 years ago

Apologies, posted this issue in the wrong GitHub repository.