Incidentally, you can skip the reformat step - bbduk.sh will allow "out=stdout.bam" also :)
Pipe BBMap reformat output into SAMtools
Hi all,
I am wondering if I can pipe output from reformat.sh in BBMap into SAMtools view. My goal is to take a set of fastq and return an unaligned BAM headed with sequence dictionary (this is for use in GATK4). Using some GATK test data this part works (of course!):
bbduk.sh in1=6484_snippet_1.fastq in2=6484_snippet_2.fastq trimq=30 out=stdout.fq | reformat.sh in=stdin.fq out=stdout.bam
I suppose the question then is: can I force reformat.sh to produce a BAM without specifying ".bam" ending? Or, what form does 'stdout.bam' take and how can SAMtools recognise it? Or, can reformat.sh do the reheader itself?
All help much appreciated,
Bruce.
• 4,233 views
•
link
1 answer
To answer my own Q:
bbduk.sh in1=6484_snippet_1.fastq \
in2=6484_snippet_2.fastq \
trimq=30 out=stdout.fq \
| reformat.sh in=stdin.fq \
out=stdout.bam \
| samtools view -hb - | samtools reheader 6484_snippet_header.sam - > 6484_snippet.rh.bam
• 0 views
•
link
Log in to answer this question.
See Piping and Screen Output at https://github.com/BioInfoTools/BBMap/blob/master/docs/UsageGuide.txt#L18
OK, I had read that, just tried a few things and it seems you have to stream through
samtools view:returns
[W::hts_close] EOF marker is absent. The input is probably truncated.returns a reheaded BAM! Thanks for the response and making me think a bit more.