mattragoza / LiGAN

Deep generative models of 3D grids for structure-based drug discovery
GNU General Public License v2.0
225 stars 44 forks source link

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

Open mattragoza opened 2 years ago

mattragoza commented 2 years ago

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 https://github.com/mattragoza/LiGAN/issues/36#issuecomment-1178787379

mattragoza commented 2 years ago

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

Matheo-Chang commented 2 years ago

For now, I don’t have this problem again with your new version of readme. Thank you for your patience very much.But when I wanna generate new molecules, I have met this problem:Traceback (most recent call last):  File "/home/jovyan/LiGAN/generate.py", line 47, in     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'Do you know something about this?---- Replied Message ----FromMatt @.>Date08/11/2022 00:25 @.> @*.**@*.***>SubjectRe: [mattragoza/LiGAN] AttributeError: type object 'object' has no attribute 'dtype' (Issue #48) @Matheo-Chang I am not able to reproduce this issue, can you share your conda environment?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/mattragoza/LiGAN/issues/48#issuecomment-1210954395", "url": "https://github.com/mattragoza/LiGAN/issues/48#issuecomment-1210954395", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

mattragoza commented 2 years ago

 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 commented 2 years ago

The full output:Setting random seed to 0Loading dataInitializing generative modelLoading generative model stateInitializing atom fitterInitializing bond adderInitializing output writerStarting to generate gridsCalling generator (prior=0, stage2=False)Getting next batch of data==============================* Open Babel Warning  in PerceiveBondOrders  Failed to kekulize aromatic bonds in OBMol::PerceiveBondOrders (title is data/crossdock2020/1A02_HUMAN_25_199_pep_0/1eez_A_rec.pdb)Getting real input molecule from data root[02:11:51] Molecule does not have explicit Hs. Consider calling AddHs().Minimizing real molecule with gninaGNINA STDERREND GNINA STDERRTraceback (most recent call last):  File "/home/jovyan/LiGAN/generate.py", line 47, in     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/tmpctm8jhlf.sdf.gz'---- Replied Message ----FromMatt @.>Date08/19/2022 01:16 @.> @.**@.>SubjectRe: [mattragoza/LiGAN] AttributeError: type object 'object' has no attribute 'dtype' (Issue #48) This is due an error running gnina to minimize the molecule. Higher up in the output stream, there should be a section like START 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?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/mattragoza/LiGAN/issues/48#issuecomment-1219700725", "url": "https://github.com/mattragoza/LiGAN/issues/48#issuecomment-1219700725", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

mattragoza commented 2 years ago

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

Matheo-Chang commented 2 years ago

I installed all of these packages like your new version readme, but it also has the problem.---- Replied Message ----FromMatt @.>Date08/26/2022 23:44 @.> @.**@.>SubjectRe: [mattragoza/LiGAN] AttributeError: type object 'object' has no attribute 'dtype' (Issue #48) Hm, that's weird that there is no gnina stderr. How did you install gnina?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/mattragoza/LiGAN/issues/48#issuecomment-1228655150", "url": "https://github.com/mattragoza/LiGAN/issues/48#issuecomment-1228655150", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

mattragoza commented 2 years ago

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 commented 2 years ago
    It will report segmentation fault when I input gnina. And the result like the figure here.---- Replied Message ----FromMatt ***@***.***>Date08/27/2022 00:08 ***@***.***> ***@***.******@***.***>SubjectRe: [mattragoza/LiGAN] AttributeError: type object 'object' has no attribute 'dtype' (Issue #48)

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

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/mattragoza/LiGAN/issues/48#issuecomment-1228678461", "url": "https://github.com/mattragoza/LiGAN/issues/48#issuecomment-1228678461", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

mattragoza commented 2 years ago

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.