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

Error message while excuting predict.py #4

Open
y31apw00 opened this issue Jun 1, 2023 · 8 comments
Open

Error message while excuting predict.py #4

y31apw00 opened this issue Jun 1, 2023 · 8 comments

Comments

@y31apw00
Copy link

y31apw00 commented Jun 1, 2023

Hi Saoge123,

We appriciate your valuable work and code for co-crystal prediction.

While I use the example command to run predict.py, the python code reports an error message as following. It seems that I don't have ccdc module. However, there is no further instruction in this blog and README.md. Could you please figure out how to fix it?

============
Traceback (most recent call last):
File "predict.py", line 4, in
from Featurize import *
File "D:\QSAR\ccgnet-main\Featurize_init_.py", line 7, in
from .Change_Hbond_Criterion import Change_Hbond_Criterion
File "D:\QSAR\ccgnet-main\Featurize\Change_Hbond_Criterion.py", line 2, in
import ccdc
ModuleNotFoundError: No module named 'ccdc'

Many thanks.

@y31apw00
Copy link
Author

y31apw00 commented Jun 1, 2023

I guess this error may be triggered by CCDC python API. Then, copying files in "ccgnet-OB" replace original ones and try the same command again. No ccdc error is found, but related rdkit error is prompted. I have installed RDKit. Could you please give me a hint to solve it?

===========
Traceback (most recent call last):
File "predict.py", line 4, in
from Featurize import *
File "D:\QSAR\ccgnet-main\Featurize_init_.py", line 2, in
from .CalcuDescriptors import *
File "D:\QSAR\ccgnet-main\Featurize\CalcuDescriptors.py", line 4, in
from rdkit.Chem import Descriptors, rdFreeSASA
ImportError: cannot import name 'rdFreeSASA'

Thank you.

@Saoge123
Copy link
Owner

Saoge123 commented Jun 1, 2023 via email

@y31apw00
Copy link
Author

y31apw00 commented Jun 13, 2023

Hi
Thank you for your guide. After reinstalling entire modules in linux, I get few steps forward.
Now, I use codes in "ccgnet-OB" instead of original ccgnet and run your example code for testing.
It reports some new errors as follow. Could you please help me to figure out how to fix it?

CMD: python predict.py -table ./data/Test/Test_Table.tab -mol_dir ./data/Test/coformers -out cc_test.xlsx -fmt sdf
Error message:

Bad input sample:CC(=O)Nc1ccc(O)cc1&c1ccc2ccccc2c1, skipped.
Bad input sample:2554&757, skipped.
.
.
.
Bad input sample:c1cc2ccc3cccc4ccc(c1)c2c34&BrC1=C(Br)C(=O)C(=C(Br)C1=O)Br, skipped.
Bad input sample:NC(=O)c1cccnc1&CCOC(=O)c1ccc(O)cc1, skipped.
Traceback (most recent call last):
File "predict.py", line 296, in
main(args.table, args.mol_dir, fmt=args.fmt, model_type=args.type, xlsx_name=args.out)
File "predict.py", line 226, in main
infer = Inference(table, mol_dir=mol_dir, mol_file_type=fmt)
File "predict.py", line 179, in init
processes=8, max_graph_size=160)
File "predict.py", line 99, in make_graph_dataset
self.data_attr_names = D[0].keys()
AttributeError: 'NoneType' object has no attribute 'keys'

By the way, the predict.py in "ccgnet-OB" seems no argument of "-model_path". It is not allowed to specify model_path like example command.

Thank you.

@lochana
Copy link

lochana commented Oct 12, 2023

Did you get a solution to this? I tried the code with anaconda. Once I fix one error I run into another. Some are Tensor flow errors although I have version 2.0 in my anaconda environment. Can anyone at least give the list of libraries with correct version numbers? The predict.py version in ccgnet-OB won't accept model path parameter. Not sure how to specify it?? Thanks.

@lochana
Copy link

lochana commented Oct 20, 2023

