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

AttributeError: type object 'object' has no attribute 'dtype' #48

Open
mattragoza opened this issue Jul 15, 2022 · 9 comments
Open

AttributeError: type object 'object' has no attribute 'dtype' #48

mattragoza opened this issue Jul 15, 2022 · 9 comments

Comments

@mattragoza
Copy link
Owner

Excuse me, when I use the command python3 generate.py config/generate.config. It appears a problem as follows:
Traceback (most recent call last):
File "generate.py", line 48, in
main(sys.argv[1:])
File "generate.py", line 41, in main
debug=args.debug,
File "/da1/home/changhaoyu/liGAN/liGAN/generating.py", line 98, in init
**output_kws,
File "/da1/home/changhaoyu/liGAN/liGAN/generating.py", line 671, in init
self.metrics = pd.DataFrame(columns=columns).set_index(columns)
File "/home/changhaoyu/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/core/frame.py", line 392, in init
mgr = init_dict(data, index, columns, dtype=dtype)
File "/home/changhaoyu/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 196, in init_dict
nan_dtype)
File "/home/changhaoyu/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/core/dtypes/cast.py", line 1175, in construct_1d_arraylike_from_scalar
dtype = dtype.dtype
AttributeError: type object 'object' has no attribute 'dtype'
How can I solve it?

Originally posted by @Matheo-Chang in #36 (comment)

@mattragoza
Copy link
Owner Author

@Matheo-Chang I am not able to reproduce this issue, can you share your conda environment?

@Matheo-Chang
Copy link

Matheo-Chang commented Aug 18, 2022 via email

@mattragoza
Copy link
Owner Author

mattragoza commented Aug 18, 2022

Traceback (most recent call last):
 File "/home/jovyan/LiGAN/generate.py", line 47, in <module>
   main(sys.argv[1:])
 File "/home/jovyan/LiGAN/generate.py", line 42, in main
   generator.generate(**config['generate'])
 File "/home/jovyan/LiGAN/ligan/generating.py", line 368, in generate
   input_lig_mol.gnina_minimize(rec_mol=input_rec_mol)
 File "/home/jovyan/LiGAN/ligan/molecules.py", line 177, in gnina_minimize
   return gnina_minimize_rd_mol(self, *args, **kwargs)
 File "/home/jovyan/LiGAN/ligan/molecules.py", line 783, in gnina_minimize_rd_mol
   out_mol = Molecule.from_sdf(out_file, idx=0, sanitize=False)
 File "/home/jovyan/LiGAN/ligan/molecules.py", line 54, in from_sdf
   mol = read_rd_mols_from_sdf_file(sdf_file, sanitize=sanitize)[idx]
 File "/home/jovyan/LiGAN/ligan/molecules.py", line 220, in read_rd_mols_from_sdf_file
   with gzip.open(sdf_file) as f:
 File "/home/jovyan/miniconda/LiGAN/lib/python3.9/gzip.py", line 58, in open
   binary_file = GzipFile(filename, gz_mode, compresslevel)
 File "/home/jovyan/miniconda/LiGAN/lib/python3.9/gzip.py", line 173, in __init__
   fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpa316d6or.sdf.gz'```

This is due an error running gnina to minimize the molecule, but gnina is run as a subprocess so the problem doesn't show up in the python traceback.

Higher up in the output stream, there should be a section like GNINA STDERR ... END GNINA STDERR that gives a more informative error message from running the gnina subprocess. Do you mind running this again and posting the full output?

@Matheo-Chang
Copy link

Matheo-Chang commented Aug 19, 2022 via email

@mattragoza
Copy link
Owner Author

Hm, that's weird that there is no gnina stderr. How did you install gnina?

@Matheo-Chang
Copy link

Matheo-Chang commented Aug 26, 2022 via email

@mattragoza
Copy link
Owner Author

What is the full output if you run the following command from the repository root dir?

gnina --minimize -r data/crossdock2020/AROK_MYCTU_1_176_0/1zyu_A_rec.pdb -l data/crossdock2020/AROK_MYCTU_1_176_0/1zyu_A_rec_1we2_dhk_lig_tt_docked_8.sdf --autobox_ligand data/crossdock2020/AROK_MYCTU_1_176_0/1zyu_A_rec_1we2_dhk_lig_tt_docked_8.sdf -o test_gnina.sdf

@Matheo-Chang
Copy link

Matheo-Chang commented Aug 29, 2022 via email

@mattragoza
Copy link
Owner Author

This is probably because the installed gnina executable is incompatible with your system. If you want to perform gnina minimization, then you will have to build gnina from source or use the Docker image.

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

2 participants