Closed jma1991 closed 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
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
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
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
Apologies, posted this issue in the wrong GitHub repository.
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