RDkit: Calculate molecular descriptors.

Python script for Windows:

from rdkit import Chem
from rdkit.Chem import Descriptors
from rdkit.Chem import rdMolDescriptors

# List of molecules in SMILES format with names
molecules = [
    ("Fc1ccc2cc1C(=O)N[C@H]1CN(C[C@@H]1Oc1ccc(CNC(=O)COc3cccc2c3)cc1)C(=O)c1cnncc1", "MolPort-051-704-251"),
    ("CS(=O)(=O)c1ccc(CN2CCN3C[C@@H]2C(=O)N2CC[C@@H](CC2)N2CCC[C@H]2C(=O)NC2(CCN(CC2)C(=O)c2ccc(F)cc2)CC3=O)cc1", "MolPort-047-146-537"),
    ("Cc1ccc(cc1NC(=O)c1ccc2C(=O)c3ccccc3S(=O)(=O)c2c1)n1cnnn1", "MolPort-016-317-936"),
    ("Cc1nn(CC(=O)N2C[C@@H]3NC(=O)c4cc(ccc4F)c4cc(OCC(=O)NCc5ccc(O[C@H]3C2)cc5)ccc4)c(C)n1", "MolPort-051-711-095"),
    ("CCOC(=O)C(=P(c1ccccc1)(c1ccccc1)c1ccccc1)/N=N/c1nc2c([nH]1)c(=O)n(C)c(=O)n2C", "MolPort-003-875-006"),
    ("Cc1nnc(NN/C=C/2C(=O)N(C(=O)c3ccccc23)c2cccc(c2)C(F)(F)F)[nH]c1=O", "MolPort-005-845-260"),
    ("O=C(Nc1ccc2OCCCOc2c1)c1cccc(c1)S(=O)(=O)Nc1cccc(c1)n1cnnn1", "MolPort-005-780-546"),
    ("FC(F)(F)c1cc2c(OC[C@@H]3CN(CCN3C(=O)[C@@H]3C[C@H](CN3C2=O)OCc2cn(nn2)c2cccnc2)C2CCOCC2)cc1", "MolPort-047-146-805"),
    ("Cc1cc(no1)C(=O)N1C[C@@H]2NC(=O)CN(CCCCOc3cccc(c3)[C@H]2C1)C(=O)c1cc2c(OCC2)cc1", "MolPort-051-537-866"),
    ("OC(=O)c1cccc(c1)c1ccc(o1)/C=N/Nc1nc(nc(n1)N1CCOCC1)N1CCOCC1", "MolPort-019-736-907"),
    ("Fc1ccc(cc1NC(=O)c1ccc2c(=O)n(Cc3ccco3)c(=O)c2c1)n1cnnn1", "MolPort-016-351-790"),
    ("Cc1cc(no1)C(=O)N1C[C@@H]2NC(=O)CN(CCCCOc3cccc(c3)[C@H]2C1)C(=O)c1cc2c(OCC2)cc1", "MolPort-051-537-867"),
    ("Cc1ccc(C)c(c1)N1N=C(CCC1=O)C(=O)N1CCN(CC1)S(=O)(=O)c1cc(F)ccc1F", "MolPort-015-311-581"),
    ("OC(=O)c1cccc(c1)c1ccc(o1)/C=N/Nc1nc(nc(n1)N1CCOCC1)N1CCCOC1", "MolPort-002-324-981"),
    ("O=c1[nH]c(=O)c(=Cc2ccc(o2)c2ccc3c(=O)c4ccccc4c(=O)c3c2)c(=O)[nH]1", "MolPort-018-497-786"),
    ("Cc1ccc2N(C(=O)N(c2c1)S(=O)(=O)c1ccc(F)cc1)S(=O)(=O)c1ccc(F)cc1", "MolPort-000-645-425"),
    ("COc1c2OCCCNC(=O)c3cc(Oc4ccc5[C@@H](N(CCc5c4)S(=O)(=O)c4cn(C)c(=O)n(C)c4=O)c(cc1)c2)ccc3F", "MolPort-051-706-687"),
    ("O=C(Nc1cccc(c1)n1cnnn1)[C@@H]1CCN(CC1)C1=NS(=O)(=O)c2ccccc12", "MolPort-005-327-526"),
    ("Cc1ccc(C)c(c1)N1N=C(CCC1=O)C(=O)N1CCN(CC1)S(=O)(=O)c1ccc(F)cc1", "MolPort-009-502-131"),
    ("O=C(N1C[C@H]2C[C@@H]1C(=O)NCC[C@H]1CN(CC[C@H]1CC(=O)N1CC[C@H](CC1)N1CCC[C@H]1C(=O)N2)C1CCOCC1)c1ccccc1", "MolPort-047-146-646"),
    ("CNC(=O)c1nccc(c1)C(=O)N[C@@H]1CCc2nc3ncc(cc3cc2C1)c1cncnc1", "MolPort-050-857-090"),
    ("COC(=O)[C@H]1C[C@H]2CN(CC(=O)N2[C@H]1c1ccccc1)C(=O)c1n[nH]c(c1)n1cnnn1", "MolPort-047-597-539"),
    ("O=C(Nc1ccc(NS(=O)(=O)c2ccc3OCCOc3c2)cc1)c1cccc(c1)n1cnnn1", "MolPort-005-791-198"),
    ("Fc1ccc(CN2N=C(CCC2=O)C(=O)Nc2cccc(c2)c2noc(=O)[nH]2)cc1MolPort-027-974-229", "MolPort-027-974-229"),
    ("Cc1c2OCC(=O)NCc3ccc(O[C@H]4CCN(C[C@@H]4NC(=O)c(cc1)c2)c1nccc(c1)C#N)cc3", "MolPort-051-504-308"),
    ("Cn1c2c(c(c([nH]2)c2cc3c(OCCO3)cc2)c2c(n3cccc3)n(C)c(=O)n(C)c2=O)c(=O)n(C)c1=O", "MolPort-010-755-462"),
    ("Cc1c2OCC(=O)NCc3ccc(O[C@H]4CCN(C[C@@H]4NC(=O)c(cc1)c2)c1ncc(cc1)C#N)cc3", "MolPort-051-505-109"),
    ("CNC(=O)c1cccc(NC(=O)c2ccc(OC)c(c2)S(=O)(=O)N2CCCCCC2)c1", "MolPort-019-471-102"),
    ("Cc1ccc(cc1NC(=O)c1cccc(c1)S(=O)(=O)N1CCNC(=O)C1)n1cnnn1", "MolPort-016-318-066"),
    ("O=C([C@H](C#N)c1nc2ccccc2c(=O)[nH]1)c1ccc2C(=O)c3ccccc3S(=O)(=O)c2c1", "MolPort-047-768-807"),
    ("O=C([C@H]1C[C@]21C(=O)Nc1c2cccc1)N1CC2(CCCC2)c2c1ccc(c2)C(=O)N1CC[C@@]2(C1)NC(=O)NC2=O", "MolPort-051-592-471"),
    ("OC(=O)/C=C/c1ccc(cc1)S(=O)(=O)Nn1c(=O)/c(=C/c2ccco2)/nc1c1ccccc1", "MolPort-003-873-516"),
    ("Nc1n[nH]c2ccc(cc12)c1cccc(c1)C(=O)N1C[C@H]2COC[C@@H](C1)C(=O)N2", "MolPort-051-750-878"),
    ("Cn1c2c(c(c([nH]2)c2cc3c(OCO3)cc2)c2c(n3cccc3)n(C)c(=O)n(C)c2=O)c(=O)n(C)c1=O", "MolPort-007-698-991"),
    ("COC(=O)c1ccc(CNC(=O)c2cccc(NS(=O)(=O)c3ccc4OCCOc4c3)c2)cc1", "MolPort-004-482-921"),
    ("Cc1ccc(cc1NC(=O)c1ccc(C)c(c1)S(=O)(=O)N1CCCCC1)n1cnnn1", "MolPort-010-354-128"),
    ("O=C(Nc1cccc(c1)n1cnnn1)c1ccc2c(=O)n(Cc3ccco3)c(=O)c2c1", "MolPort-005-767-802"),
    ("O=C(Nc1cccc(c1)n1cnnn1)c1cccc(c1)S(=O)(=O)N1CCN(CC1)c1ccccc1", "MolPort-019-471-867"),
    ("COc1ccc(Cn2c(=O)c3ccccc3c2=O)cc1C(=O)Nc1cc(ccc1F)n1cnnn1", "MolPort-016-351-793"),
    ("Cc1ccc(cc1NC(=O)c1cccc(CN2C(=O)CNC2=O)c1)n1cnnn1", "MolPort-016-318-061"),
    ("Cc1ccc(cc1NC(=O)C1CCN(CC1)S(=O)(=O)c1ccc(cc1)C#N)n1cnnn1", "MolPort-016-317-952"),
    ("Oc1ccc(cn1)C(=O)NNC(=O)c1cccc(c1)S(=O)(=O)Nc1cccc(c1)C(F)(F)F", "MolPort-019-485-069"),
    ("COc1ccc(cc1S(=O)(=O)N1CCOCC1)C(=O)Nc1cc(NC(=O)C2CC2)ccc1C", "MolPort-007-540-817"),
    ("CCOC(=O)c1nn(cc1)c1cccc(NC(=O)C2=NN(C(=O)CN2)c2ccc(C)cc2)c1", "MolPort-016-529-703"),
    ("O=C(Nc1cccc(c1)c1nnn[nH]1)c1ccc2c(=O)n3CCCCCc3nc2c1", "MolPort-005-754-412"),
    ("CNC(=O)c1cccc(NC(=O)c2ccc(F)c(c2)S(=O)(=O)N2CCCCC2)c1", "MolPort-010-285-351"),
    ("CC(=O)Nc1ccc(C)c(NC(=O)C2CCN(CC2)S(=O)(=O)c2ccccc2)c1", "MolPort-007-499-937"),
    ("CNC(=O)c1cccc(NC(=O)c2nn(C)c(NC(=O)CCc3ccccc3)c2)c1", "MolPort-008-196-016"),
    ("Fc1ccc(cc1NC(=O)c1ccc(NS(=O)(=O)c2cccs2)cc1)n1cnnn1", "MolPort-016-355-012"),
    ("Fc1ccc(Cn2c(=O)c(Cc3ccccc3)cc3c2CCN(C3)C(=O)c2n[nH]c(=O)[nH]2)cc1", "MolPort-004-983-373"),
    ("Cc1ccc(cc1NC(=O)c1cccc(CN2C(=O)CSC2=O)c1)n1cnnn1", "MolPort-016-318-051"),
    ("CNC(=O)c1cccc(NC(=O)c2cccc(c2)S(=O)(=O)N2CCN(CC2)c2ccccc2)c1", "MolPort-019-471-016"),
    ("O=C(Cn1c(=O)c2c(sc3c2CCC3)nc1N1CCN(CC(=O)N2CC2)CC1)Nc1cccc2ccccc12", "MolPort-006-683-342"),
    ("NC(=O)c1cc(NC(=O)c2ccc3C(=O)c4ccccc4S(=O)(=O)c3c2)ccc1F", "MolPort-009-185-968"),
    ("Cc1ccc(cc1C)S(=O)(=O)N1CCC(CC1)C(=O)Nc1cc(ccc1F)n1cnnn1", "MolPort-016-351-789"),
    ("CC(=O)c1ccc(cc1)S(=O)(=O)N1CCC(CC1)C(=O)Nc1cccc(c1)n1cnnn1", "MolPort-019-471-949"),
    ("CN(C)S(=O)(=O)c1cc(cc(C)c1C)C(=O)Nc1cc(ccc1F)n1cnnn1", "MolPort-016-351-916"),
    ("Cc1ccc(cc1S(=O)(=O)N1CCCCC1)C(=O)Nc1cccc(c1)n1cnnn1", "MolPort-018-270-599"),
    ("OC(=O)Cc1csc(NC(=O)c2cccc(c2)S(=O)(=O)N2CCc3ccccc3C2)n1", "MolPort-005-406-336"),
    ("Cc1ccc(cc1NC(=O)c1ccc(F)c(c1)S(=O)(=O)N1CCCCC1)n1cnnn1", "MolPort-016-317-991"),
    ("O=C(N1CCN(CC1)C(=O)c1cc(Nc2nc3ccccc3n3nnnc23)ccc1)c1ccco1", "MolPort-007-757-935"),
    ("OC(=O)c1cc(NS(=O)(=O)c2ccc3c(=O)c4ccccc4c(=O)c3c2)ccc1O", "MolPort-002-363-292"),
    ("NC(=O)CNC(=O)c1cccc(NC(=O)c2ccc3c(=O)n(Cc4ccccc4)c(=O)c3c2)c1", "MolPort-007-474-755"),
    ("CS(=O)(=O)c1nc(C(=O)Nc2cc(ccc2F)n2cnnn2)c2ccccn12", "MolPort-015-759-447"),
    ("COC(=O)c1cccc(c1)C#Cc1cccc(NS(=O)(=O)c2ccc(cc2)S(=O)(=O)N(C)C)c1", "MolPort-005-728-204"),
    ("[H]N1C([H])=C(C2=C1C([H])=C([H])C([H])=C2[H])C([H])([H])[C@@]1([H])N([H])[C@]2(C(=O)N([H])C3=C2C([H])=C(Cl)C([H])=C3[H])[C@@]2([H])C(=O)N(C(=O)[C@@]12[H])C1=C([H])C([H])=C2OC([H])([H])C([H])([H])OC2=C1[H]", "PHAR-ISO1"),
    ("[H]N1C([H])=C(C2=C1C([H])=C([H])C([H])=C2[H])C([H])([H])[C@]1([H])N([H])[C@@]2(C(=O)N([H])C3=C2C([H])=C(Cl)C([H])=C3[H])[C@]2([H])C(=O)N(C(=O)[C@]12[H])C1=C([H])C([H])=C2OC([H])([H])C([H])([H])OC2=C1[H]", "PHAR-ISO2"),
    ("COc1cc(N[C@H]2C[C@H](C2)c2cc(=O)[nH]c(n2)N2CCCC2)nc(N)n1MolPort-038-389-925", "MolPort-038-389-925"),
    ("O=C(Nc1cccc(c1)c1nnco1)c1cccc(c1)S(=O)(=O)N1CCCC1MolPort-035-515-658", "MolPort-035-515-658"),
    ("O=C(CNC(=O)c1ccco1)Nc1cccc(c1)S(=O)(=O)/N=C1/CCCCCN1MolPort-039-260-233", "MolPort-039-260-233"),
    ("C[C@H]1NC(=O)c2c(OCCCn3cc(CN(CCCNC1=O)C(=O)Cc1ccc4OCOc4c1)nn3)cc(C)cc2", "MolPort-046-570-315"),
    ("O=C(NCc1nnn[nH]1)c1cccc(c1)c1ccc(o1)C(=O)N1CCCCC1", "MolPort-042-625-092"),
]

