Giter Club home page Giter Club logo

mgssl's People

Contributors

zaixizhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mgssl's Issues

Pretrained Weights

Hi,

Thank you for uploading the code and the pretrained weights! I have one quick question.

Which mode of MGSSL from the paper does motif_based_pretrain/saved_models/pretrained.pth correspond to?

Why could I get node representation only by GIN?

Hello, Zhang:
When I run the ''model.py'' , only "gin_type" = "gin" work successfully, and other models, including gat, gcn, graphsage and attentivefp are fail to work. All of them were base on your code. I am appreciate you will resoponse to me.

The traceback file is attached.
[Uploading traceback.do
traceback.docx
cx…]()

Best regard,
Xiang Zhang

About Motif-Decomposition

Hi zaixizhang, Thanks for sharing your nice works!

I have some questions about generating cliques and bonds in your code.

  1. Is there any reason to set MST_MAX_WEIGHT to 100?(motif_based_pretrain > util > chemutils.py)
    1-1. If not, how does the MST_MAX_WEIGHT effect to generated cliques?(i.e. If MST_MAX_WEIGHT raises, it causes almost infinite number of motifs?)

  2. In MolTree, When the number of edges connecting BRICS cliques is less then 1, Tree decomp overwrites cliques and edges. Does it okay to change the threshold 1 to any small integer like 2 or 3?

Sincerely,
JongKook Heo

Are there some mistakes in tree decomposition modules?

Dear author, I run the mol_tree.py to preprocess the dataset and generate clique.txt, but it throws the KekulizeException for molecules such as Cc1c(/C=C/c2cc(Br)ccn2)c(O)n2c(nc3ccccc32)c1C#N. I use the decomposition modules on other datsets, it make the same exceptions, can you update the code or give some advice?

About kekule

def get_smiles(mol): 
    return Chem.MolToSmiles(mol, kekuleSmiles=True)  
smiles = Chem.MolFragmentToSmiles(mol, atoms, kekuleSmiles=True)  

Why does reading smiles require kekule format?
Is it possible not to use kekule format?

fingerprint

Hi is there an easy way to extract just the fingerprints given the pretrained model?

Questions about motifs

Hi, I wonder if there are ovelapping atoms between motifs in one molecule?
I run the following script

from moltree import MolTree
smiles = "O=C1[C@@H]2C=C[C@@H](C=CC2)C1(c1ccccc1)c1ccccc1"
mol = MolTree(smiles)
atom_count = 0
for c in mol.nodes:
    atom_count += c.mol.GetNumAtoms()
    print(c.mol.GetNumAtoms())
    print(c.clique)
print(f"atoms in original mol: {mol.mol.GetNumAtoms()}, atoms in motifs: {atom_count}")

And the output is:

2
[0, 1]
2
[9, 10]
2
[9, 16]
9
[1, 2, 3, 4, 5, 6, 7, 8, 9]
6
[11, 12, 13, 14, 15, 10]
6
[17, 18, 19, 20, 21, 16]
1
[9]
atoms in original mol: 22, atoms in motifs: 28

[error] rdkit.Chem.rdchem.KekulizeException: Can't kekulize mol.

Hello!
I'm trying to run mol_tree.py, but I'm getting KekulizeException: error.
Is it a problem about rdkit version?
Below are my rdkit version and console output.

rdkit=2021.09.2=py37h13c2175_0

