This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bowtie2-build cannot use multiple cores

I tried running bowtie2-build as below

bowtie2-build \
--threads 8 \
"$path_genome" \
"$path_index"

and it gives the following error that threads is not defined.

Bowtie2 indexing genome 
bowtie2-build: unrecognized option '--threads' 
Bowtie 2 version 2.2.6 by Ben Langmead (langmea@cs.jhu.edu, www.cs.jhu.edu/~langmea) 
Usage: bowtie2-build [options]* <reference_in> <bt2_index_base>
    reference_in            comma-separated list of files with ref sequences
    bt2_index_base          write bt2 data to files with this dir/basename
*** Bowtie 2 indexes work only with v2 (not v1).  Likewise for v1 indexes. *** Options:
    -f                      reference files are Fasta (default)
    -c                      reference sequences given on cmd line (as
                            <reference_in>)
    --large-index           force generated index to be 'large', even if ref
                            has fewer than 4 billion nucleotides
    -a/--noauto             disable automatic -p/--bmax/--dcv memory-fitting
    -p/--packed             use packed strings internally; slower, less memory
    --bmax <int>            max bucket sz for blockwise suffix-array builder
    --bmaxdivn <int>        max bucket sz as divisor of ref len (default: 4)
    --dcv <int>             diff-cover period for blockwise (default: 1024)
    --nodc                  disable diff-cover (algorithm becomes quadratic)
    -r/--noref              don't build .3/.4 index files
    -3/--justref            just build .3/.4 index files
    -o/--offrate <int>      SA is sampled every 2^<int> BWT chars (default: 5)
    -t/--ftabchars <int>    # of chars consumed in initial lookup (default: 10)
    --seed <int>            seed for random number generator
    -q/--quiet              verbose output (for debugging)
    -h/--help               print detailed description of tool and its options
    --usage                 print this usage message
    --version               print version information and quit 
Error: Encountered internal Bowtie 2 exception (#1)

But, if I check the help for bowtie2-build, it's there.

[user@server dir]$ bowtie2-build --help
Bowtie 2 version 2.2.9 by Ben Langmead (langmea@cs.jhu.edu, www.cs.jhu.edu/~langmea)
Usage: bowtie2-build [options]* <reference_in> <bt2_index_base>
    reference_in            comma-separated list of files with ref sequences
    bt2_index_base          write bt2 data to files with this dir/basename
*** Bowtie 2 indexes work only with v2 (not v1).  Likewise for v1 indexes. ***
Options:
    -f                      reference files are Fasta (default)
    -c                      reference sequences given on cmd line (as
                            <reference_in>)
    --large-index           force generated index to be 'large', even if ref
                            has fewer than 4 billion nucleotides
    -a/--noauto             disable automatic -p/--bmax/--dcv memory-fitting
    -p/--packed             use packed strings internally; slower, less memory
    --bmax <int>            max bucket sz for blockwise suffix-array builder
    --bmaxdivn <int>        max bucket sz as divisor of ref len (default: 4)
    --dcv <int>             diff-cover period for blockwise (default: 1024)
    --nodc                  disable diff-cover (algorithm becomes quadratic)
    -r/--noref              don't build .3/.4 index files
    -3/--justref            just build .3/.4 index files
    -o/--offrate <int>      SA is sampled every 2^<int> BWT chars (default: 5)
    -t/--ftabchars <int>    # of chars consumed in initial lookup (default: 10)
    --threads <int>         # of threads
    --seed <int>            seed for random number generator
    -q/--quiet              verbose output (for debugging)
    -h/--help               print detailed description of tool and its options
    --usage                 print this usage message
    --version               print version information and quit

I am not sure what I am doing wrong.

bowtie2

Your post mentions two different version numbers...

1 answer

I think I have figured it out. It's probably a case of rubbish documentation. The switch for multi-cores seems to be -p.

Yet, this does not work for me

bowtie2-build \
-p 2 \
"$path_genome" \
"$path_index"

but this does work:

bowtie2-build -p 2 "$path_genome" "$path_index"

Strange! If anyone has any explanation, I am curious to know. Thx.

The backslash '\' is a convention to indicate that a multi-line text should be entered as as single-line command, without the backslash. The second command is the correct way to enter the text shown in the first example.

The documentation is not rubbish. The flag to specify the number of cores is '--threads' (not '-p'). But, as @WouterDeCoster said, you seem to have two different versions of Bowtie2 installed. The error message in your original post indicates that the flag was not implemented in the older version (2.2.6), whereas it's available in the newer version ('--help' is version 2.2.9).

If you think this is rubbish documentation... not very respectful and seems more like a problem with you reading the documentation.

Of course.. versions! Apologies for accusing the documentation. I was quite frustrated with the tuxedo suite in general. Anyhow, thanks for the explanation :-)

Log in to answer this question.