phac-nml / staramr

Scans genome contigs against the ResFinder, PlasmidFinder, and PointFinder databases.
Apache License 2.0
120 stars 26 forks source link

Issue when running search #122

Closed izakbed closed 4 years ago

izakbed commented 4 years ago

Hi! I have recently tried to use staramr on campylobacter contigs for a project. I have tried the tutorial directly from the (github https://github.com/phac-nml/staramr/blob/master/doc/tutorial/staramr-tutorial.ipynb) as well as the contigs from my own data. When I get into the folder and run the following command staramr search -o out --pointfinder-organism salmonella .fasta as well as staramr search -o out .fasta I get the following error.

File "/usr/local/eme/lib/python3.6/site-packages/staramr/blast/JobHandler.py", line 286, in _make_blast_db subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True) File "/usr/local/eme/lib/python3.6/subprocess.py", line 418, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['makeblastdb', '-in', '/tmp/tmpj5hscyru/input-genomes/GCF_001478105.1.fasta', '-dbtype', 'nucl', '-parse_seqids']' died with <Signals.SIGILL: 4>.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/eme/bin/staramr", line 68, in args.run_command(args) File "/usr/local/eme/lib/python3.6/site-packages/staramr/subcommand/Search.py", line 468, in run unacceptable_num_contigs= args.unacceptable_num_contigs) File "/usr/local/eme/lib/python3.6/site-packages/staramr/subcommand/Search.py", line 286, in _generate_results report_all_blast, ignore_invalid_files, mlst_scheme) File "/usr/local/eme/lib/python3.6/site-packages/staramr/detection/AMRDetection.py", line 177, in run_amr_detection self._amr_detection_handler.run_blasts_mlst(files, mlst_scheme) File "/usr/local/eme/lib/python3.6/site-packages/staramr/blast/JobHandler.py", line 97, in run_blasts_mlst db_files = self._make_db_from_input_files(self._input_genomes_tmp_dir, files) File "/usr/local/eme/lib/python3.6/site-packages/staramr/blast/JobHandler.py", line 137, in _make_db_from_input_files future_blastdb.result() File "/usr/local/eme/lib/python3.6/concurrent/futures/_base.py", line 432, in result return self.get_result() File "/usr/local/eme/lib/python3.6/concurrent/futures/_base.py", line 384, in get_result raise self._exception File "/usr/local/eme/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, *self.kwargs) File "/usr/local/eme/lib/python3.6/site-packages/staramr/blast/JobHandler.py", line 289, in _make_blast_db err_msg = re.findall('REF|(.?)\'', err_msg)[0] IndexError: list index out of range

What is going wrong here? It seems like the temp file is not there.

apetkau commented 4 years ago

Hello @izakbed . Which version of staramr are you running (staramr --version)?

You can also try running:

makeblastdb -in GCF_001478105.1.fasta -dbtype nucl -parse_seqids

Since that is the command that seems to have failed. Note that the temp file is not there since it will be cleaned up by staramr before it exits.

izakbed commented 4 years ago

Hi @apetkau. Thanks for the speedy reply. I ran the both of the commands and the version is 0.7.1.

When I run the makeblastdb command I get this error.

makeblastdb -in GCF_001478105.1.fasta -dbtype nucl -parse_seqids

Building a new DB, current time: 07/04/2020 13:58:10 New DB name: /home/ibedard/staramrtutorial/staramr_tutorial/GCF_001478105.1.fasta New DB title: GCF_001478105.1.fasta Sequence type: Nucleotide Keep MBits: T Maximum file size: 1000000000B Illegal instruction (core dumped)

Any idea what the problem is? It might be due to permissions on the server I am using.

apetkau commented 4 years ago

Which version of BLAST are you using makeblastdb -version?

You can try running without -parse_seqids to see if there's something strange about the IDs in the file:

makeblastdb -in GCF_001478105.1.fasta -dbtype nucl

It could maybe be permissions though I think the only permission makeblastdb needs is to write to the same directory as the input file (to write the BLAST database).

izakbed commented 4 years ago

I could run makeblastdb -in GCF_001478105.1.fasta -dbtype nucl as root, but not as myself.

So it seems that makeblastdb, the program itself, attempts to create output as the owner of the the calling program, that is, makeblastdb. As makeblastdb is installed in /usr/local/eme/prokka2/bin/makeblastdb in a shared location for everyone, it is owned by root.

So, I made my own copy of the makeblastdb program with the following command.

cp /usr/local/eme/prokka2/bin/makeblastdb .

then I ran

./makeblastdb -in /tmp/GCF_001478105.1.fasta -dbtype nucl

Building a new DB, current time: 07/06/2020 16:41:19 New DB name: /tmp/GCF_001478105.1.fasta New DB title: /tmp/GCF_001478105.1.fasta Sequence type: Nucleotide Deleted existing Nucleotide BLAST database named /tmp/GCF_001478105.1.fasta Keep MBits: T Maximum file size: 1000000000B Adding sequences from FASTA; added 137 sequences in 0.0751979 seconds.

So it works when I run it directly from the copied version of the makeblastdb but I still get the same error message when I use search.

This is an odd error and I will try using a local device soon.

apetkau commented 4 years ago

If makeblastdb is creating output as the owner of makeblastdb it sounds like the setuid flag is set on that executable (https://en.wikipedia.org/wiki/Setuid).

However, as you've already seen, you can copy the executable and run as your user and it should work. It's likely not working through staramr since the copied version of makeblastdb is not in your PATH.

If it's possible, this is a situation where a package manager like conda (and the bioconda channel) could help (https://bioconda.github.io/user/install.html#install-conda). These will install staramr and all dependencies (including BLAST) into your own user account and setup the PATH and other environment variables for you. If you get conda installed and the proper channels (sources for software) setup you can install starmar with:

conda install staramr==0.7.1

I hope this helps.

izakbed commented 4 years ago

It was an issue with permissions. Thanks again for the help. This can be closed.

apetkau commented 4 years ago

Thank you for letting me know.