Exemplo n.º 1
0
def _CDPLconfigForConformation(
        mol
):  # TODO is this the right way to handle ligands for conf. generation?
    '''
    PRIVAT METHOD
    configures a CDPL BasicMolecule for conformation generation. \n
    Input: \n
    mol (CDPL BasicMolecule): a CDPL BasicMolecule \n
    Return: \n
    (CDPL BasicMolecule): the configured input BasicMolecule
     '''
    Chem.perceiveComponents(mol, False)
    Chem.perceiveSSSR(mol, False)
    Chem.setRingFlags(mol, False)
    Chem.calcImplicitHydrogenCounts(mol, False)
    Chem.perceiveHybridizationStates(mol, False)
    Chem.setAromaticityFlags(mol, False)
    Chem.calcCIPPriorities(mol, False)
    Chem.calcAtomCIPConfigurations(mol, False)
    Chem.calcBondCIPConfigurations(mol, False)
    Chem.calcAtomStereoDescriptors(mol, False)
    Chem.calcBondStereoDescriptors(mol, False)
    Chem.calcTopologicalDistanceMatrix(mol, False)

    Chem.generate2DCoordinates(mol, False)
    Chem.generateBond2DStereoFlags(mol, True)
def calculateStandardProperties(mol):
    standardProperties = {
        'nrAcceptors': [],
        'nrDonors': [],
        # 'nrRings': [],
        'nrRotBonds': [],
        'molWeight': [],
        'nrHeavyAtoms': [],
        'cLogP': [],
        'TPSA': [],
    }

    try:
        iter(mol)
    except:
        mol = [mol]

    for m in mol:
        Chem.calcTopologicalDistanceMatrix(m, True)

        p = getPharmacophore(m)
        hba, hbd = 0, 0
        for f in p:
            if Pharm.getType(f) == Pharm.FeatureType.H_BOND_ACCEPTOR:
                hba += 1
            elif Pharm.getType(f) == Pharm.FeatureType.H_BOND_DONOR:
                hbd += 1

        standardProperties['nrAcceptors'].append(hba)
        standardProperties['nrDonors'].append(hbd)
        standardProperties['molWeight'].append(Chem.calcExplicitMass(m))
        standardProperties['nrHeavyAtoms'].append(Chem.getHeavyAtomCount(m))
        standardProperties['cLogP'].append(Chem.calcXLogP(m))
        standardProperties['TPSA'].append(Chem.calcTPSA(m))
        standardProperties['nrRotBonds'].append(
            Chem.getRotatableBondCount(m, False, False))

    return standardProperties
def get_span(mol: Chem.BasicMolecule) -> int:
    Chem.calcTopologicalDistanceMatrix(mol, False)
    return Chem.calcTopologicalDiameter(mol)
Exemplo n.º 4
0
    histo = Math.DVector()
    histo.resize(Chem.XLogPCalculator.FEATURE_VECTOR_SIZE)

    Chem.setMultiConfImportParameter(sdf_reader, False)

	while sdf_reader.read(mol):
		exp_logp = float(exp_logp_is.readline())

		Chem.perceiveComponents(mol, False)
		Chem.perceiveSSSR(mol, False)
		Chem.setRingFlags(mol, False)
		Chem.calcImplicitHydrogenCounts(mol, False)
		Chem.perceiveHybridizationStates(mol, False)
		Chem.setAromaticityFlags(mol, False)
		Chem.calcTopologicalDistanceMatrix(mol, False)

		xlogp_calc.calculate(mol)

        histo += xlogp_calc.getFeatureVector()

		mlr_model.addXYData(xlogp_calc.getFeatureVector(), exp_logp)

	mlr_model.buildModel()
	mlr_model.calcStatistics()

	print('Model Statistics:', file=sys.stderr)
	print('----------------------------------', file=sys.stderr)
	print(' Correlation Coeff.: ', mlr_model.getCorrelationCoefficient(), file=sys.stderr)
	print(' Goodness of Fit:    ', mlr_model.getGoodnessOfFit(), file=sys.stderr)
	print(' Standard Deviation: ', mlr_model.getStandardDeviation(), file=sys.stderr)