Puzzling Bowtie2 Input Error -S flag
0
0
Entering edit mode
6 months ago
geneticatt ▴ 130

Hi all,

I've come across some puzzling Bowtie2 behavior. I was attempting to align paired-end reads to the mouse genome using the bowtie2-align command by calling the bowtie2 wrapper, as recommended. As you can see below, I pass my fastq files to the -1 and -2 flags by looping through a range of numbers and using those to access the indices of three arrays, one with the R1 fastq filenames, another with the R2 and a third with the output filename for expected bam output.

My mistake was to call the -S flag without following up with a filename. The error that Bowtie gave was the result of some very weird argument processing. It looks like when the -S flag is called incorrectly as I called it, the filename given to the -1 flag is appended to the filename given to -2 with a space between them. Needless to say, this was a confusing error to run into, given the discrepancy between my script and the error.

## My script

module load bowtie2

# Get Project Directory
BASE_DIR=$( pwd | rev | cut -d'/' -f2- | rev ) # get trimmed reads READS1=(${BASE_DIR}/trimmed/*_1.fastq )
READS2=( ${BASE_DIR}/trimmed/*_2.fastq ) OUT=($( echo "{READS1[@]}" | sed 's/_1.fastq/.bam/g' | xargs -n 1 basename ) ) # align reads to genome i=1 END={#READS1[@]}
for ((i=0;i<=END;i++))
do
bowtie2 --phred33 -p 16 -k 10 -x ${BASE_DIR}/genome/mus_musculus -1 "${READS1[i]}" -2 "${READS2[i]}" -S | samtools view -@ 12 -u - | samtools sort -@ 12 -n -o${BASE_DIR}/bowtie/${OUT[i]} - done  You can see the improperly called -S right before the pipe to samtools. ### The output [user@server]$ sh bowtie.slurm
Error: 0 mate files/sequences were specified with -1, but 1
mate files/sequences were specified with -2.  The same number of mate files/
sequences must be specified with -1 and -2.
Error: Encountered internal Bowtie 2 exception (#1)
Command: /opt/applications/bowtie2/2.4.2/bowtie2-align-s --wrapper basic-0 -p 16 -k 10 -x /path/to/genome/mus_musculus -S -1 -2 /path/to/trimmed/trimmed_SAMN08610886_2.fastq path/to/trimmed/trimmed_SAMN08610886_1.fastq
(ERR): bowtie2-align exited with value 1


I wanted to leave this here in case somebody else came across the same issue. I also am wondering if it's proper to report unhelpful error messages and weird output behavior to the tool maintainers.

Thanks for any input on this.

bash bowtie2 alignment shell • 549 views
0
Entering edit mode

Is there an open question here or you are just reporting your mistake?

0
Entering edit mode

I have resolved the issue, but I am also wondering if this is considered a bug that needs reporting.

0
Entering edit mode

I don't know if this would be considered a bug. If you used the -S flag then you should have provided a file name. bowtie is not aware of what you are doing outside its command line. Since you are piping the output directly into samtools you don't need that option.

0
Entering edit mode

Thanks for the reply. I'm aware that the option isn't needed, but the error is seemingly irrelevant and misleading. So my question is: Are misleading error messages considered bugs?