As it turns out most errors were due to tensorflow (v2 doesn't work so, you need a prior version) and unavailability of things like xlsx writer. Now, I get the output but, there are bunch of warning type errors during the calculation. I am not sure what these errors mean for the accuracy of the calculations. The authors are quite unhelpful and did not respond to any of my emails.

==============================
*** Open Babel Error in OpenBabel::EEMCharges::ComputeCharges
No parameters found for: Cl 1. EEM charges were not calculated for the molecule.

==============================
*** Open Babel Error in OpenBabel::EEMCharges::_loadParameters
Cannot open file with parameters: eem2015bm.txt

@sharmaji841
Copy link

does this require ccdc python api?

@Saoge123
Copy link
Owner

Saoge123 commented Jun 11, 2024 via email

@PotatoGan
Copy link

Hi Thank you for your guide. After reinstalling entire modules in linux, I get few steps forward. Now, I use codes in "ccgnet-OB" instead of original ccgnet and run your example code for testing. It reports some new errors as follow. Could you please help me to figure out how to fix it?

CMD: python predict.py -table ./data/Test/Test_Table.tab -mol_dir ./data/Test/coformers -out cc_test.xlsx -fmt sdf

Error message:

Bad input sample:CC(=O)Nc1ccc(O)cc1&c1ccc2ccccc2c1, skipped. Bad input sample:2554&757, skipped. . . . Bad input sample:c1cc2ccc3cccc4ccc(c1)c2c34&BrC1=C(Br)C(=O)C(=C(Br)C1=O)Br, skipped. Bad input sample:NC(=O)c1cccnc1&CCOC(=O)c1ccc(O)cc1, skipped. Traceback (most recent call last): File "predict.py", line 296, in main(args.table, args.mol_dir, fmt=args.fmt, model_type=args.type, xlsx_name=args.out) File "predict.py", line 226, in main infer = Inference(table, mol_dir=mol_dir, mol_file_type=fmt) File "predict.py", line 179, in init processes=8, max_graph_size=160) File "predict.py", line 99, in make_graph_dataset self.data_attr_names = D[0].keys() AttributeError: 'NoneType' object has no attribute 'keys'

By the way, the predict.py in "ccgnet-OB" seems no argument of "-model_path". It is not allowed to specify model_path like example command.

Thank you.

I have encountered a problem similar to yours. It will report this error when running the demo.

AttributeError                            Traceback (most recent call last)
Cell In[3], [line 2](vscode-notebook-cell:?execution_count=3&line=2)
      [1](vscode-notebook-cell:?execution_count=3&line=1) data1 = Dataset('data/CC_Table/ECC&CC_Table.tab', mol_blocks_dir='data/Mol_Blocks.dir')
----> [2](vscode-notebook-cell:?execution_count=3&line=2) data1.make_graph_dataset(Desc=1, A_type='OnlyCovalentBond', hbond=0, pipi_stack=0, contact=0, make_dataframe=True)

File [f:\CODE\ccgnet-main\ccgnet\Dataset.py:110](file:///F:/CODE/ccgnet-main/ccgnet/Dataset.py:110), in Dataset.make_graph_dataset(self, Desc, A_type, hbond, pipi_stack, contact, processes, max_graph_size, make_dataframe, save_name)
    [108](file:///F:/CODE/ccgnet-main/ccgnet/Dataset.py:108) pool.close()
    [109](file:///F:/CODE/ccgnet-main/ccgnet/Dataset.py:109) pool.join()
--> [110](file:///F:/CODE/ccgnet-main/ccgnet/Dataset.py:110) self.data_attr_names = D[0].keys()
    [111](file:///F:/CODE/ccgnet-main/ccgnet/Dataset.py:111) attrs = self.__dict__
    [112](file:///F:/CODE/ccgnet-main/ccgnet/Dataset.py:112) for k in self.data_attr_names:

AttributeError: 'NoneType' object has no attribute 'keys'

Do I have to run on Linux? I have already installed CCDC on Windows.

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

5 participants