Esempio n. 1
0
    def compute_connectivity_and_shape_indexes(self):
        """compute the compute connectivity and shape indexes.
        Ref: Rev. Comput. Chem. 2:367-422 (1991)

        Returns:
            CSI_dict: CSI dictionary, data type: float
        """
        assert type(self.Molecule) == Chem.rdchem.Mol

        CSI_dict = {}

        CSI_dict['Chi0v'] = rdDesc.CalcChi0v(self.Molecule)
        CSI_dict['Chi1v'] = rdDesc.CalcChi1v(self.Molecule)
        CSI_dict['Chi2v'] = rdDesc.CalcChi2v(self.Molecule)
        CSI_dict['Chi3v'] = rdDesc.CalcChi3v(self.Molecule)
        CSI_dict['Chi4v'] = rdDesc.CalcChi4v(self.Molecule)
        CSI_dict['Chi0n'] = rdDesc.CalcChi0n(self.Molecule)
        CSI_dict['Chi1n'] = rdDesc.CalcChi1n(self.Molecule)
        CSI_dict['Chi2n'] = rdDesc.CalcChi2n(self.Molecule)
        CSI_dict['Chi3n'] = rdDesc.CalcChi3n(self.Molecule)
        CSI_dict['Chi4n'] = rdDesc.CalcChi4n(self.Molecule)
        CSI_dict['HallKierAlpha'] = rdDesc.CalcHallKierAlpha(self.Molecule)
        CSI_dict['Kappa1'] = rdDesc.CalcKappa1(self.Molecule)
        CSI_dict['Kappa2'] = rdDesc.CalcKappa2(self.Molecule)
        CSI_dict['Kappa3'] = rdDesc.CalcKappa3(self.Molecule)

        return CSI_dict
Esempio n. 2
0
def _calculateDescriptors(mol):
    df = pd.DataFrame(index=[0])
    df["SlogP"] = rdMolDescriptors.CalcCrippenDescriptors(mol)[0]
    df["SMR"] = rdMolDescriptors.CalcCrippenDescriptors(mol)[1]
    df["LabuteASA"] = rdMolDescriptors.CalcLabuteASA(mol)
    df["TPSA"] = Descriptors.TPSA(mol)
    df["AMW"] = Descriptors.MolWt(mol)
    df["ExactMW"] = rdMolDescriptors.CalcExactMolWt(mol)
    df["NumLipinskiHBA"] = rdMolDescriptors.CalcNumLipinskiHBA(mol)
    df["NumLipinskiHBD"] = rdMolDescriptors.CalcNumLipinskiHBD(mol)
    df["NumRotatableBonds"] = rdMolDescriptors.CalcNumRotatableBonds(mol)
    df["NumHBD"] = rdMolDescriptors.CalcNumHBD(mol)
    df["NumHBA"] = rdMolDescriptors.CalcNumHBA(mol)
    df["NumAmideBonds"] = rdMolDescriptors.CalcNumAmideBonds(mol)
    df["NumHeteroAtoms"] = rdMolDescriptors.CalcNumHeteroatoms(mol)
    df["NumHeavyAtoms"] = Chem.rdchem.Mol.GetNumHeavyAtoms(mol)
    df["NumAtoms"] = Chem.rdchem.Mol.GetNumAtoms(mol)
    df["NumRings"] = rdMolDescriptors.CalcNumRings(mol)
    df["NumAromaticRings"] = rdMolDescriptors.CalcNumAromaticRings(mol)
    df["NumSaturatedRings"] = rdMolDescriptors.CalcNumSaturatedRings(mol)
    df["NumAliphaticRings"] = rdMolDescriptors.CalcNumAliphaticRings(mol)
    df["NumAromaticHeterocycles"] = \
        rdMolDescriptors.CalcNumAromaticHeterocycles(mol)
    df["NumSaturatedHeterocycles"] = \
        rdMolDescriptors.CalcNumSaturatedHeterocycles(mol)
    df["NumAliphaticHeterocycles"] = \
        rdMolDescriptors.CalcNumAliphaticHeterocycles(mol)
    df["NumAromaticCarbocycles"] = \
        rdMolDescriptors.CalcNumAromaticCarbocycles(mol)
    df["NumSaturatedCarbocycles"] = \
        rdMolDescriptors.CalcNumSaturatedCarbocycles(mol)
    df["NumAliphaticCarbocycles"] = \
        rdMolDescriptors.CalcNumAliphaticCarbocycles(mol)
    df["FractionCSP3"] = rdMolDescriptors.CalcFractionCSP3(mol)
    df["Chi0v"] = rdMolDescriptors.CalcChi0v(mol)
    df["Chi1v"] = rdMolDescriptors.CalcChi1v(mol)
    df["Chi2v"] = rdMolDescriptors.CalcChi2v(mol)
    df["Chi3v"] = rdMolDescriptors.CalcChi3v(mol)
    df["Chi4v"] = rdMolDescriptors.CalcChi4v(mol)
    df["Chi1n"] = rdMolDescriptors.CalcChi1n(mol)
    df["Chi2n"] = rdMolDescriptors.CalcChi2n(mol)
    df["Chi3n"] = rdMolDescriptors.CalcChi3n(mol)
    df["Chi4n"] = rdMolDescriptors.CalcChi4n(mol)
    df["HallKierAlpha"] = rdMolDescriptors.CalcHallKierAlpha(mol)
    df["kappa1"] = rdMolDescriptors.CalcKappa1(mol)
    df["kappa2"] = rdMolDescriptors.CalcKappa2(mol)
    df["kappa3"] = rdMolDescriptors.CalcKappa3(mol)
    slogp_VSA = list(map(lambda i: "slogp_VSA" + str(i), list(range(1, 13))))
    df = df.assign(**dict(zip(slogp_VSA, rdMolDescriptors.SlogP_VSA_(mol))))
    smr_VSA = list(map(lambda i: "smr_VSA" + str(i), list(range(1, 11))))
    df = df.assign(**dict(zip(smr_VSA, rdMolDescriptors.SMR_VSA_(mol))))
    peoe_VSA = list(map(lambda i: "peoe_VSA" + str(i), list(range(1, 15))))
    df = df.assign(**dict(zip(peoe_VSA, rdMolDescriptors.PEOE_VSA_(mol))))
    MQNs = list(map(lambda i: "MQN" + str(i), list(range(1, 43))))
    df = df.assign(**dict(zip(MQNs, rdMolDescriptors.MQNs_(mol))))
    return df
