()
| 309 | molecules = [mol for mol in supplier if mol is not None] |
| 310 | |
| 311 | def process_fingerprint(): |
| 312 | # load fingerprint data |
| 313 | ## column is drug, index is morgan bits |
| 314 | # Read SDF File |
| 315 | # supplier = rdkit.Chem.SDMolSupplier(os.path.join(ROOT_DIR, 'data', 'drug_data','structures.sdf')) |
| 316 | |
| 317 | |
| 318 | fingerprints = dict() |
| 319 | for mol in molecules: |
| 320 | drugbank_id = mol.GetProp('DATABASE_ID') |
| 321 | ## or use MACCS: (MACCSkeys.GenMACCSKeys(molecules[0]) |
| 322 | ## Here is morgan |
| 323 | bitvect = AllChem.GetMorganFingerprintAsBitVect(mol,2,nBits=256).ToBitString() |
| 324 | fingerprint = [int(i) for i in bitvect] |
| 325 | fingerprints[split_it(drugbank_id)] = fingerprint |
| 326 | |
| 327 | fingerprints = pd.DataFrame(fingerprints) |
| 328 | fingerprints.columns = fingerprints.columns.astype(int) |
| 329 | return fingerprints |
| 330 | |
| 331 | def process_MACCS(): |
| 332 | # MACCS fingerprint |
no test coverage detected