PEPPAN icon indicating copy to clipboard operation
PEPPAN copied to clipboard

uberBlast.py / parseDiamond: FileNotFoundError

Open MrTomRod opened this issue 1 year ago • 1 comments

I get this error message:

$ PEPPAN --testunit
$ PEPPAN_parser -g examples/ST131.PEPPAN.gff -s examples/PEPPAN_out -t -c -a 95
(...)
2023-02-21 15:11:25.606204	Run BLASTn starts
2023-02-21 15:11:28.556587	Run BLASTn finishes. Got 7122 alignments
2023-02-21 15:11:28.557285	Run diamond starts
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "CONDAENV/peppan/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "CONDAENV/peppan/lib/python3.9/site-packages/PEPPAN/modules/uberBlast.py", line 19, in parseDiamond
    with open(fn) as fin :
FileNotFoundError: [Errno 2] No such file or directory: './NS_m9qoyw5k/aaMatch.0'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "CONDAENV/peppan/lib/python3.9/site-packages/PEPPAN/modules/uberBlast.py", line 345, in run
    blastab.append(tools[method.lower()](ref, qry))
  File "CONDAENV/peppan/lib/python3.9/site-packages/PEPPAN/modules/uberBlast.py", line 554, in runDiamond
    for r in self.pool.imap_unordered(parseDiamond, [ ['{0}.{1}'.format(aaMatch, id), self.refSeq, self.qrySeq, self.min_id, self.min_cov, self.min_ratio] for id in xrange(5) ]) :
  File "CONDAENV/peppan/lib/python3.9/multiprocessing/pool.py", line 870, in next
    raise value
FileNotFoundError: [Errno 2] No such file or directory: './NS_m9qoyw5k/aaMatch.0'
(...)
$ PEPPAN_parser -g examples/ST131.PEPPAN.gff -s examples/PEPPAN_out -t -c -a 95

The error does not cause the program to crash and I get seemingly normal output. Even step 2 seems to work normally.

What does that mean?!

This is how I installed PEPPAN:

conda config --add channels defaults
conda config --add channels conda-forge
conda config --add channels bioconda
conda create --prefix ./CONDAENV python=3.9
conda activate ./CONDAENV
conda install mmseqs2 blast diamond rapidnj fasttree
pip3 install peppan

Also:

 $ diamond --version
diamond version 2.0.15

See also full_output.zip

MrTomRod avatar Feb 21 '23 14:02 MrTomRod

I dumped some stuff here: https://github.com/zheminzhou/PEPPAN/blob/c2c8a19a12dc17664737779b35b02ccd575ebab3/modules/uberBlast.py#L552

How I dumped:

            if not os.path.isfile(f'{aaMatch}.{id}'):
                import random, string
                with open(f'logs/{"".join(random.choice(string.ascii_letters) for i in range(10))}', 'w') as f:
                    f.write(f'CMD=       {diamond_cmd}\n')
                    f.write(f'CMD_split= {diamond_cmd.split()}\n')
                    f.write(f'STDOUT:\n')
                    f.write(stdout)
                    f.write(f'\nSTDERR:\n')
                    f.write(stderr)

This creates 25 files, the contains is always very similar. Here's an example:

CMD=       conda-envs/peppan/lib/python3.9/site-packages/PEPPAN/dependencies/diamond blastp --no-self-hits --threads 1 --db "./NS_uaax4ld6/refAA.3" --query ./NS_uaax4ld6/qryAA --out "./NS_uaax4ld6/aaMatch.3" --id 40.0 --query-cover 25.0 --evalue 1 -k 10 --dbsize 5000000 --outfmt 101
CMD_split= ['conda-envs/peppan/lib/python3.9/site-packages/PEPPAN/dependencies/diamond', 'blastp', '--no-self-hits', '--threads', '1', '--db', '"./NS_uaax4ld6/refAA.3"', '--query', './NS_uaax4ld6/qryAA', '--out', '"./NS_uaax4ld6/aaMatch.3"', '--id', '40.0', '--query-cover', '25.0', '--evalue', '1', '-k', '10', '--dbsize', '5000000', '--outfmt', '101']
STDOUT:

STDERR:
diamond v0.9.24.125 | by Benjamin Buchfink <[email protected]>
Licensed under the GNU GPL <https://www.gnu.org/licenses/gpl.txt>
Check http://github.com/bbuchfink/diamond for updates.

#CPU threads: 1
Scoring parameters: (Matrix=BLOSUM62 Lambda=0.267 K=0.041 Penalties=11/1)
No such file or directory
Error: Error opening temporary file "./NS_uaax4ld6/diamond-tmp-ojBR6p

If I prevent the deletion of the temporary folder and execute the command after the fact, it works. This is the command I mean:

diamond blastp --no-self-hits --threads 1 --db "./NS_uaax4ld6/refAA.3" --query ./NS_uaax4ld6/qryAA --out "./NS_uaax4ld6/aaMatch.3" --id 40.0 --query-cover 25.0 --evalue 1 -k 10 --dbsize 5000000 --outfmt 101

MrTomRod avatar Feb 23 '23 05:02 MrTomRod