Esempio n. 3
0
        if A % 2 == 1:
            kappa = (A + alpha - 1) * (A + alpha - 3)**2 / denom
        else:
            kappa = (A + alpha - 2) * (A + alpha - 3)**2 / denom
    else:
        kappa = 0
    return kappa


# Kappa3.version="1.0.0"

HallKierAlpha = lambda x: rdMolDescriptors.CalcHallKierAlpha(x)
HallKierAlpha.version = rdMolDescriptors._CalcHallKierAlpha_version
Kappa1 = lambda x: rdMolDescriptors.CalcKappa1(x)
Kappa1.version = rdMolDescriptors._CalcKappa1_version
Kappa2 = lambda x: rdMolDescriptors.CalcKappa2(x)
Kappa2.version = rdMolDescriptors._CalcKappa2_version
Kappa3 = lambda x: rdMolDescriptors.CalcKappa3(x)
Kappa3.version = rdMolDescriptors._CalcKappa3_version


def Chi0(mol):
    """ From equations (1),(9) and (10) of Rev. Comp. Chem. vol 2, 367-422, (1991)

  """
    deltas = [x.GetDegree() for x in mol.GetAtoms()]
    while 0 in deltas:
        deltas.remove(0)
    deltas = numpy.array(deltas, 'd')
    res = sum(numpy.sqrt(1. / deltas))
    return res
    def get_global_features(self, mol):
        u = []
        # Now get some specific features
        fdefName = os.path.join(RDConfig.RDDataDir, 'BaseFeatures.fdef')
        factory = ChemicalFeatures.BuildFeatureFactory(fdefName)
        feats = factory.GetFeaturesForMol(mol)

        # First get some basic features
        natoms = mol.GetNumAtoms()
        nbonds = mol.GetNumBonds()
        mw = Descriptors.ExactMolWt(mol)
        HeavyAtomMolWt = Descriptors.HeavyAtomMolWt(mol)
        NumValenceElectrons = Descriptors.NumValenceElectrons(mol)
        ''' # These four descriptors are producing the value of infinity for refcode_csd = YOLJUF (CCOP(=O)(Cc1ccc(cc1)NC(=S)NP(OC(C)C)(OC(C)C)[S])OCC\t\n)
        MaxAbsPartialCharge = Descriptors.MaxAbsPartialCharge(mol)
        MaxPartialCharge = Descriptors.MaxPartialCharge(mol)
        MinAbsPartialCharge = Descriptors.MinAbsPartialCharge(mol)
        MinPartialCharge = Descriptors.MinPartialCharge(mol)
        '''
        #        FpDensityMorgan1 = Descriptors.FpDensityMorgan1(mol)
        #        FpDensityMorgan2 = Descriptors.FpDensityMorgan2(mol)
        #        FpDensityMorgan3 = Descriptors.FpDensityMorgan3(mol)

        # Get some features using chemical feature factory

        nbrAcceptor = 0
        nbrDonor = 0
        nbrHydrophobe = 0
        nbrLumpedHydrophobe = 0
        nbrPosIonizable = 0
        nbrNegIonizable = 0

        for j in range(len(feats)):
            #print(feats[j].GetFamily(), feats[j].GetType())
            if ('Acceptor' == (feats[j].GetFamily())):
                nbrAcceptor = nbrAcceptor + 1
            elif ('Donor' == (feats[j].GetFamily())):
                nbrDonor = nbrDonor + 1
            elif ('Hydrophobe' == (feats[j].GetFamily())):
                nbrHydrophobe = nbrHydrophobe + 1
            elif ('LumpedHydrophobe' == (feats[j].GetFamily())):
                nbrLumpedHydrophobe = nbrLumpedHydrophobe + 1
            elif ('PosIonizable' == (feats[j].GetFamily())):
                nbrPosIonizable = nbrPosIonizable + 1
            elif ('NegIonizable' == (feats[j].GetFamily())):
                nbrNegIonizable = nbrNegIonizable + 1
            else:
                pass
                #print(feats[j].GetFamily())

        # Now get some features using rdMolDescriptors

        moreGlobalFeatures = [rdm.CalcNumRotatableBonds(mol), rdm.CalcChi0n(mol), rdm.CalcChi0v(mol), \
                            rdm.CalcChi1n(mol), rdm.CalcChi1v(mol), rdm.CalcChi2n(mol), rdm.CalcChi2v(mol), \
                            rdm.CalcChi3n(mol), rdm.CalcChi4n(mol), rdm.CalcChi4v(mol), \
                            rdm.CalcFractionCSP3(mol), rdm.CalcHallKierAlpha(mol), rdm.CalcKappa1(mol), \
                            rdm.CalcKappa2(mol), rdm.CalcLabuteASA(mol), \
                            rdm.CalcNumAliphaticCarbocycles(mol), rdm.CalcNumAliphaticHeterocycles(mol), \
                            rdm.CalcNumAliphaticRings(mol), rdm.CalcNumAmideBonds(mol), \
                            rdm.CalcNumAromaticCarbocycles(mol), rdm.CalcNumAromaticHeterocycles(mol), \
                            rdm.CalcNumAromaticRings(mol), rdm.CalcNumBridgeheadAtoms(mol), rdm.CalcNumHBA(mol), \
                            rdm.CalcNumHBD(mol), rdm.CalcNumHeteroatoms(mol), rdm.CalcNumHeterocycles(mol), \
                            rdm.CalcNumLipinskiHBA(mol), rdm.CalcNumLipinskiHBD(mol), rdm.CalcNumRings(mol), \
                            rdm.CalcNumSaturatedCarbocycles(mol), rdm.CalcNumSaturatedHeterocycles(mol), \
                            rdm.CalcNumSaturatedRings(mol), rdm.CalcNumSpiroAtoms(mol), rdm.CalcTPSA(mol)]


        u = [natoms, nbonds, mw, HeavyAtomMolWt, NumValenceElectrons, \
            nbrAcceptor, nbrDonor, nbrHydrophobe, nbrLumpedHydrophobe, \
            nbrPosIonizable, nbrNegIonizable]

        u = u + moreGlobalFeatures
        u = np.array(u).T
        # Some of the descriptors produice NAN. We can convert them to 0
        # If you are getting outliers in the training or validation set this could be
        # Because some important features were set to zero here because it produced NAN
        # Removing those features from the feature set might remove the outliers

        #u[np.isnan(u)] = 0

        #u = torch.tensor(u, dtype=torch.float)
        return (u)
