mirror of
https://github.com/RYDE-WORK/lnp_ml.git
synced 2026-02-06 15:03:47 +08:00
...
This commit is contained in:
parent
4c2fdc395f
commit
96a27caab2
@ -1,35 +0,0 @@
|
|||||||
import logging
|
|
||||||
import numpy as np
|
|
||||||
import pandas as pd
|
|
||||||
import multiprocessing as mp
|
|
||||||
from typing import List
|
|
||||||
from tqdm import tqdm
|
|
||||||
from rdkit import Chem
|
|
||||||
from rdkit.Chem import (
|
|
||||||
Mol,
|
|
||||||
AllChem,
|
|
||||||
MACCSkeys,
|
|
||||||
Descriptors
|
|
||||||
)
|
|
||||||
|
|
||||||
mp.set_start_method('fork') # Screw MacOS
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
logger.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
|
|
||||||
def get_morgan(mol: Mol, radius: int = 2, nBits: int = 1024) -> List[int]:
|
|
||||||
return AllChem.GetMorganFingerprintAsBitVect(
|
|
||||||
mol,
|
|
||||||
radius=radius,
|
|
||||||
nBits=nBits,
|
|
||||||
useChirality=False
|
|
||||||
).ToList()
|
|
||||||
|
|
||||||
|
|
||||||
def get_maccs(mol: Mol) -> List[int]:
|
|
||||||
return MACCSkeys.GenMACCSKeys(mol).ToList()
|
|
||||||
|
|
||||||
|
|
||||||
def get_rdkit_descriptors(mol: Mol) -> List[float]:
|
|
||||||
desc_dict = Descriptors.CalcMolDescriptors(mol)
|
|
||||||
return list(desc_dict.values())
|
|
||||||
Loading…
x
Reference in New Issue
Block a user