robotoD / GenoVi

GenoVi, an automated customizable circular genome visualizer for bacteria and archaea
Other
77 stars 11 forks source link

Error at the DeepNOG step likely related to PyTorch #4

Closed ilnamkang closed 1 year ago

ilnamkang commented 1 year ago

Hi,

I'm trying running GenoVi with a genbank file downloaded from GenBank.

But, I'm encountering an error at the DeepNOG step. Below is the stdout. I can get plots successfully with "-cu" option.

How can I avoid this error?

----- (genovi) kangin@user[xxx] genovi -i sequence.gb -s complete
/home/kangin/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

GBK file transformed into faa succesfully. File saved as genovi-temp/contig_1-genovi.faa output genovi-temp/contig_1-genovi

Deepnog prediction started

deepnog infer genovi-temp/contig_1-genovi.faa --out genovi-temp/contig_1-genovi_prediction_deepnog.csv -db cog2020 -t 1 [2023-04-06 10:57:36] deepnog.client.client - INFO - Starting deepnog [2023-04-06 10:57:37] deepnog.client.client - INFO - Loading NN-parameters from /home/kangin/deepnog_data/cog2020/1/deepnog.pth ... Traceback (most recent call last): File "/home/kangin/miniconda3/envs/genovi/bin/deepnog", line 8, in sys.exit(main()) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/deepnog/client/client.py", line 481, in main _start_prediction_or_training(args) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/deepnog/client/client.py", line 295, in _start_prediction_or_training return _start_inference(args=args, arch_module=module, arch_cls=cls) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/deepnog/client/client.py", line 324, in _start_inference model_dict = torch.load(weights_path, map_location=args.device) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/torch/serialization.py", line 777, in load with _open_zipfile_reader(opened_file) as opened_zipfile: File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/torch/serialization.py", line 282, in init super(_open_zipfile_reader, self).init(torch._C.PyTorchFileReader(name_or_buffer)) RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

Deepnog prediction finished succesfully. Predictions saved as genovi-temp/contig_1-genovi_prediction_deepnog.csv

Traceback (most recent call last): File "/home/kangin/miniconda3/envs/genovi/bin/genovi", line 8, in sys.exit(main()) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/scripts/GenoVi.py", line 685, in main visualiseGenome(get_args()) File "/home/kangin/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/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/scripts/create_raw.py", line 482, in base cogs_dict = get_categories(gbk_file, tmp, deepnog_confidence) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/scripts/create_raw.py", line 445, in get_categories cogs_df = pd.read_csv(output_pred, sep=',', usecols=['sequence_id', 'prediction']) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/pandas/util/_decorators.py", line 311, in wrapper return func(args, kwargs) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/pandas/io/parsers/readers.py", line 586, in read_csv return _read(filepath_or_buffer, kwds) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/pandas/io/parsers/readers.py", line 482, in _read parser = TextFileReader(filepath_or_buffer, kwds) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/pandas/io/parsers/readers.py", line 811, in init self._engine = self._make_engine(self.engine) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/pandas/io/parsers/readers.py", line 1040, in _make_engine return mapping[engine](self.f, **self.options) # type: ignore[call-arg] File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 51, in init self._open_handles(src, kwds) File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/pandas/io/parsers/base_parser.py", line 229, in _open_handles errors=kwds.get("encoding_errors", "strict"), File "/home/kangin/miniconda3/envs/genovi/lib/python3.7/site-packages/pandas/io/common.py", line 707, in get_handle newline="", FileNotFoundError: [Errno 2] No such file or directory: 'genovi-temp/contig_1-genovi_prediction_deepnog.csv' -----

arodel21 commented 1 year ago

Hello @ilnamkang,

As I can see on your log, BioPython is complaining about the length of the sequence data being shorter than expected. Could you check if the headers and sequences are okay? It might also be worth it to download the Genbank file again.

ilnamkang commented 1 year ago

Hi,

I removed the previously-installed genovi conda env and reinstalled genovi, which solved this error. I don't encounter any errors with the reinstalled genovi. Unfortunately, I don't have any ideas on what went wrong with my previous installation. I'm not sure, but I think there was no errors during my previous installation.

But, I get the same BioPython warning (see below) for all three genbank files I tested. One genbank file is from Prokka and the other two were downloaded from GenBank.

/home/kangin/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