FileNotFoundError: [Errno 2] No such file or directory

Issue #111 closed
Yi Liu created an issue

Hi Simon,

Thanks for providing this powerful tool!

When the program runs to the second step, it gives me the errors as below:

(iphop_env) emma@emma-PowerEdge-R730xd:/media/HD1/LY$ iphop predict --fa_file /media/HD1/LY/vOTU/split/vOTU_10.part_001.fasta --out_dir /media/HD1/LY/host_predictions/iphop_output_vOTU_001 --db_dir /media/HD1/LY/host_predictions/iphop_db_with_custom_mags --num_threads 32

Looks like everything is now set up, we will first clean up the input file, and then we will start the host prediction steps themselves
[1/1/Run] Running blastn against genomes...
[1/3/Run] Get relevant blast matches...
[2/1/Run] Running blastn against CRISPR...
[2/2/Run] Get relevant crispr matches...
Traceback (most recent call last):
File "/home/emma/mambaforge/envs/iphop_env/bin/iphop", line 10, in <module>
sys.exit(cli())
File "/home/emma/mambaforge/envs/iphop_env/lib/python3.8/site-packages/iphop/iphop.py", line 128, in cli
args"func"
File "/home/emma/mambaforge/envs/iphop_env/lib/python3.8/site-packages/iphop/modules/master_predict.py", line 86, in main
utility.split_fasta(args["fasta_file"],args["split_input_dir"]) ## Note: we run even if folder exists, just in case. This will not overwrite existing files anyway, so worst case scenario we just "lose" time to read the input fasta file once
File "/home/emma/mambaforge/envs/iphop_env/lib/python3.8/site-packages/iphop/modules/utility.py", line 236, in split_fasta
SeqIO.write(record, file, "fasta")
File "/home/emma/mambaforge/envs/iphop_env/lib/python3.8/site-packages/Bio/SeqIO/init.py", line 516, in write
with as_handle(handle, "w") as fp:
File "/home/emma/mambaforge/envs/iphop_env/lib/python3.8/contextlib.py", line 113, in enter
return next(self.gen)
File "/home/emma/mambaforge/envs/iphop_env/lib/python3.8/site-packages/Bio/File.py", line 72, in as_handle
with open(handleish, mode, **kwargs) as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/media/HD1/LY/host_predictions/iphop_output_vOTU_001/Wdir/split_input/blk_022_1-12_1_124025-143930/143930.fasta'

And i checked the file vOTU_10.part_001_clean.fna, there is the contig: blk_022_1-12_1_124025-143930/143930

> blk_022_1-12_1_124025-143930/143930
GGAGGTGCCGGGGGCGCTCATGGCCTTGCCGTACCTGTTCGAGTTCTGGGCCCATCCGCA
CCAGTTGCCCCCGGAGGGAAATTGGCGAAGTTGGGTGATCCTTGGTGGGCGCGGCGCGGG
GAAAACCCGCGCCGGTGCCGAATGGGTGCGGTCCATGGTCGAGGGTGCACGACCCTTGGA
TACGGGGCAGGCCCGGCGCGTGGCACTGGTGGGCGAGACACTCGACCAGGTGCGCGAGGT
GATGATTTTCGGCGACAGTGGCATCATGGCCTGTTCGCCGCCGGACCGCAGGCCCGAATG
GCTGGCGACGCGGCGGATGCTGCGCTGGCCCAACGGGGCCGAGGCGGTCGCCTGTTCGGC
GCATGATCCGGAGTCTTTGCGCGGGCCGCAATTCGATGCGGCCTGGGTGGATGAACTGGC

Comments (4)

  1. Simon Roux repo owner

    Hi,

    That looks like an issue with the sequence name., as it includes a “/” character that I believe is interpreted at one point as a folder name. I need to look into the code and see if/how this should be fixed, but in the meantime I think if you replace all your “/” characters with something else in your input file (e.g. by “_”), then you should not see this error anymore.

  2. Yi Liu reporter

    Hi Simon,

    I replace all the “/” characters in my input file, and It works. Thank you so much!

  3. Log in to comment