GenoVi icon indicating copy to clipboard operation
GenoVi copied to clipboard

--output_file does not work properly

Open marade opened this issue 2 years ago • 5 comments

Specifying an output directory with a relative path causes errors, e.g. this fails:

$ mkdir genovi $ genovi -o genovi/blah ...

Parsing path input with Pathlib Path(args.outfile).absolute() or os.path.abspath(args.outfile) would fix this.

marade avatar Apr 04 '23 20:04 marade

Hello @marade.

Thanks for pointing this out.

Could you please share the error log with me to have a better idea of how to fix this?

arodel21 avatar Apr 13 '23 17:04 arodel21

sequence.gb is a file downloaded from GenBank today:

$ genovi -o genovi/blah -i sequence.gb -s complete [Errno 2] No such file or directory: 'genovi/blah-temp/contig_1-genovi/blah.faa' Error when transforming gbk to faa. /home/ubuntu/miniconda3/envs/genovi/lib/python3.7/site-packages/Bio/GenBank/Scanner.py:1219: BiopythonParserWarning: Premature end of file in sequence data "Premature end of file in sequence data", BiopythonParserWarning Traceback (most recent call last): File "/home/ubuntu/miniconda3/envs/genovi/bin/genovi", line 8, in sys.exit(main()) File "/home/ubuntu/miniconda3/envs/genovi/lib/python3.7/site-packages/scripts/GenoVi.py", line 685, in main visualiseGenome(*get_args()) File "/home/ubuntu/miniconda3/envs/genovi/lib/python3.7/site-packages/scripts/GenoVi.py", line 341, in visualiseGenome sizes, cogs_p, cogs_n, lengths, chrms, hist, wanted_cogs = base(file, temp_folder + "/" + output_file_part, output_file + "/" + output_file, True, True, cogs_classified, cogs_classified, False, True, deepnog_confidence_threshold, verbose, wanted_cogs=wanted_cogs) File "/home/ubuntu/miniconda3/envs/genovi/lib/python3.7/site-packages/scripts/create_raw.py", line 494, in base sizes, _, _, lengths = create_kar(gbk_file, tmp, output, complete) File "/home/ubuntu/miniconda3/envs/genovi/lib/python3.7/site-packages/scripts/create_raw.py", line 139, in create_kar with open(output_file, 'w') as output: FileNotFoundError: [Errno 2] No such file or directory: 'genovi/blah-temp/contig_1-genovi/blah_bands.kar'

marade avatar Apr 13 '23 18:04 marade

Hi @marade. I apologize for the delay in replying.

I have committed an update related to the handling of relative paths. It is not yet included in the installable version of GenoVi, but you can find it in the Github repo. It will soon be added to a new version which will include other improvements.

Please do let us know if you have further quesitons.

arodel21 avatar May 16 '23 13:05 arodel21

Sounds good @arodel21. Thanks!

marade avatar May 16 '23 18:05 marade

I tried using GenoVi again and found that relative paths still don't work. I see there's a commit related to this here:

https://github.com/robotoD/GenoVi/commit/fdd3c5dc7d2a61ebaed15b31892c83fa3b5d32e6

The code for this commit is not nearly sufficient to address the problem. I'd like to emphasize that GenoVi is fundamentally broken when it comes to handling paths. I'll recommend again extensive use of Pathlib Path().absolute() or os.path.abspath() so that you can handle relative paths correctly.

marade avatar Sep 19 '23 20:09 marade