From 5d06820f4cbcda14f9aaa82ed8123751eb97d9b3 Mon Sep 17 00:00:00 2001 From: flucium Date: Fri, 7 Jun 2024 12:14:04 +0900 Subject: [PATCH 1/2] add abcd.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this is in reference to the post on x (twitter). X:https://x.com/Flasushi/status/1791622447315460540 --- abcd.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 abcd.py diff --git a/abcd.py b/abcd.py new file mode 100644 index 0000000..7330f6b --- /dev/null +++ b/abcd.py @@ -0,0 +1,30 @@ +# Posted in X. +# https://x.com/Flasushi/status/1791622447315460540 + +from rdkit import Chem +from rdkit import Chem +from rdkit.Chem import Descriptors +from rdkit.Chem import AllChem +import numpy as np + +def compute_descriptors(smiles): + mol = Chem.MolFromSmiles(smiles) + if mol is None: + return None + + mol_weight = Descriptors.MolWt(mol) + logp = Descriptors.MolLogP(mol) + num_h_donors = Descriptors.NumHDonors(mol) + num_h_acceptors = Descriptors.NumHAcceptors(mol) + + fp = AllChem.GetMorganFingerprintAsBitVect(mol, 2, nBits=1024) + fp_arr = np.zeros((1,)) + AllChem.DataStructs.ConvertToNumpyArray(fp, fp_arr) + + descriptors = np.concatenate(([mol_weight, logp, num_h_donors, num_h_acceptors], fp_arr)) + + return descriptors + + +if __name__ == '__main__': + pass From 98db9b083eb6c7ba5d8da872763e55923378acc3 Mon Sep 17 00:00:00 2001 From: flucium Date: Fri, 7 Jun 2024 12:39:02 +0900 Subject: [PATCH 2/2] update .gitignore added .DS_Store and !.gitignore. --- .gitignore | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a087b27..b9a40bc 100644 --- a/.gitignore +++ b/.gitignore @@ -129,4 +129,10 @@ dmypy.json .pyre/ .metals/ -.vscode/ \ No newline at end of file +.vscode/ + + +.DS_Store +**/.DS_Store + +!.gitignore