0

I'm using the software Bowtie 2 which aligns genome sequences. I have all my indexes in a directory miniReference1.

When I call Bowtie2 with the -x <dir> option I get the error that my index is not a Bowtie 2 index. What am I doing wrong? Below is a screenshot:

Peter - Reinstate Monica
  • 15,048
  • 4
  • 37
  • 62
  • I am sorry, this is my first time here and I don't know why the pic wasn't uploaded. (Thanks for the useful correction) – Raghad Shurpaje Oct 01 '22 at 10:25
  • And right, I am using bowtie2 for alignment and this is my code // bowtie2 -x miniReference -1 Sample_R1_trimmed.fq -2 Sample_R2_trimmed.fq -S Align – Raghad Shurpaje Oct 01 '22 at 10:27

3 Answers3

1

The -x argument takes the path to the basename of the index. That means, if the index called miniReference1.{suffix} is inside a folder also called miniReference1 then it must be -x path/to/miniReference1/miniReference1. There is no need to use this variable, just use the plain path.

ATpoint
  • 603
  • 5
  • 17
1

I had a similar issue running bowtie 2.5.0 against index files built by bowtie 2.4.5. The error message shows readU: No such file or directory even though the files are there.

enter image description here

I rebuilt the indexes using bowtie 2.5.0 and the issue was resolved. So I'd suggest rebuilding the indexes using the same version as the aligner, and then running it again.

Anugerah Erlaut
  • 990
  • 13
  • 23
-1

I'm quoting the relevant part of the manual:

-x           The basename of the index for the reference genome. The basename is the name of any of the index files up to but not including the final .1.bt2 / .rev.1.bt2 / etc. bowtie2 looks for the specified index first in the current directory, then in the directory specified in the BOWTIE2_INDEXES environment variable. [Emphasis by me.]

After reading this, I assume that what was missing is to tell BowTie2 the directory it is supposed to look in by setting the environment variable BOWTIE2_INDEXES. In bash you would do that by issuing the command

export BOWTIE2_INDEXES=miniReference1

If that doesn't help try to provide the absolute path. It is unclear to me whether Bowtie2 expects a Posix path name like /c/Users/raghdad/Documents/project-x/sequences/miniReference1 or a Windows path name like C:\Users\.... (pwd in your terminal gives you the Posix name for the current directory).

The -x file base name argument, miniReference1, is correct but does not name a directory; instead, it tells BowTie2 the set of indexes you want to work with, which is identified by the common "base name" of the files (the part up to the first dot). The reason for this scheme is probably that you could have different sets of indexes in the same directory, and each set would have a distinct and unique base name. Of course your way of putting each set in its own directory appears to be much cleaner, unless there is a reason to assess several index sets in one go.

Peter - Reinstate Monica
  • 15,048
  • 4
  • 37
  • 62
  • Thanks, I tried this command (export BOWTIE2_INDEXES=miniReference1) and it gives this error (bowtie2-align exited with value 1) – Raghad Shurpaje Oct 01 '22 at 11:20
  • Again I wrote the full path of the index but gives me the same error ( "miniReference1" does not exist or is not a Bowtie 2 index) – Raghad Shurpaje Oct 01 '22 at 11:21
  • Have you resolved this? I'm seeing the same errors too. All the input files are there, but somehow bowtie2 is not reading it. – Anugerah Erlaut Nov 23 '22 at 09:17
  • @AnugerahErlaut You may want to ask the OP, Raghdad. I have never used the program but simply checked the manual. Apparently what I understood doesn't work or can be achieved easier with AtPoint's answer. Did you try supplying the entire path to the index file as suggested by AtPojnt? – Peter - Reinstate Monica Nov 23 '22 at 09:48
  • Yes, I've tried supplying the whole directory, but bowtie2 still fails to get the files and directory. I'm using Bowtie2 2.5.0 from Bioconda, running on mac. My friend was able to run it just fine, so there might be a probem with my installation. – Anugerah Erlaut Nov 24 '22 at 06:17
  • I think the issue was with the index files. They were built using Bowtie 2.4.5. The index files were rebuilt using Bowtie 2.5.0 and they work now. – Anugerah Erlaut Nov 25 '22 at 00:32
  • @AnugerahErlaut That is very interesting and may bite a few more users. Do you want to write a short answer explaining that? I could do it as well but it's your finding! – Peter - Reinstate Monica Nov 25 '22 at 05:22
  • 1
    Added the answer :) – Anugerah Erlaut Nov 25 '22 at 08:14