OLC-Bioinformatics/ConFindr

Error: Encountered error when attempting to run ConFindr on sample X. Skipping...

Closed this issue · 3 comments

Hi again,

I'm getting the following error:

2018-12-10 14:02:57 Welcome to ConFindr 0.4.7! Beginning analysis of your samples...
2018-12-10 14:02:57 Beginning analysis of sample X...
2018-12-10 14:02:57 Checking for cross-species contamination...
2018-12-10 14:03:52 Extracting rMLST genes...
2018-12-10 14:04:05 Quality trimming...
2018-12-10 14:04:06 Detecting contamination...
2018-12-10 14:04:06 Encountered error when attempting to run ConFindr on sample X. Skipping...
2018-12-10 14:04:06 Contamination detection complete!

Command I am running: confindr.py -i ./ -o ./results -fid _1_sequence -rid _2_sequence -k

Looking through the logfiles doesn't provide any clues why ConFindr is having trouble with my samples. Reads are processed and organism is detected. In the output dir, rmlst and trimmed .gz files are created (and contain sequences).

The following things I've tried resolve the issue:

  1. Reinstall ConFindr (through conda)
  2. Uninstall all packages and reinstall only specified versions of required packages
  3. Run the sample data and also receiving the same error (sampledata_confindr_log.txt)

Thanks,

Ammar

My first guess would be that something has gone wrong with the databases that ConFindr needs - try removing the /home/aaziz/.confindr_db folder and re-running the analysis, with a different output folder specified (if you've used the -k flag and try to re-run to the same output folder I'm pretty sure bad things happen).

If that doesn't work, you can try running ConFindr so that the error gets printed out - either use the following in python, replacing paths with your paths, or take the latest confindr.py from this repository and run it (I've updated to make it give the traceback on error instead of nothing):

from confindr import confindr
paired_reads = confindr.find_paired_reads('path_to_fastq_folder', forward_id='_R1', reverse_id='_R2')
for pair in paired_reads:
    confindr.find_contamination(pair=pair,
                                forward_id='_R1', # change if yours is different
                                threads=4, 
                                output_folder='path/to/output',
                                databases_folder='path/to/databases')

The next release will make it so that errors get printed out by default instead of covering them up.

Hopefully that helps, let me know if it doesn't and I'll keep troubleshooting!

Thanks for your help. The above script allowed me to narrow down the problem to... samtools again! Here is the error produced:

Traceback (most recent call last):
File "", line 6, in
File "/home/aaziz/bin/miniconda3/lib/python3.6/site-packages/confindr/confindr.py", line 584, in find_contamination
out, err = run_cmd(cmd)
File "/home/aaziz/bin/miniconda3/lib/python3.6/site-packages/confindr/confindr.py", line 40, in run_cmd
raise subprocess.CalledProcessError(p.returncode, cmd=cmd)
subprocess.CalledProcessError: Command 'samtools faidx /home/aaziz/.confindr_db/Escherichia_db.fasta' returned non-zero exit status 127

Running samtools gives me this error:

samtools: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file: No such file or directory

I think during installation of another package via conda, samtools was updated (to 1.9.X) and potentially that resulted in removal of that lib.

Next version returning traceback would be fantastic.

I've got a new version (0.4.8) put onto pypi that both gets the error traceback printed out if anything goes wrong, and removes the dependency on samtools, instead using pysam for all samtools-related things.

You should be able to get it installed within your conda environment with a pip install --upgrade confindr. I'll get the release pushed out to conda at some point within the next few days.

Hopefully that fully resolves your issues, let me know if it doesn't.