I am using bowtie2, and due to the size of the SAM output, I would like to entirely avoid the SAM file, and pipe the results into samtools to convert the output to a BAM file. I am getting a little bit hung up on how to accomplish this.
I have tried a few different options:
The approach here: http://slhogle.github.io/2014/bowtie-and-samtools/
and here: http://www.metagenomics.wiki/tools/samtools/breadth-of-coverage
are both giving me an empty BAM file.
I have also tried:
bowtie2 -x [index] -U [reads] -S ${TMPDIR}/temp.sam | samtools view -bS > out.bam
To see if I would get anything different using the temp directory to store the SAM temporarily.
Edit in response to a comment to add the commands I have tried:
bowtie2 -x [index] -U [reads] -S - | samtools view -bS > out.bam
And
bowtie2 -x [index] -U [reads] -S - | samtools view -bS - > out.bam
I'm sure this has been done before, is there an obvious way to accomplish this task?
Thanks.
A: Alignment with bowtie2 but empty .fastq files
Why don't you write all the command lines you tried. It seems to me that the one you did write won't work, because it's not going to send output to samtools, it's writing it to temp.sam. Your first link is to bowtie, which might not work with bowtie2.