This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error in GSNAP - unable to find genome in directory

I'm trying to use GSNAP (from the GMAP tools suite) to map some short reads to a genome (to remove some contamination later in the script), and I'm hitting on an error:

GSNAP version 2013-03-31 called with args: gsnap -D /<directory>/local-resources/ -d PhiX.fa --gunzip -B 4 -O -A sam -m 0.05 -t 24 control/Undetermined.fq.gz
Neither novel splicing (-N) nor known splicing (-s) turned on => assume reads are DNA-Seq (genomic)
Unable to find genome PhiX.fa in directory /<directory>/local-resources/.
Make sure you have typed the genome correctly, or use the -D flag
(or the -F flag for cmetindex or atoiindex) to specify a directory.
For example, '-D .' specifies this directory.

Now the /<directory>/local-resources/ does have the PhiX.fa genome in, but it appears that GSNAP cannot find it, despite looking in the correct directory. Switching out the -D to -D ., as suggested, and moving the reference FASTA file to the working directory does not change the error message.

Is this a bug with GSNAP? It's not my analysis script, so I'm trying to build it for my present situation.

It seems odd that it can't find the file even when it's in the working directory - GSNAP doesn't fail when used anywhere else in the script.

I will try an updated version of GSNAP (with updated flags), but I would prefer consistency of analysis through the script.

gmap gsnap

I have updated to the latest version of GSNAP (2015-11-20) and still I'm getting the errors. I have compared this with other places where I invoke GSNAP, but apart from the order of the flags, it's identical (and without errors).

Did you build an index for Phix.fa?

I'm not aware that I needed to build one - the FASTA file is very short, but if that's what it's looking for (and can't find) then that would explain the errors that I'm getting

2 answers

Folloiwng on from h.mon's comment up there (thanks), it did need to build an index using gmap-build (I'm not entirely sure why a c. 5500 base FASTA file needed one, but there you go).

You need to build index for your genome before running gmap/gsnap. Use the following command to build index:

gmap_build -d NAME -D PATH/to/build_dir genome.fasta

then use the NAME as reference to map.

Log in to answer this question.