Skip to content

Instantly share code, notes, and snippets.

@PatWalters
PatWalters / split_complex.py
Last active August 30, 2024 14:57
Split a protein-ligand complex into protein and ligands and assign ligand bond orders using SMILES strings from Ligand Expo
#!/usr/bin/env python
# Split a protein-ligand complex into protein and ligands and assign ligand bond orders using SMILES strings from Ligand Export
# Code requires Python 3.6
import sys
from prody import *
import pandas as pd
from rdkit import Chem
from rdkit.Chem import AllChem
@PatWalters
PatWalters / split_complex_v2.py
Created October 2, 2018 01:20
An improved script to extract a ligand from a protein-ligand complex and assign bond orders
#!/usr/bin/env python
import sys
from prody import *
from rdkit import Chem
from rdkit.Chem import AllChem
from io import StringIO
import pypdb
@PatWalters
PatWalters / dupe.py
Last active January 14, 2023 01:12
Compare two SMILES or SD files to identify duplicate structures. Duplicates are identified by comparing InChI keys
#!/usr/bin/env python
import sys
import os
from rdkit import Chem
def molecule_supplier_from_name(input_file_name):
ext = os.path.splitext(input_file_name)[-1]
if ext == ".smi":
#!/usr/bin/env python
import sys
from rdkit import Chem
from tqdm import tqdm
import pandas as pd
import math
def in_place_rmsd(mol_1, mol_2):
@PatWalters
PatWalters / rescale_bonds.ipynb
Created May 23, 2019 14:56
Rescale the bonds in a template molecule so that structures created by rdDepictor.GenerateDepictionMatching2DStructure appear reasonable
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PatWalters
PatWalters / ChEMBL_examples.ipynb
Last active August 31, 2020 23:47
A few ChEMBL query examples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PatWalters
PatWalters / chembl_drugs.smi
Last active August 31, 2020 23:56
Compare some similarity metrics
Br.CC(NC(C)(C)C)C(=O)c1cccc(Cl)c1 675686
Br.Cc1ccc(Sc2ccccc2N3CCNCC3)c(C)c1 1379657
Br.CN(C)CCCC1(OCc2cc(ccc12)C#N)c3ccc(F)cc3 674732
Br.CN1CCC[C@@H]1Cc2c[nH]c3ccc(CCS(=O)(=O)c4ccccc4)cc23 674954
Br.COc1ccc2CN(C)CC[C@@]34C=C[C@H](O)C[C@@H]3Oc1c24 443255
Br.NC(=O)C([C@@H]1CCN(CCc2ccc3OCCc3c2)C1)(c4ccccc4)c5ccccc5 674886
BrCCC(=O)N1CCN(CC1)C(=O)CCBr 453722
C#CCN[C@@H]1CCc2ccccc12 75752
c1ccc2[nH]c(nc2c1)c3cscn3 26590
C1CN2C[C@@H](N=C2S1)c3ccccc3 384948