Saoge123 / ccgnet

MIT License
38 stars 12 forks source link

运行demo.ipynb时报错 #10

Open PotatoGan opened 3 months ago

PotatoGan commented 3 months ago

Saoge123您好,感谢您的论文和代码,我在试图复现您的程序 在运行demo.ipynb时会遇到这个错误

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'

将_task方法修改了一下,以打印出更多错误信息后,有很多bad input的错误

Bad input sample: WOJWOH, skipped. Error: 
Bad input sample: WOJXEY, skipped. Error: 
Bad input sample: XAHZAH, skipped. Error: 
Bad input sample: XAJJUQ, skipped. Error: 
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
[22:38:43] Explicit valence for atom # 17 N, 4, is greater than permitted
[22:38:43] Can't kekulize mol.  Unkekulized atoms: 2 4 6 8 10
[22:38:43] Explicit valence for atom # 8 N, 4, is greater than permitted
[22:38:43] Explicit valence for atom # 7 N, 4, is greater than permitted
[22:38:43] 01: Warning - no explicit hydrogens in mol2 file but needed for formal charge estimation.

请问您这边有什么指导建议嘛 代码是在Win10上跑的,安装了CCDC2024,openbabel-wheel 3.1.1.19,rdkit 2024.3.3

Saoge123 commented 2 months ago

你好,问题原因因该是处理数据出现异常,D = pool.map(self._task, [items for items in self.table if items[-1] not in exception])返回的D为None

PotatoGan commented 2 months ago

是的,我也发现是这句有问题,起初以为是multiprocessing在Windows上运行会有问题,之前遇到过类似的,但是用其他方法替代multiprocessing之后,依然不行,会报后面bad input的错误,感觉在_task方法中,还有些小问题,导致处理数据异常,不知道有没有人遇到过类似的问题