# Create a list to store molecular properties
molecule_data = []

for smiles, name in molecules:
    mol = Chem.MolFromSmiles(smiles)  # Convert SMILES to RDKit Mol object
    if mol:
        # Calculate molecular descriptors
        logp = Descriptors.MolLogP(mol)  # LogP: hydrophobicity (lower = more polar)
        tpsa = Descriptors.TPSA(mol)    # Polar Surface Area (PSA)
        mw = Descriptors.MolWt(mol)     # Molecular Weight (MW)
        rot_bonds = Descriptors.NumRotatableBonds(mol)  # Number of rotatable bonds
        arom_rings = rdMolDescriptors.CalcNumAromaticRings(mol)  # Number of aromatic rings
        h_acceptors = Descriptors.NumHAcceptors(mol)  # Number of hydrogen bond acceptors
        h_donors = Descriptors.NumHDonors(mol)  # Number of hydrogen bond donors
        # Append the calculated properties to the list
        molecule_data.append((name, smiles, logp, tpsa, mw, rot_bonds, arom_rings, h_acceptors, h_donors))

# Sort the list by LogP (relative polarity)
# sorted_by_logp = sorted(molecule_data, key=lambda x: x[2])
sorted_by_tpsa = sorted(molecule_data, key=lambda x: x[3])

