Re: [Rdkit-discuss] Valence coding in atom block of SDF files written by RDKit

2020-08-27 Thread Jean-Marc Nuzillard
Dear Paolo, many thanks for this regex-based answer to my question. Best, Jean-Marc Le 26/08/2020 à 23:34, Paolo Tosco a écrit : Hi Jean-Marc, You can strip the valence field from the MolBlock with a regex: import re regex = re.compile(r"^(\s*\d+\.\d{4}\s*\d+\.\d{4}\s*\d+\.\d{4} ... \d  

[Rdkit-discuss] Valence coding in atom block of SDF files written by RDKit

2020-08-26 Thread Paolo Tosco
Hi Jean-Marc, You can strip the valence field from the MolBlock with a regex: import re regex = re.compile(r"^(\s*\d+\.\d{4}\s*\d+\.\d{4}\s*\d+\.\d{4} ... \d \d \d \d \d )(\d)(.*)$") print("\n".join(regex.sub(r"\g<1>0\g<3>", ...: line) for line in Chem.MolToMolBlock(Chem....:

[Rdkit-discuss] Valence coding in atom block of SDF files written by RDKit

2020-08-26 Thread Jean-Marc Nuzillard
Dear all, the atom block of the Connection Table produced by RDKit (Chem.MolToMolBlock() function) from the '[NH4+]' SMILES chain is 0.    0.    0. N   0  0  0  0  0  4  0  0  0  0  0 in which the '4' in column 10 indicates that the number of bonds of the N atoms (implicit