def get_fingerprint(SMILES=None, E_BIND=None):
    """
    PRE: Takes in a MOLECULE as a SMILES
    POST: Prints its finger prints as two list, the first contains the names, the second contains the fingerprints
    """

    def get_atoms_coords(RDKIT_BLOCK):
        """Takes as input an RDKIT BLOCK and returns a list of atoms with a numpy array containing the coordinates"""
        RDKIT_BLOCK = RDKIT_BLOCK.split('\n')
        atm_number = int(RDKIT_BLOCK[3][:3])
        RDKIT_BLOCK = [x.split() for x in RDKIT_BLOCK]
        atm_list = []
        coords_array = np.zeros([atm_number, 3], dtype=float)
        for i, line in enumerate(RDKIT_BLOCK[4:4 + atm_number]):
            coords_atm = line
            atm_list.append(coords_atm[3])
            coords_array[i, :] = coords_atm[:3]
        return atm_list, coords_array

    def get_atom_types(mol):
        """
        PRE: Takes in the mol
        POST: Returns a dictionary with the atom types and numbers
        """
        atom_types = {}
        for atom in mol.GetAtoms():
            symbol = atom.GetSymbol()
            if symbol in atom_types:
                atom_types[symbol] += 1
            else:
                atom_types[symbol] = 1
        return atom_types

    def AreRingFused(mol):
        """
        PRE  : Takes in a mol rdkit
        POST : Returns the max number of fused rings. That is the maximum number of rings any atom belongs to
        """
        rings = Chem.GetSymmSSSR(mol)
        ring_dic = {}
        for ring in rings:
            for atom in list(ring):
                if atom in ring_dic:
                    ring_dic[atom] += 1
                else:
                    ring_dic[atom] = 1
        if ring_dic.values() == []:
            return 0
        else:
            return max(ring_dic.values())

    def getVolume(mol, atom_types):
        """
        PRE: Takes in a mol with HYDROGENS ADDED
        POST: Returns its volume computed as a linear combination of the contribution of the vdW volumes
        """
        index_of_vols = {'H': 7.24, 'C': 20.58, 'N': 15.60, 'O': 14.71, 'F': 13.31, 'Cl': 22.45, 'Br': 26.52,
                         'I': 32.52, 'P': 24.43, 'S': 24.43, 'As': 26.52, 'B': 40.48, 'Si': 38.79, 'Se': 28.73,
                         'Te': 36.62}
        gross_volume = 0
        # for sym in atom_types:
            # gross_volume += atom_types[sym] * index_of_vols[sym]
        bonds = mol.GetNumBonds()
        rings = Chem.GetSymmSSSR(mol)
        # print 'aromatic ring count is ',descriptors.CalcNumAromaticRings(mol)
        # print 'aliphatic ring count is ',descriptors.CalcNumAliphaticRings(mol)
        ra = 0
        largest_ra = 0
        rna = 0
        largest_rna = 0
        for ringId in range(len(rings)):
            if isRingAromatic(mol, tuple(rings[ringId])):
                ra += 1
                if largest_ra < len(rings[ringId]):
                    largest_ra = len(rings[ringId])
            else:
                rna += 1
                if largest_rna < len(rings[ringId]):
                    largest_rna = len(rings[ringId])
        # volume = gross_volume - 5.92 * bonds - 14.7 * ra - 3.8 * rna
        try:
            AllChem.EmbedMolecule(mol)
            AllChem.MMFFOptimizeMolecule(mol)
            volume = AllChem.ComputeMolVolume(mol)
        except:
            raise ValueError("Can't build the molecule")
        return volume, ra, rna, largest_ra, largest_rna

    def isRingAromatic(mol, ring):
        """
        PRE: Takes in a mol and a ring given as a tuple of atom id
        POST: Returns TRUE is all the atoms inside the ring are aromatic and FALSE otherwise
        """
        aromatic = True
        for ids in ring:
            if mol.GetAtomWithIdx(ids).GetIsAromatic():
                # print ids
                pass
            else:
                aromatic = False
                break
        return aromatic

    mol = SMILES
    features = [
        'atomNbr',
        'Volume',
        'NAtom',
        'OAtom',
        'SAtom',
        'PAtom',
        'ClAtom',
        'BrAtom',
        'FAtom',
        'IAtom',
        'AromaticRingNumber',
        'LargestAromaticRingAtomNbr',
        'NonAromaticRingNumber',
        'LargestNonAromaticRingAtomNbr',
        'MaxNbrFusedRings',
        'SurfaceArea',
        'Charge',
        # 'MinRadiusOfCylinder',
        # 'RadiusOfCylinderBestConf',
        'NitroNbr',
        'AlcoholNbr',
        'KetoneNbr',
        'NitrileNbr',
        'ThiolNbr',
        'Phenol_likeNbr',
        'EsterNbr',
        'SulfideNbr',
        'CarboxilicAcidNbr',
        'EtherNbr',
        'AmideNbr',
        'AnilineNbr',
        'PrimaryAmineNbr',
        'SecondaryAmineNbr',
        'RotableBondNum',
        'HBondDonor',
        'HBondAcceptor',
        'MolLogP',
        'MolMR'
    ]
    for i in range(6):
        features.append('Chi{}v'.format(i + 1))
        features.append('Chi{}n'.format(i + 1))
        if i < 3:
            features.append('Kappa{}'.format(i + 1))

    feature_dic = dict.fromkeys(features)
    if mol == None:
        return sorted(feature_dic.keys())

    mol = Chem.MolFromSmiles(SMILES)
    mol = Chem.AddHs(mol)

    feature_dic['RotableBondNum'] = descriptors.CalcNumRotatableBonds(mol)

    for i in range(6):
        feature_dic['Chi{}v'.format(i + 1)] = descriptors.CalcChiNv(mol, i + 1)
        feature_dic['Chi{}n'.format(i + 1)] = descriptors.CalcChiNn(mol, i + 1)

    feature_dic['Kappa1'] = descriptors.CalcKappa1(mol)
    feature_dic['Kappa2'] = descriptors.CalcKappa2(mol)
    feature_dic['Kappa3'] = descriptors.CalcKappa3(mol)

    feature_dic['HBondAcceptor'] = descriptors.CalcNumHBA(mol)
    feature_dic['HBondDonor'] = descriptors.CalcNumHBD(mol)

    CrippenDescriptors = descriptors.CalcCrippenDescriptors(mol)
    feature_dic['MolLogP'] = CrippenDescriptors[0]
    feature_dic['MolMR'] = CrippenDescriptors[1]

    atom_types = get_atom_types(mol)
    for feat, symbol in zip(['NAtom', 'OAtom', 'SAtom', 'PAtom', 'ClAtom', 'BrAtom', 'FAtom', 'IAtom'],
                            ['N', 'O', 'S', 'P', 'Cl', 'Br', 'F', 'I']):
        if symbol in atom_types:
            feature_dic[feat] = atom_types[symbol]
        else:
            feature_dic[feat] = 0

    feature_dic['atomNbr'] = mol.GetNumHeavyAtoms()
    feature_dic['Volume'], feature_dic['AromaticRingNumber'], feature_dic['NonAromaticRingNumber'], feature_dic[
        'LargestAromaticRingAtomNbr'], feature_dic['LargestNonAromaticRingAtomNbr'] = getVolume(mol, atom_types)
    feature_dic['MaxNbrFusedRings'] = AreRingFused(mol)
    feature_dic['SurfaceArea'] = descriptors.CalcTPSA(mol)
    feature_dic['Charge'] = Chem.GetFormalCharge(mol)

    funct_dic = {
        '[$([NX3](=O)=O),$([NX3+](=O)[O-])][!#8]': 'NitroNbr',
        '[#6][OX2H]': 'AlcoholNbr',
        '[NX1]#[CX2]': 'NitrileNbr',
        '[#6][CX3](=O)[#6]': 'KetoneNbr',
        '[#16X2H]': 'ThiolNbr',
        "[OX2H][cX3][c]": 'Phenol_likeNbr',
        '[#6][CX3](=O)[OX2H0][#6]': 'EsterNbr',
        '[#16X2H0]': 'SulfideNbr',
        '[CX3](=O)[OX2H1]': 'CarboxilicAcidNbr',
        '[OD2]([#6])[#6]': 'EtherNbr',
        # '[NX3][CX3](=[OX1])[#6]':'AmideNbr',
        '[#7X3][#6X3](=[OX1])[#6]': 'AmideNbr',
        '[NX3][cc]': 'AnilineNbr',
        '[NX3H2;!$(NC=O)]': 'PrimaryAmineNbr',
        '[NX3H1;!$(NC=O)]': 'SecondaryAmineNbr'}

    for funct in funct_dic:
        patt = Chem.MolFromSmarts(funct)
        feature_dic[funct_dic[funct]] = len(mol.GetSubstructMatches(patt))

    # names, coords = get_atoms_coords(Chem.MolToMolBlock(mol))
    # feature_dic['MinRadiusOfCylinder'] = returnCircleAsTuple(coords[:,1:])[2]
    # feature_dic['MinRadiusOfCylinder'] = RADIUS[0]
    # feature_dic['RadiusOfCylinderBestConf'] = RADIUS[1]

    values = []
    for key in sorted(feature_dic.keys()):
        values.append(feature_dic[key])
    # print key, feature_dic[key]
    return values
