Re: [Rdkit-discuss] Saving chains from PDB file

2019-10-05 Thread Dimitri Maziuk via Rdkit-discuss
On 10/5/2019 10:34 AM, Maciek Wójcikowski wrote: Paolo and Chris, There actually is Rdkit function to do this very task: SplitMolByPDBChainId Why, though? -- It's a punch-card format with chain id in specific column, you just read the lines and sort them into buckets on line[X]. Unless you

Re: [Rdkit-discuss] Saving chains from PDB file

2019-10-05 Thread Chris Swain via Rdkit-discuss
Thanks Chris > On 5 Oct 2019, at 16:34, Maciek Wójcikowski wrote: > > Paolo and Chris, > > There actually is Rdkit function to do this very task: SplitMolByPDBChainId > http://rdkit.org/docs/source/rdkit.Chem.rdmolops.html#rdkit.Chem.rdmolops.SplitMolByPDBChainId > >

Re: [Rdkit-discuss] Saving chains from PDB file

2019-10-05 Thread Maciek Wójcikowski
Paolo and Chris, There actually is Rdkit function to do this very task: SplitMolByPDBChainId http://rdkit.org/docs/source/rdkit.Chem.rdmolops.html#rdkit.Chem.rdmolops.SplitMolByPDBChainId sob., 5 paź 2019, 14:42 użytkownik Paolo Tosco napisał: > Hi Chris, > > The following, though quite

Re: [Rdkit-discuss] Saving chains from PDB file

2019-10-05 Thread Paolo Tosco
Hi Chris, The following, though quite inefficient, will work: from rdkit import Chem mol = Chem.MolFromPDBFile("1CX2.pdb") chains = {a.GetPDBResidueInfo().GetChainId() for a in mol.GetAtoms()} chain_mols = {c: Chem.RWMol(mol) for c in chains} for c, m in chain_mols.items(): bonds_to_remove =