runfile('/home/bionuser/bionlab/bionlab/contrib/seyong/tasks/tmp/MGSSL/motif_based_pretrain/util/mol_tree.py', wdir='/home/bionuser/bionlab/bionlab/contrib/seyong/tasks/tmp/MGSSL/motif_based_pretrain/util')
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:53)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.30.1 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 7.30.1
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:53)
[GCC 9.4.0] on linux
start
CC(C)(C)c1ccc2occ(CC(=O)Nc3ccccc3F)c2c1
C[C@@h]1CC(Nc2cncc(-c3nncn3C)c2)CC@@HC1
N#Cc1ccc(-c2ccc(OC@@Hc3ccccc3)cc2)cc1
CCOC(=O)[C@@h]1CCCN(C(=O)c2nc(-c3ccc(C)cc3)n3c2CCCCC3)C1
N#CC1=C(SCC(=O)Nc2cccc(Cl)c2)N=C([O-])C@HC12CCCCC2
CCNH+C@(CC)C@Hc1cscc1Br
COc1ccc(C(=O)N(C)C@@HC/C(N)=N/O)cc1O
O=C(Nc1nc[nH]n1)c1cccnc1Nc1cccc(F)c1
Cc1c(/C=N/c2cc(Br)ccn2)c(O)n2c(nc3ccccc32)c1C#N
Traceback (most recent call last):
File "/home/bionuser/.conda/envs/bionlab/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3457, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
runfile('/home/bionuser/bionlab/bionlab/contrib/seyong/tasks/tmp/MGSSL/motif_based_pretrain/util/mol_tree.py', wdir='/home/bionuser/bionlab/bionlab/contrib/seyong/tasks/tmp/MGSSL/motif_based_pretrain/util')
File "/home/bionuser/.pycharm_helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/home/bionuser/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/bionuser/bionlab/bionlab/contrib/seyong/tasks/tmp/MGSSL/motif_based_pretrain/util/mol_tree.py", line 149, in
mol = MolTree(line)
File "/home/bionuser/bionlab/bionlab/contrib/seyong/tasks/tmp/MGSSL/motif_based_pretrain/util/mol_tree.py", line 105, in init
cmol = get_clique_mol(self.mol, c)
File "/home/bionuser/bionlab/bionlab/contrib/seyong/tasks/tmp/MGSSL/motif_based_pretrain/util/chemutils.py", line 80, in get_clique_mol
smiles = Chem.MolFragmentToSmiles(mol, atoms, kekuleSmiles=True)
rdkit.Chem.rdchem.KekulizeException: Can't kekulize mol. Unkekulized atoms: 1 2 12 15 23

Thank you!

Where is the atom loss and bond loss?

Dear author, in the paper the final loss is the sum of atom, bond and motif. I cannot find the loss of atom and bond in the source code. So what is the final loss function of MGSSL?

Error in `python': free(): invalid next size (fast)

感谢你分享的代码,但是在跑bbbp数据集,bace等数据集时出现:
*** Error in `python': free(): invalid next size (fast): 0x00007f10f4028fb0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x81329)[0x7f13514f1329]
/home/zhuyifeng/miniconda3/envs/MGSSl/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so(_ZN5torch8autograd22DifferentiableViewMetaC1EPN3c1010TensorImplENS2_8optionalINS0_8ViewInfoEEES7_NS0_12CreationMetaE+0x1fc)[0x7f12d864dfdc]
/home/zhuyifeng/miniconda3/envs/MGSSl/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so(+0x2c360fb)[0x7f12d80350fb]
/home/zhuyifeng/miniconda3/envs/MGSSl/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so(+0x2c3695e)[0x7f12d803595e]
/home/zhuyifeng/miniconda3/envs/MGSSl/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so(+0x2c75e6d)[0x7f12d8074e6d]
/home/zhuyifeng/miniconda3/envs/MGSSl/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so(+0x2c761ec)[0x7f12d80751ec]
/home/zhuyifeng/miniconda3/envs/MGSSl/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so(+0x189b239)[0x7f12d6c9a239]
/home/zhuyifeng/miniconda3/envs/MGSSl/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so(_ZNK2at6Tensor1tEv+0x4b)[0x7f12d6c9d2ab]
/home/zhuyifeng/miniconda3/envs/MGSSl/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so(+0x377ea32)[0x7f12d8b7da32]
/home/zhuyifeng/miniconda3/envs/MGSSl/lib/python3.9/site-packages/torch/lib/libtorch_cpu.so(_ZN5torch8autograd9generated13AddmmBackward5applyEOSt6vectorIN2at6TensorESaIS5_EE+0x343)[0x7f12d7f52023]
....
已放弃(吐核)
请问该怎么解决

RDKit ERROR: [07:38:26] Explicit valence for atom # 1 N, 6, is greater than permitted

运行代码:

import sys
sys.path.append('./util/') 
from mol_tree import MolTree

data_mol_tree = []
for idx in range(5):
    smiles = data[idx]
    mol_tree = MolTree(smiles)
    mol_tree.recover()
    mol_tree.assemble()
    data_mol_tree.append(mol_tree)
    mol_tree

报错:
RDKit ERROR: [07:38:26] Explicit valence for atom # 1 N, 6, is greater than permitted
[07:38:26] Explicit valence for atom # 1 N, 6, is greater than permitted
RDKit ERROR: [07:38:26] Explicit valence for atom # 1 N, 6, is greater than permitted
[07:38:26] Explicit valence for atom # 1 N, 6, is greater than permitted
报错指出氮原子 #1 的显式价数为6,超过了允许的最大价数。
请问这个错误,影响后续的预训练和模型的精度性能吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.