# Display results
print(f"{'Name':<20} {'LogP':<8} {'PSA':<8} {'MW':<8} {'RotB':<6} {'AromR':<6} {'H-Accept':<10} {'H-Donors':<10} SMILES")
print("=" * 80)

for name, smiles, logp, tpsa, mw, rot_bonds, arom_rings, h_acceptors, h_donors in sorted_by_tpsa:
    print(f"{name:<20} {logp:<8.2f} {tpsa:<8.2f} {mw:<8.2f} {rot_bonds:<6} {arom_rings:<6} {h_acceptors:<10} {h_donors:<10} {smiles}")

See the results:

Name                 LogP     TPSA     MW       RotB   AromR  H-Accept   H-Donors   SMILES
================================================================================
MolPort-015-311-581  2.60     90.36    490.53   4      2      5          0          Cc1ccc(C)c(c1)N1N=C(CCC1=O)C(=O)N1CCN(CC1)S(=O)(=O)c1cc(F)ccc1F
MolPort-009-502-131  2.46     90.36    472.54   4      2      5          0          Cc1ccc(C)c(c1)N1N=C(CCC1=O)C(=O)N1CCN(CC1)S(=O)(=O)c1ccc(F)cc1
MolPort-006-683-342  2.70     90.55    542.67   6      4      8          1          O=C(Cn1c(=O)c2c(sc3c2CCC3)nc1N1CCN(CC(=O)N2CC2)CC1)Nc1cccc2ccccc12
MolPort-000-645-425  2.86     95.21    464.47   4      4      7          0          Cc1ccc2N(C(=O)N(c2c1)S(=O)(=O)c1ccc(F)cc1)S(=O)(=O)c1ccc(F)cc1
MolPort-010-285-351  2.61     95.58    419.48   5      2      4          2          CNC(=O)c1cccc(NC(=O)c2ccc(F)c(c2)S(=O)(=O)N2CCCCC2)c1
MolPort-007-499-937  2.99     95.58    415.52   5      2      4          2          CC(=O)Nc1ccc(C)c(NC(=O)C2CCN(CC2)S(=O)(=O)c2ccccc2)c1
MolPort-019-471-016  2.81     98.82    478.57   6      3      5          2          CNC(=O)c1cccc(NC(=O)c2cccc(c2)S(=O)(=O)N2CCN(CC2)c2ccccc2)c1
MolPort-004-983-373  2.24     103.85   459.48   5      4      5          2          Fc1ccc(Cn2c(=O)c(Cc3ccccc3)cc3c2CCN(C3)C(=O)c2n[nH]c(=O)[nH]2)cc1
MolPort-019-471-102  2.87     104.81   445.54   6      2      5          2          CNC(=O)c1cccc(NC(=O)c2ccc(OC)c(c2)S(=O)(=O)N2CCCCCC2)c1
MolPort-008-196-016  2.60     105.12   405.46   7      3      5          3          CNC(=O)c1cccc(NC(=O)c2nn(C)c(NC(=O)CCc3ccccc3)c2)c1
MolPort-005-728-204  2.92     109.85   498.58   6      3      6          1          COC(=O)c1cccc(c1)C#Cc1cccc(NS(=O)(=O)c2ccc(cc2)S(=O)(=O)N(C)C)c1
MolPort-010-354-128  2.71     110.08   440.53   5      3      7          1          Cc1ccc(cc1NC(=O)c1ccc(C)c(c1)S(=O)(=O)N1CCCCC1)n1cnnn1
MolPort-016-318-051  2.42     110.08   408.44   5      3      8          1          Cc1ccc(cc1NC(=O)c1cccc(CN2C(=O)CSC2=O)c1)n1cnnn1
MolPort-016-351-789  2.46     110.08   458.52   5      3      7          1          Cc1ccc(cc1C)S(=O)(=O)N1CCC(CC1)C(=O)Nc1cc(ccc1F)n1cnnn1
MolPort-016-351-916  1.92     110.08   418.45   5      3      7          1          CN(C)S(=O)(=O)c1cc(cc(C)c1C)C(=O)Nc1cc(ccc1F)n1cnnn1
MolPort-018-270-599  2.40     110.08   426.50   5      3      7          1          Cc1ccc(cc1S(=O)(=O)N1CCCCC1)C(=O)Nc1cccc(c1)n1cnnn1
MolPort-016-317-991  2.54     110.08   444.49   5      3      7          1          Cc1ccc(cc1NC(=O)c1ccc(F)c(c1)S(=O)(=O)N1CCCCC1)n1cnnn1
PHAR-ISO1            3.76     112.76   554.99   3      4      6          3          [H]N1C([H])=C(C2=C1C([H])=C([H])C([H])=C2[H])C([H])([H])[C@@]1([H])N([H])[C@]2(C(=O)N([H])C3=C2C([H])=C(Cl)C([H])=C3[H])[C@@]2([H])C(=O)N(C(=O)[C@@]12[H])C1=C([H])C([H])=C2OC([H])([H])C([H])([H])OC2=C1[H]
PHAR-ISO2            3.76     112.76   554.99   3      4      6          3          [H]N1C([H])=C(C2=C1C([H])=C([H])C([H])=C2[H])C([H])([H])[C@]1([H])N([H])[C@@]2(C(=O)N([H])C3=C2C([H])=C(Cl)C([H])=C3[H])[C@]2([H])C(=O)N(C(=O)[C@]12[H])C1=C([H])C([H])=C2OC([H])([H])C([H])([H])OC2=C1[H]
MolPort-019-471-867  2.43     113.32   489.56   6      4      8          1          O=C(Nc1cccc(c1)n1cnnn1)c1cccc(c1)S(=O)(=O)N1CCN(CC1)c1ccccc1
MolPort-051-750-878  1.40     113.34   391.43   2      3      5          3          Nc1n[nH]c2ccc(cc12)c1cccc(c1)C(=O)N1C[C@H]2COC[C@@H](C1)C(=O)N2
MolPort-007-540-817  2.63     114.04   473.55   7      2      6          2          COc1ccc(cc1S(=O)(=O)N1CCOCC1)C(=O)Nc1cc(NC(=O)C2CC2)ccc1C
MolPort-051-537-866  2.96     114.21   544.61   2      3      7          1          Cc1cc(no1)C(=O)N1C[C@@H]2NC(=O)CN(CCCCOc3cccc(c3)[C@H]2C1)C(=O)c1cc2c(OCC2)cc1
MolPort-051-537-867  2.96     114.21   544.61   2      3      7          1          Cc1cc(no1)C(=O)N1C[C@@H]2NC(=O)CN(CCCCOc3cccc(c3)[C@H]2C1)C(=O)c1cc2c(OCC2)cc1
MolPort-047-146-646  1.87     114.53   648.85   2      1      7          2          O=C(N1C[C@H]2C[C@@H]1C(=O)NCC[C@H]1CN(CC[C@H]1CC(=O)N1CC[C@H](CC1)N1CCC[C@H]1C(=O)N2)C1CCOCC1)c1ccccc1
MolPort-047-146-805  2.57     115.15   641.65   5      3      10         0          FC(F)(F)c1cc2c(OC[C@@H]3CN(CCN3C(=O)[C@@H]3C[C@H](CN3C2=O)OCc2cn(nn2)c2cccnc2)C2CCOCC2)cc1
MolPort-051-504-308  2.73     116.58   497.56   1      3      7          2          Cc1c2OCC(=O)NCc3ccc(O[C@H]4CCN(C[C@@H]4NC(=O)c(cc1)c2)c1nccc(c1)C#N)cc3
MolPort-051-505-109  2.73     116.58   497.56   1      3      7          2          Cc1c2OCC(=O)NCc3ccc(O[C@H]4CCN(C[C@@H]4NC(=O)c(cc1)c2)c1ncc(cc1)C#N)cc3
MolPort-005-406-336  2.77     116.67   457.53   6      3      6          2          OC(=O)Cc1csc(NC(=O)c2cccc(c2)S(=O)(=O)N2CCc3ccccc3C2)n1
MolPort-042-625-092  2.02     117.01   380.41   5      3      6          2          O=C(NCc1nnn[nH]1)c1cccc(c1)c1ccc(o1)C(=O)N1CCCCC1
MolPort-016-529-703  2.25     117.92   446.47   6      3      8          2          CCOC(=O)c1nn(cc1)c1cccc(NC(=O)C2=NN(C(=O)CN2)c2ccc(C)cc2)c1
MolPort-005-754-412  2.56     118.45   401.43   3      4      7          2          O=C(Nc1cccc(c1)c1nnn[nH]1)c1ccc2c(=O)n3CCCCCc3nc2c1
MolPort-016-355-012  2.92     118.87   444.47   6      4      8          2          Fc1ccc(cc1NC(=O)c1ccc(NS(=O)(=O)c2cccs2)cc1)n1cnnn1
MolPort-016-351-793  2.86     119.31   472.44   6      4      8          1          COc1ccc(Cn2c(=O)c3ccccc3c2=O)cc1C(=O)Nc1cc(ccc1F)n1cnnn1
MolPort-004-482-921  2.98     120.03   482.51   7      3      7          2          COC(=O)c1ccc(CNC(=O)c2cccc(NS(=O)(=O)c3ccc4OCCOc4c3)c2)cc1
MolPort-005-845-260  2.64     120.08   456.38   4      3      7          3          Cc1nnc(NN/C=C/2C(=O)N(C(=O)c3ccccc23)c2cccc(c2)C(F)(F)F)[nH]c1=O
MolPort-007-757-935  2.61     121.76   468.48   4      5      9          1          O=C(N1CCN(CC1)C(=O)c1cc(Nc2nc3ccccc3n3nnnc23)ccc1)c1ccco1
MolPort-016-318-061  1.27     122.11   391.39   5      3      7          2          Cc1ccc(cc1NC(=O)c1cccc(CN2C(=O)CNC2=O)c1)n1cnnn1
MolPort-005-327-526  1.46     122.44   437.49   3      3      8          1          O=C(Nc1cccc(c1)n1cnnn1)[C@@H]1CCN(CC1)C1=NS(=O)(=O)c2ccccc12
MolPort-018-497-786  2.47     122.55   412.36   2      3      6          2          O=c1[nH]c(=O)c(=Cc2ccc(o2)c2ccc3c(=O)c4ccccc4c(=O)c3c2)c(=O)[nH]1
MolPort-050-857-090  2.13     122.65   439.48   4      4      7          2          CNC(=O)c1nccc(c1)C(=O)N[C@@H]1CCc2nc3ncc(cc3cc2C1)c1cncnc1
MolPort-051-704-251  2.99     122.75   567.58   1      4      7          2          Fc1ccc2cc1C(=O)N[C@H]1CN(C[C@@H]1Oc1ccc(CNC(=O)COc3cccc2c3)cc1)C(=O)c1cnncc1
MolPort-005-767-802  2.30     123.22   414.38   5      4      8          1          O=C(Nc1cccc(c1)n1cnnn1)c1ccc2c(=O)n(Cc3ccco3)c(=O)c2c1
MolPort-016-351-790  2.44     123.22   432.37   5      4      8          1          Fc1ccc(cc1NC(=O)c1ccc2c(=O)n(Cc3ccco3)c(=O)c2c1)n1cnnn1
MolPort-009-185-968  2.55     123.40   424.41   3      3      5          2          NC(=O)c1cc(NC(=O)c2ccc3C(=O)c4ccccc4S(=O)(=O)c3c2)ccc1F
MolPort-003-875-006  2.73     123.70   554.55   7      5      8          1          CCOC(=O)C(=P(c1ccccc1)(c1ccccc1)c1ccccc1)/N=N/c1nc2c([nH]1)c(=O)n(C)c(=O)n2C
MolPort-016-317-936  2.60     123.91   445.46   3      4      8          1          Cc1ccc(cc1NC(=O)c1ccc2C(=O)c3ccccc3S(=O)(=O)c2c1)n1cnnn1
MolPort-015-759-447  1.10     124.14   401.38   4      4      9          1          CS(=O)(=O)c1nc(C(=O)Nc2cc(ccc2F)n2cnnn2)c2ccccn12
MolPort-019-471-949  1.90     127.15   454.51   6      3      8          1          CC(=O)c1ccc(cc1)S(=O)(=O)N1CCC(CC1)C(=O)Nc1cccc(c1)n1cnnn1
MolPort-010-755-462  0.86     127.18   516.51   3      5      11         1          Cn1c2c(c(c([nH]2)c2cc3c(OCCO3)cc2)c2c(n3cccc3)n(C)c(=O)n(C)c2=O)c(=O)n(C)c1=O
MolPort-007-698-991  0.82     127.18   502.49   3      5      11         1          Cn1c2c(c(c([nH]2)c2cc3c(OCO3)cc2)c2c(n3cccc3)n(C)c(=O)n(C)c2=O)c(=O)n(C)c1=O
MolPort-051-711-095  2.80     127.68   598.64   2      4      8          2          Cc1nn(CC(=O)N2C[C@@H]3NC(=O)c4cc(ccc4F)c4cc(OCC(=O)NCc5ccc(O[C@H]3C2)cc5)ccc4)c(C)n1
MolPort-051-592-471  2.18     127.92   539.59   2      2      5          3          O=C([C@H]1C[C@]21C(=O)Nc1c2cccc1)N1CC2(CCCC2)c2c1ccc(c2)C(=O)N1CC[C@@]2(C1)NC(=O)NC2=O
MolPort-003-873-516  2.90     129.28   463.47   7      3      6          2          OC(=O)/C=C/c1ccc(cc1)S(=O)(=O)Nn1c(=O)/c(=C/c2ccco2)/nc1c1ccccc1
MolPort-047-146-537  1.89     130.65   722.88   4      2      8          1          CS(=O)(=O)c1ccc(CN2CCN3C[C@@H]2C(=O)N2CC[C@@H](CC2)N2CCC[C@H]2C(=O)NC2(CCN(CC2)C(=O)c2ccc(F)cc2)CC3=O)cc1
MolPort-016-317-952  1.88     133.87   451.51   5      3      8          1          Cc1ccc(cc1NC(=O)C1CCN(CC1)S(=O)(=O)c1ccc(cc1)C#N)n1cnnn1
MolPort-046-570-315  1.99     136.91   562.63   2      3      9          2          C[C@H]1NC(=O)c2c(OCCCn3cc(CN(CCCNC1=O)C(=O)Cc1ccc4OCOc4c1)nn3)cc(C)cc2
MolPort-005-780-546  2.88     137.33   492.52   6      4      9          2          O=C(Nc1ccc2OCCCOc2c1)c1cccc(c1)S(=O)(=O)Nc1cccc(c1)n1cnnn1
MolPort-005-791-198  2.49     137.33   478.49   6      4      9          2          O=C(Nc1ccc(NS(=O)(=O)c2ccc3OCCOc3c2)cc1)c1cccc(c1)n1cnnn1
MolPort-019-485-069  2.68     137.49   480.42   5      3      6          4          Oc1ccc(cn1)C(=O)NNC(=O)c1cccc(c1)S(=O)(=O)Nc1cccc(c1)C(F)(F)F
MolPort-047-768-807  2.79     137.82   455.45   3      4      7          1          O=C([C@H](C#N)c1nc2ccccc2c(=O)[nH]1)c1ccc2C(=O)c3ccccc3S(=O)(=O)c2c1
MolPort-002-363-292  2.67     137.84   423.40   4      3      6          3          OC(=O)c1cc(NS(=O)(=O)c2ccc3c(=O)c4ccccc4c(=O)c3c2)ccc1O
MolPort-051-706-687  2.87     138.17   650.69   3      4      10         1          COc1c2OCCCNC(=O)c3cc(Oc4ccc5[C@@H](N(CCc5c4)S(=O)(=O)c4cn(C)c(=O)n(C)c4=O)c(cc1)c2)ccc3F
MolPort-019-736-907  1.95     138.44   479.50   7      3      11         2          OC(=O)c1cccc(c1)c1ccc(o1)/C=N/Nc1nc(nc(n1)N1CCOCC1)N1CCOCC1
MolPort-002-324-981  2.30     138.44   479.50   7      3      11         2          OC(=O)c1cccc(c1)c1ccc(o1)/C=N/Nc1nc(nc(n1)N1CCOCC1)N1CCCOC1
MolPort-007-474-755  1.95     138.67   456.46   7      3      5          3          NC(=O)CNC(=O)c1cccc(NC(=O)c2ccc3c(=O)n(Cc4ccccc4)c(=O)c3c2)c1
MolPort-016-318-066  0.34     139.18   441.47   5      3      8          2          Cc1ccc(cc1NC(=O)c1cccc(c1)S(=O)(=O)N1CCNC(=O)C1)n1cnnn1
MolPort-047-597-539  -0.03    139.20   436.43   4      3      9          1          COC(=O)[C@H]1C[C@H]2CN(CC(=O)N2[C@H]1c1ccccc1)C(=O)c1n[nH]c(c1)n1cnnn1

A second version with a list.txt for Name and SMILES of the molecules.

import csv
from rdkit import Chem
from rdkit.Chem import Descriptors
from rdkit.Chem import rdMolDescriptors

# Path to the input file
input_file = r"D:\encinar\tempjant\24_bTRCP\104-10millones-contra-1P22\_ordena-TPSA.txt"

# Read molecules from the file
molecules = []
with open(input_file, "r") as file:
    reader = csv.DictReader(file, delimiter="\t")  # Use tab as the delimiter
    for row in reader:
        name = row["Name"]  # Molecule name
        smiles = row["SMILES"]  # SMILES representation
        molecules.append((name, smiles))

# Create a list to store molecular properties
molecule_data = []

for name, smiles in molecules:
    mol = Chem.MolFromSmiles(smiles)  # Convert SMILES to RDKit Mol object
    if mol:
        # Calculate molecular descriptors
        logp = Descriptors.MolLogP(mol)  # LogP: Hydrophobicity (lower = more polar)
        tpsa = Descriptors.TPSA(mol)    # Topological Polar Surface Area (TPSA)
        mw = Descriptors.MolWt(mol)     # Molecular Weight (MW)
        rot_bonds = Descriptors.NumRotatableBonds(mol)  # Number of rotatable bonds
        arom_rings = rdMolDescriptors.CalcNumAromaticRings(mol)  # Number of aromatic rings
        h_acceptors = Descriptors.NumHAcceptors(mol)  # Number of hydrogen bond acceptors
        h_donors = Descriptors.NumHDonors(mol)  # Number of hydrogen bond donors
        # Append calculated properties to the list
        molecule_data.append((name, smiles, logp, tpsa, mw, rot_bonds, arom_rings, h_acceptors, h_donors))

# Sort molecules by TPSA (absolute polarity)
sorted_by_tpsa = sorted(molecule_data, key=lambda x: x[3])

# Display results in a formatted table
print(f"{'Name':<20} {'LogP':<8} {'TPSA':<8} {'MW':<8} {'RotB':<6} {'AromR':<6} {'H-Accept':<10} {'H-Donors':<10} SMILES")
print("=" * 100)

for name, smiles, logp, tpsa, mw, rot_bonds, arom_rings, h_acceptors, h_donors in sorted_by_tpsa:
    print(f"{name:<20} {logp:<8.2f} {tpsa:<8.2f} {mw:<8.2f} {rot_bonds:<6} {arom_rings:<6} {h_acceptors:<10} {h_donors:<10} {smiles}")

See the input _ordena-TPSA.txt:

Name	SMILES
MolPort-045-630-269	O=C(Nc1ccc(NS(=O)(=O)c2ccc3OCCCOc3c2)cc1)c1cccc(c1)n1cnnn1
MolPort-044-301-427	Cc1nnc(NN/C=C/2C(=O)N(C(=O)c3ccccc23)c2cccc(c2)C(F)(F)F)[nH]c1=O
MolPort-045-628-701	Cc1ccc(cc1NC(=O)c1cccc(c1)S(=O)(=O)NCC#C)c1n[nH]c(=O)[nH]1
MolPort-046-075-198	Cc1ccc(cc1S(=O)(=O)C)C(=O)Nc1cccc(c1)c1nnc[nH]1
MolPort-050-951-899	Cc1cc(no1)C(=O)Nc1nc(co1)C(=O)N1CCc2nc3ncc(C)cc3cc2C1
MolPort-051-015-674	CN(CC(=O)N1CCC(CC1)Nc1ncnc(c1)C(F)(F)F)C(=O)c1ccc(cc1)S(=O)(=O)N1CCOCC1
MolPort-050-559-530	CC(=O)Nc1cc(C)c(cc1)S(=O)(=O)N1CCc2nc3ncc(C)cc3cc2C1
MolPort-050-566-524	Cn1c(=O)[nH]c(cc1=O)N1CCN(CC1)C(=O)c1c(c2cc(Cl)ccc2[nH]1)c1ccccc1
MolPort-049-226-531	OS(=O)(=O)c1ccc(o1)/C=N/n1cnc2c([nH]c3c2cc(Br)cc3)c1=O
MolPort-049-171-342	CN(C)S(=O)(=O)c1cc(ccc1C)C(=O)N1CCOc2c1cc(NC(=O)c1ccncc1)cc2

and see the output:

Name                 LogP     TPSA     MW       RotB   AromR  H-Accept   H-Donors   SMILES
====================================================================================================
MolPort-050-559-530  2.95     92.26    410.50   3      3      5          1          CC(=O)Nc1cc(C)c(cc1)S(=O)(=O)N1CCc2nc3ncc(C)cc3cc2C1
MolPort-050-566-524  2.84     94.20    463.93   3      4      5          2          Cn1c(=O)[nH]c(cc1=O)N1CCN(CC1)C(=O)c1c(c2cc(Cl)ccc2[nH]1)c1ccccc1
MolPort-046-075-198  2.44     104.81   356.41   4      3      5          2          Cc1ccc(cc1S(=O)(=O)C)C(=O)Nc1cccc(c1)c1nnc[nH]1
MolPort-049-171-342  2.93     108.91   480.55   5      3      6          1          CN(C)S(=O)(=O)c1cc(ccc1C)C(=O)N1CCOc2c1cc(NC(=O)c1ccncc1)cc2
MolPort-044-301-427  2.64     120.08   456.38   4      3      7          3          Cc1nnc(NN/C=C/2C(=O)N(C(=O)c3ccccc23)c2cccc(c2)C(F)(F)F)[nH]c1=O
MolPort-051-015-674  1.69     125.04   570.59   7      2      8          1          CN(CC(=O)N1CCC(CC1)Nc1ncnc(c1)C(F)(F)F)C(=O)c1ccc(cc1)S(=O)(=O)N1CCOCC1
MolPort-050-951-899  2.67     127.25   418.41   3      4      8          1          Cc1cc(no1)C(=O)Nc1nc(co1)C(=O)N1CCc2nc3ncc(C)cc3cc2C1
MolPort-049-226-531  2.36     130.55   437.23   3      4      7          2          OS(=O)(=O)c1ccc(o1)/C=N/n1cnc2c([nH]c3c2cc(Br)cc3)c1=O
MolPort-045-628-701  1.24     136.81   411.44   6      3      5          4          Cc1ccc(cc1NC(=O)c1cccc(c1)S(=O)(=O)NCC#C)c1n[nH]c(=O)[nH]1
MolPort-045-630-269  2.88     137.33   492.52   6      4      9          2          O=C(Nc1ccc(NS(=O)(=O)c2ccc3OCCCOc3c2)cc1)c1cccc(c1)n1cnnn1





Última modificación: