예제 #1
0
def get_ro3_from_mol(mol):
    """
    Get rule of three criteria for a fragment, i.e. molecular weight, logP, number of hydrogen bond acceptors/donors, number of rotatable bonds, and PSA.

    Parameters
    ----------
    mol : rdkit.Chem.rdchem.Mol
        Fragment.

    Returns
    -------
    pd.Series
        Rule of three criteria for input fragment.
        
    Notes
    -----
    Taken from: https://europepmc.org/article/med/14554012
    """

    properties = QED.properties(mol)

    mw = 1 if properties.MW < 300 else 0
    logp = 1 if properties.ALOGP <= 3 else 0
    hbd = 1 if properties.HBD <= 3 else 0
    hba = 1 if properties.HBA <= 3 else 0
    nrot = 1 if properties.ROTB <= 3 else 0
    psa = 1 if properties.PSA <= 60 else 0

    return pd.Series([mw, logp, hbd, hba, nrot, psa],
                     index="mw logp hbd hba nrot psa".split())
예제 #2
0
def compute_druglikeness(mol: Chem.rdchem.Mol):
    """Call RDKit to compute the drug likeness properties."""
    try:
        data = QED.properties(mol)
        results = [getattr(data, key) for key in KEYS_DRUGS_LIKENESS]
    except RuntimeError:
        results = [None] * len(KEYS_DRUGS_LIKENESS)
    return results
예제 #3
0
def getMoleculeProperties(m: Chem.rdchem.Mol, index: int):
    qed = QED.properties(m)
    return [
        #index,
        Descriptors.ExactMolWt(m),
        qed[1],
        qed[4],
        qed[3]
    ]
예제 #4
0
파일: UnitTestQED.py 프로젝트: gedeck/rdkit
  def test_properties(self):
    m = Chem.MolFromSmiles('N=C(CCSCc1csc(N=C(N)N)n1)NS(N)(=O)=O')
    p = QED.properties(m)
    self.assertAlmostEqual(p.MW, 337.456)
    self.assertAlmostEqual(p.ALOGP, -0.55833)
    self.assertAlmostEqual(p.HBA, 6)
    self.assertAlmostEqual(p.HBD, 5)
    self.assertAlmostEqual(p.PSA, 173.33)
    self.assertAlmostEqual(p.ROTB, 7)
    self.assertAlmostEqual(p.AROM, 1)
    self.assertAlmostEqual(p.ALERTS, 3)

    p = QED.properties(Chem.AddHs(m))
    self.assertAlmostEqual(p.MW, 337.456)
    self.assertAlmostEqual(p.ALOGP, -0.55833)
    self.assertAlmostEqual(p.HBA, 6)
    self.assertAlmostEqual(p.HBD, 5)
    self.assertAlmostEqual(p.PSA, 173.33)
    self.assertAlmostEqual(p.ROTB, 7)
    self.assertAlmostEqual(p.AROM, 1)
    self.assertAlmostEqual(p.ALERTS, 3)
예제 #5
0
파일: UnitTestQED.py 프로젝트: yinxx/rdkit
    def test_properties(self):
        m = Chem.MolFromSmiles('N=C(CCSCc1csc(N=C(N)N)n1)NS(N)(=O)=O')
        p = QED.properties(m)
        self.assertAlmostEqual(p.MW, 337.456)
        self.assertAlmostEqual(p.ALOGP, -0.55833)
        self.assertAlmostEqual(p.HBA, 6)
        self.assertAlmostEqual(p.HBD, 5)
        self.assertAlmostEqual(p.PSA, 173.33)
        self.assertAlmostEqual(p.ROTB, 7)
        self.assertAlmostEqual(p.AROM, 1)
        self.assertAlmostEqual(p.ALERTS, 3)

        p = QED.properties(Chem.AddHs(m))
        self.assertAlmostEqual(p.MW, 337.456)
        self.assertAlmostEqual(p.ALOGP, -0.55833)
        self.assertAlmostEqual(p.HBA, 6)
        self.assertAlmostEqual(p.HBD, 5)
        self.assertAlmostEqual(p.PSA, 173.33)
        self.assertAlmostEqual(p.ROTB, 7)
        self.assertAlmostEqual(p.AROM, 1)
        self.assertAlmostEqual(p.ALERTS, 3)
예제 #6
0
def QSArproperties_test(array,forest, num, namefile):
    ##Bickerton, G.R.; Paolini, G.V.; Besnard, J.; Muresan, S.; Hopkins, A.L. (2012)
    ##Quantifying the chemical beauty of drugs,
    ##Nature Chemistry, 4, 90-98
    ##[https://doi.org/10.1038/nchem.1243]
    #
    ##Wildman, S.A.; Crippen, G.M. (1999)
    ##Prediction of Physicochemical Parameters by Atomic Contributions,
    ##Journal of Chemical Information and Computer Sciences, 39, 868-873
    ##[https://doi.org/10.1021/ci990307l]
    #
    fw = open( 'QSAR-2D' + str(num) + str(namefile) + '.csv', 'w')
    #
    for line in array:
        parameter= line.split(sep="\t",maxsplit=9)
        peptide_seq = parameter[0]
        peptide     = parameter[1]
        #
        molpeptideLi  = Chem.MolFromSmiles(peptide)
        # subprocess
        scoreSA_Li    = calculateScore(molpeptideLi)
        #
        # Make Prediction Random-Forest
        fp_vect_Li    = genFP(molpeptideLi)
        # Get probabilities
        predictionsLi = forest.predict_proba(fp_vect_Li.reshape(1,-1))
        #print ("Probability %s mutagenic %0.6f " % (sequence,predictionsLi[0][1]))
        # See http://cdb.ics.uci.edu/cgibin/Smi2DepictWeb.py
        propQSAR      = QED.properties(molpeptideLi)
        MolWeight     = propQSAR.MW
        MolLogP       = propQSAR.ALOGP
        HbondA        = propQSAR.HBA
        HbondD        = propQSAR.HBD
        PolarSA       = propQSAR.PSA
        Rbonds        = propQSAR.ROTB
        Aromatic      = propQSAR.AROM
        #
        MolarRefractivity = Crippen.MolMR(molpeptideLi)
        nAtoms            = molpeptideLi.GetNumAtoms()
        #
        SynthAcces    = scoreSA_Li
        AmesMutagenic = predictionsLi[0][1]
        #
        result = ( str(MolWeight) + "\t" + str(MolLogP) + "\t" + str(HbondA) + "\t" + str(HbondD) + "\t" + str(PolarSA) + "\t" + str(Rbonds) + "\t" + str(MolarRefractivity) + "\t" + str(nAtoms) + "\t" + str(SynthAcces) + "\t" + str(AmesMutagenic) + "\t" + str (peptide_seq) + "\t" + str(peptide) + "\n")
        #print (result)
        fw.write(result)

    fw.close()
예제 #7
0
 def __init__(self,
              mol=None,
              mw=None,
              logP=None,
              hba=None,
              hbd=None,
              psa=None,
              rotb=None,
              arom=None):
     self.molecule = mol if mol else None
     self.molecule_name = mol.GetProp('_Name') if mol else None
     self._qed = QED.properties(self.molecule) if mol else None
     self.mw = mw if not mol else self._qed.MW
     self.logP = logP if not mol else self._qed.ALOGP
     self.hba = hba if not mol else self._qed.HBA
     self.hbd = hbd if not mol else self._qed.HBD
     self.psa = psa if not mol else self._qed.PSA
     self.rotb = rotb if not mol else self._qed.ROTB
     self.arom = arom if not mol else self._qed.AROM
예제 #8
0
def QSArproperties(mol, sa, seq, Ames):
    propQSAR = QED.properties(mol)
    """Bickerton, G.R.; Paolini, G.V.; Besnard, J.; Muresan, S.; Hopkins, A.L. (2012)
    Quantifying the chemical beauty of drugs,
    Nature Chemistry, 4, 90-98
    [https://doi.org/10.1038/nchem.1243]"""
    #
    """Wildman, S.A.; Crippen, G.M. (1999)
    Prediction of Physicochemical Parameters by Atomic Contributions,
    Journal of Chemical Information and Computer Sciences, 39, 868-873
    [https://doi.org/10.1021/ci990307l]"""
    #
    MolWeight = propQSAR.MW
    MolLogP = propQSAR.ALOGP
    HbondA = propQSAR.HBA
    HbondD = propQSAR.HBD
    PolarSA = propQSAR.PSA
    Rbonds = propQSAR.ROTB
    Aromatic = propQSAR.AROM
    MolarRefractivity = Crippen.MolMR(mol)
    SynthAcces = sa
    nAtoms = mol.GetNumAtoms()
    AmesMutagenic = Ames
예제 #9
0
def filter_mols(mols: List[Chem.Mol],
                names: Optional[List[str]] = None,
                max_atoms: int = 1000,
                max_weight: float = 10000.,
                max_logP: float = 10.,
                **kwargs) -> Tuple[List[str], Optional[List[str]]]:
    """Filter a list of molecules according to input critera

    Parameters
    ----------
    mols : List[Chem.Mol]
        the molecules to filter
    names : Optional[List[str]] (Default = None)
        a parallel list of names corresponding to each molecule
    max_atoms : int (Default = 1000)
    max_weight : float (Default = 10000)
    max_logP : float (Default = 10)

    Returns
    -------
    smis_filtered : List[str]
        the SMILES strings corresponding to the filtered molecules
    names_filtered : Optional[List[str]]
        the names corresponding to the filtered molecules. None, if no names
        were originally supplied
    """
    names = names or []

    smis_filtered = []
    names_filtered = []

    if names:
        for mol, name in tqdm(zip(mols, names),
                              total=len(mols),
                              desc='Filtering mols',
                              unit='mol'):
            if mol.GetNumHeavyAtoms() > max_atoms:
                continue

            props = QED.properties(mol)
            if props.MW > max_weight:
                continue
            if props.ALOGP > max_logP:
                continue

            smis_filtered.append(mol_to_smi(mol))
            names_filtered.append(name)
    else:
        names_filtered = None
        for mol in tqdm(mols,
                        total=len(mols),
                        desc='Filtering mols',
                        unit='mol'):
            if mol.GetNumHeavyAtoms() > max_atoms:
                continue

            props = QED.properties(mol)
            if props.MW > max_weight:
                continue
            if props.ALOGP > max_logP:
                continue

            smis_filtered.append(mol_to_smi(mol))

    return smis_filtered, names_filtered