Esempio n. 6
0
def get_molecular_features(dataframe, mol_list):
    df = dataframe
    for i in range(len(mol_list)):
        print("Getting molecular features for molecule: ", i)
        mol = mol_list[i]
        natoms = mol.GetNumAtoms()
        nbonds = mol.GetNumBonds()
        mw = Descriptors.ExactMolWt(mol)
        df.at[i,"NbrAtoms"] = natoms
        df.at[i,"NbrBonds"] = nbonds
        df.at[i,"mw"] = mw
        df.at[i,'HeavyAtomMolWt'] = Chem.Descriptors.HeavyAtomMolWt(mol)
        df.at[i,'NumValenceElectrons'] = Chem.Descriptors.NumValenceElectrons(mol)
        ''' # These four descriptors are producing the value of infinity for refcode_csd = YOLJUF (CCOP(=O)(Cc1ccc(cc1)NC(=S)NP(OC(C)C)(OC(C)C)[S])OCC\t\n)
        df.at[i,'MaxAbsPartialCharge'] = Chem.Descriptors.MaxAbsPartialCharge(mol)
        df.at[i,'MaxPartialCharge'] = Chem.Descriptors.MaxPartialCharge(mol)
        df.at[i,'MinAbsPartialCharge'] = Chem.Descriptors.MinAbsPartialCharge(mol)
        df.at[i,'MinPartialCharge'] = Chem.Descriptors.MinPartialCharge(mol)
        '''
        df.at[i,'FpDensityMorgan1'] = Chem.Descriptors.FpDensityMorgan1(mol)
        df.at[i,'FpDensityMorgan2'] = Chem.Descriptors.FpDensityMorgan2(mol)
        df.at[i,'FpDensityMorgan3'] = Chem.Descriptors.FpDensityMorgan3(mol)
        
        #print(natoms, nbonds)
        
        # Now get some specific features
        fdefName = os.path.join(RDConfig.RDDataDir,'BaseFeatures.fdef')
        factory = ChemicalFeatures.BuildFeatureFactory(fdefName)
        feats = factory.GetFeaturesForMol(mol)
        #df["Acceptor"] = 0
        #df["Aromatic"] = 0
        #df["Hydrophobe"] = 0
        nbrAcceptor = 0
        nbrDonor = 0
        nbrHydrophobe = 0
        nbrLumpedHydrophobe = 0
        nbrPosIonizable = 0
        nbrNegIonizable = 0
        for j in range(len(feats)):
            #print(feats[j].GetFamily(), feats[j].GetType())
            if ('Acceptor' == (feats[j].GetFamily())):
                nbrAcceptor = nbrAcceptor + 1
            elif ('Donor' == (feats[j].GetFamily())):
                nbrDonor = nbrDonor + 1
            elif ('Hydrophobe' == (feats[j].GetFamily())):
                nbrHydrophobe = nbrHydrophobe + 1
            elif ('LumpedHydrophobe' == (feats[j].GetFamily())):
                nbrLumpedHydrophobe = nbrLumpedHydrophobe + 1
            elif ('PosIonizable' == (feats[j].GetFamily())):
                nbrPosIonizable = nbrPosIonizable + 1
            elif ('NegIonizable' == (feats[j].GetFamily())):
                nbrNegIonizable = nbrNegIonizable + 1                
            else:
                pass#print(feats[j].GetFamily())
                        
        df.at[i,"Acceptor"] = nbrAcceptor
        df.at[i,"Donor"] = nbrDonor
        df.at[i,"Hydrophobe"] = nbrHydrophobe
        df.at[i,"LumpedHydrophobe"] = nbrLumpedHydrophobe
        df.at[i,"PosIonizable"] = nbrPosIonizable
        df.at[i,"NegIonizable"] = nbrNegIonizable
        
        # We can also get some more molecular features using rdMolDescriptors
        
        df.at[i,"NumRotatableBonds"] = rdMolDescriptors.CalcNumRotatableBonds(mol)
        df.at[i,"CalcChi0n"] = rdMolDescriptors.CalcChi0n(mol)
        df.at[i,"CalcChi0v"] = rdMolDescriptors.CalcChi0v(mol)
        df.at[i,"CalcChi1n"] = rdMolDescriptors.CalcChi1n(mol)
        df.at[i,"CalcChi1v"] = rdMolDescriptors.CalcChi1v(mol)
        df.at[i,"CalcChi2n"] = rdMolDescriptors.CalcChi2n(mol)
        df.at[i,"CalcChi2v"] = rdMolDescriptors.CalcChi2v(mol)
        df.at[i,"CalcChi3n"] = rdMolDescriptors.CalcChi3n(mol)
        df.at[i,"CalcChi3v"] = rdMolDescriptors.CalcChi3v(mol)
        df.at[i,"CalcChi4n"] = rdMolDescriptors.CalcChi4n(mol)
        df.at[i,"CalcChi4v"] = rdMolDescriptors.CalcChi4v(mol)
        df.at[i,"CalcFractionCSP3"] = rdMolDescriptors.CalcFractionCSP3(mol)
        df.at[i,"CalcHallKierAlpha"] = rdMolDescriptors.CalcHallKierAlpha(mol)
        df.at[i,"CalcKappa1"] = rdMolDescriptors.CalcKappa1(mol)
        df.at[i,"CalcKappa2"] = rdMolDescriptors.CalcKappa2(mol)
        #df.at[i,"CalcKappa3"] = rdMolDescriptors.CalcKappa3(mol)
        df.at[i,"CalcLabuteASA"] = rdMolDescriptors.CalcLabuteASA(mol)
        df.at[i,"CalcNumAliphaticCarbocycles"] = rdMolDescriptors.CalcNumAliphaticCarbocycles(mol)
        df.at[i,"CalcNumAliphaticHeterocycles"] = rdMolDescriptors.CalcNumAliphaticHeterocycles(mol)
        df.at[i,"CalcNumAliphaticRings"] = rdMolDescriptors.CalcNumAliphaticRings(mol)
        df.at[i,"CalcNumAmideBonds"] = rdMolDescriptors.CalcNumAmideBonds(mol)
        df.at[i,"CalcNumAromaticCarbocycles"] = rdMolDescriptors.CalcNumAromaticCarbocycles(mol)
        df.at[i,"CalcNumAromaticHeterocycles"] = rdMolDescriptors.CalcNumAromaticHeterocycles(mol)
        df.at[i,"CalcNumAromaticRings"] = rdMolDescriptors.CalcNumAromaticRings(mol)
        df.at[i,"CalcNumBridgeheadAtoms"] = rdMolDescriptors.CalcNumBridgeheadAtoms(mol)
        df.at[i,"CalcNumHBA"] = rdMolDescriptors.CalcNumHBA(mol)
        df.at[i,"CalcNumHBD"] = rdMolDescriptors.CalcNumHBD(mol)
        df.at[i,"CalcNumHeteroatoms"] = rdMolDescriptors.CalcNumHeteroatoms(mol)
        df.at[i,"CalcNumHeterocycles"] = rdMolDescriptors.CalcNumHeterocycles(mol)
        df.at[i,"CalcNumLipinskiHBA"] = rdMolDescriptors.CalcNumLipinskiHBA(mol)
        df.at[i,"CalcNumLipinskiHBD"] = rdMolDescriptors.CalcNumLipinskiHBD(mol)
        df.at[i,"CalcNumRings"] = rdMolDescriptors.CalcNumRings(mol)
        df.at[i,"CalcNumSaturatedCarbocycles"] = rdMolDescriptors.CalcNumSaturatedCarbocycles(mol)
        df.at[i,"CalcNumSaturatedHeterocycles"] = rdMolDescriptors.CalcNumSaturatedHeterocycles(mol)
        df.at[i,"CalcNumSaturatedRings"] = rdMolDescriptors.CalcNumSaturatedRings(mol)
        df.at[i,"CalcNumSpiroAtoms"] = rdMolDescriptors.CalcNumSpiroAtoms(mol)
        df.at[i,"CalcTPSA"] = rdMolDescriptors.CalcTPSA(mol)
    return(df)