GregoryFaust / samblaster

samblaster: a tool to mark duplicates and extract discordant and split reads from sam files.
MIT License
225 stars 30 forks source link

Pipe output to samblaster from bwa-mem2 #54

Closed Talo07 closed 3 years ago

Talo07 commented 3 years ago

Hi,

I am trying to upgrade my command from bwa to bwa-mem2. This command usually works. `bwa mem -M -R "@RG\tID:id\tSM:sample\tLB:lib" human_g1k_v37.fasta sample.1.fq sample.2.fq \ | samblaster -M --excludeDups --addMateTags --maxSplitCount 2 --minNonOverlap 20 \ | samtools view -S -b - \

sample.bam`

Once I start using bwa-mem2, the piping breaks. `bwa-mem2 mem -M -R "@RG\tID:id\tSM:sample\tLB:lib" human_g1k_v37.fasta sample.1.fq sample.2.fq \ | samblaster -M --excludeDups --addMateTags --maxSplitCount 2 --minNonOverlap 20 \ | samtools view -S -b - \

sample.bam`

samblaster: Version 0.1.26 samblaster: Inputting from stdin samblaster: Outputting to stdout

Executing in AVX2 mode!!

Important parameter settings: BATCH_SIZE: 512 MAX_SEQ_LEN_REF: 256 MAX_SEQ_LEN_QER: 128 MAX_SEQ_LEN8: 128 SEEDS_PER_READ: 500 SIMD_WIDTH8 X: 32 SIMD_WIDTH16 X: 16 AVG_SEEDS_PER_READ: 64 samblaster: Input file is empty. Exiting. samblaster: Premature exit (return code 1).

Do you have any idea to run samblaster from bwa-mem2 ??

GregoryFaust commented 3 years ago

This appears to be an error coming from BWA, not samblaster. All samblaster output to stderr is prepended with "samblaster: " so you can distinguish those from messages from other tools in a pipe. As you can see, samblaster is telling you it is receiving an empty input file. For some reason BWA is not outputting anything. perhaps due to the missing RG ID it is warning you about. Does BWA-MEM2 require you to remake its index files? Have you tried just piping the output of the BWA-MEM2 command into head just to see if it works on its own?