Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error regarding output directory #21

Open
timeresistance1996 opened this issue Jan 19, 2024 · 7 comments
Open

Error regarding output directory #21

timeresistance1996 opened this issue Jan 19, 2024 · 7 comments

Comments

@timeresistance1996
Copy link

timeresistance1996 commented Jan 19, 2024

Thank you for your code, but I encountered an issue when running it.

This is how I used it. Under the 'eggnog' directory, there is a file named 'emapper.annotations', and under the 'genome' directory, there is a file named 'genome.fna'. The code I used is
python ./kemet.py -I ./eggnog -a eggnog --skip_hmm --skip_gsmm ./genome -q --log --path_output ./output

However, an error occurred: FileNotFoundError: [Errno 2] No such file or directory: './output/ktests/'

Strangely, when I manually created the entire folder, the code seemed to run smoothly, but no output file was generated.

I got the same error even when using your test files.

@Matteopaluh
Copy link
Owner

Matteopaluh commented Jan 23, 2024

Hello!

I believe the error happens for two reasons:

  1. due to the fact that a file named "genome.fna" requires a "genome.emapper.annotations" in the eggnog directory;
  2. because the -O (or --path_output) argument requires an absolute path, as per lines 2406-2407 of kemet.py:
parser.add_argument('-O', '--path_output',
                    help='''Absolute path to ouput file(s) FOLDER.''', default = dir_base)

With those points in mind, based on the following suggested command line
./kemet.py [FASTA_file] -a [FORMAT] --hmm_mode [MODE] --gsmm_mode [MODE] (--skip_hmm) (etc.)

I'd change name of the annotation file, and inputing the full output folder path before running it for the file of interest:
python ./kemet.py ./genome/genome.fna -a eggnog --skip_hmm --skip_gsmm -I ./eggnog -O ABSOLUTE/PATH/TO/output -q --log

Feel free to try it out with said adjustment and to come back to me if there's still issues.
I'll try to put further work on simplifying I/O file operations!

Best,
Matteo

@Matteopaluh Matteopaluh changed the title FileNotFoundError: [Errno 2] No such file or directory: './output/ktests/' Error regarding output directory Jan 24, 2024
@shibormi
Copy link

shibormi commented Feb 8, 2024

Hello I got this error, what might be the possible issues in here?

FileNotFoundError: [Errno 2] No such file or directory: 'KEGG_MODULES//kk_files/'

@Matteopaluh
Copy link
Owner

Matteopaluh commented Feb 8, 2024

Hello I got this error, what might be the possible issues in here?

FileNotFoundError: [Errno 2] No such file or directory: 'KEGG_MODULES//kk_files/'

Hello,

I assume you executed kemet.py while being located to a different folder than KEMET, or you deleted KEGG_MODULES directory.

At the moment of writing (v1.0.0), the script execution is limited to execution from KEMET due to file dependencies to KEGG Modules diagram-like files (.kk files) - and they're stored in a path relative to the main script, at KEMET/KEGG_MODULES/kk_files.

Right now I/O operations on those files are coded assuming the main script is executed in the original directory, but a reasonable update could be to generalize its use.
I'm sure open to suggestions, regarding this!

To answer and hopefully resolve your issue I would execute the script from the KEMET folder, as suggested in the Readme file. Let me know if this fix works, else I think you'd need a seperate issue (try looking in past closed issues first, in that case) 🙂

Best,
Matteo

@shibormi
Copy link

shibormi commented Feb 8, 2024

actually i create a singularity images for this folder seems to be there in that singularity. So I have no idea above how this tools works.

@Matteopaluh
Copy link
Owner

actually i create a singularity images for this folder seems to be there in that singularity. So I have no idea above how this tools works.

I guess I'll need a little more info than what you provided then!

For instance it could be relevant if you shared what command you used to run kemet.py.

A high-level view of how the tool works is included in the manuscript (https://doi.org/10.1016/j.csbj.2022.03.015) and in this Github repository.
The operative and brief description of that is that KEMET uses previously annotated functional annotations (stored in an input folder), organizes KEGG KO info in more structured tables (using files from KEGG_MODULES/kk_files) and makes some other downstream analyses from genomic/MAG sequences.

I'm lacking details regarding Singularity, though, so I'm not really sure how much it matters for your specific problem here.

@shibormi
Copy link

shibormi commented Feb 8, 2024

Here's are my commands below:

singularity exec KEMET.sif kemet.py inputs/AMR12223.fna -a kaas --skip_hmm --skip_gsmm -I Deliverables/inputs/ -O Deliverables/KEMET -q --log.

Hope this will sort it out the issues.

Repository owner deleted a comment from shibormi Feb 8, 2024
@Matteopaluh
Copy link
Owner

Matteopaluh commented Feb 12, 2024

@shibormi I'm not totally familiar with singularity, as I mentioned earlier, nonetheless I'm trying to identify potential issues.

Similarly to the main issue that was raised here (by user: timeresistance1996) I assume it could be due to the -O (or --path_output) argument not using an absolute path, whereas it is actually required by kemet.py.

I'm not 100% sure that would be possible within the singularity program.

Secondly, the way you structured that command line within singularity points to both your AMR12223.fna and AMR12223.txt (or AMR12223.ko) files as both being located in the Deliverables/inputs/ folder.
I don't know if said folder is materially on disk or if it exists "virtually".

Lastly, and connected to your first message in this issue, I'm not entirely sure singularity maintains the KEGG_MODULES folder, and in general how is the folder structure within the singularity program you created.

If you have suggestions in how to modify kemet source code to help with this issue, feel free to suggest, I'll be receptive!

Best,
Matteo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants