KennthShang / HostG

Graph convolutional neural network for host prediction
19 stars 2 forks source link

Some error occured while running run_Speed_up.py with example data #1

Closed susutBu closed 2 years ago

susutBu commented 2 years ago

Hi KennthShang, Thank you very much for providing an excellent tool to predict the host of prokaryotic viruses. When I run the test data with the default command, some errors as follows raised by python3: How do I fix this problem?

(Host) [xubu@mn01 HostG]$ python3 run_Speed_up.py --contigs test_contigs.fa --len 8000 --t 0
folder input exist... cleaning dictionary
folder pred exist... cleaning dictionary
folder Split_files exist... cleaning dictionary
folder tmp_pred exist... cleaning dictionary
folder Cyber_data/ exist... cleaning dictionary
Capturing compressed features
Running with cpu
Traceback (most recent call last):
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/tarfile.py", line 187, in nti
    n = int(s.strip() or "0", 8)
ValueError: invalid literal for int() with base 8: 'r_v2\nq\x03('

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/tarfile.py", line 2289, in next
    tarinfo = self.tarinfo.fromtarfile(self)
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/tarfile.py", line 1095, in fromtarfile
    obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors)
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/tarfile.py", line 1037, in frombuf
    chksum = nti(buf[148:156])
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/tarfile.py", line 189, in nti
    raise InvalidHeaderError("invalid header")
tarfile.InvalidHeaderError: invalid header

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/site-packages/torch/serialization.py", line 556, in _load
    return legacy_load(f)
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/site-packages/torch/serialization.py", line 467, in legacy_load
    with closing(tarfile.open(fileobj=f, mode='r:', format=tarfile.PAX_FORMAT)) as tar, \
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/tarfile.py", line 1593, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/tarfile.py", line 1623, in taropen
    return cls(name, mode, fileobj, **kwargs)
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/tarfile.py", line 1486, in __init__
    self.firstmember = self.next()
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/tarfile.py", line 2301, in next
    raise ReadError(str(e))
tarfile.ReadError: invalid header

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run_CNN.py", line 101, in <module>
    pretrained_dict=torch.load(args.classifier, map_location='cpu')
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/site-packages/torch/serialization.py", line 387, in load
    return _load(f, map_location, pickle_module, **pickle_load_args)
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/site-packages/torch/serialization.py", line 560, in _load
    raise RuntimeError("{} is a zip archive (did you mean to use torch.jit.load()?)".format(f.name))
RuntimeError: Params.pkl is a zip archive (did you mean to use torch.jit.load()?)
Pre-trained CNN Error for file contig_0
cat: pred/*: No such file or directory
Traceback (most recent call last):
  File "run_Speed_up.py", line 157, in <module>
    out = subprocess.check_call(cmd, shell=True)
  File "/tiagor_home/xubu/miniconda3/envs/Host/lib/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'cat pred/* > final_prediction.csv' returned non-zero exit status 1.
KennthShang commented 2 years ago

Hi,

It seems your PyTorch version is incorrect, please try:pytroch>=1.8.0

susutBu commented 2 years ago

Hi, Thanks your suggestion. It worked. But the results of example with the command your offereded in README file is empty? I got the emply spreadsheet as a result while I run the test data with the default command, which comes from READE file. The attached log file would be useful.

nohup.txt

KennthShang commented 2 years ago

it seems everything ran well. Do you mean the 'final_prediction.csv' is an empty file? If so, that would be strange. We have tested several times and several users have reported it works.

Maybe there's something wrong on your hpc? Or maybe you can rerun it.

KennthShang commented 2 years ago

I will re-run the program and get back to you soon.

KennthShang commented 2 years ago

Hi,

I have tested it again on another pc of our lab. It worked and the output is shown below: image

susutBu commented 2 years ago

Hi, Thanks a lot for checking. I re-ran it and got the same result as you showed.

KennthShang commented 2 years ago

Great, good to know!

I will close this issue then.