Files
rdkit/Code/GraphMol/Wrap/Chirality.cpp
Greg Landrum cd74dc2207 Initial support for non-tetrahedral stereochemistry (#5084)
* very basics: actually parsing the new atom stereochem features

* add some input verification for the chiral permutations

* fix a typo
add quadruple bond SMILES/SMARTS extension

* add forgotten files

* patch from Roger

* add Roger's parsing examples

* typo

* new tests

* adjusted version of next PR from Roger:
- add SP2D hybridization for square planar (this may change)
- some modernizationof Chirality.cpp
- stop using < HybridizationType in Chirality.cpp (should probably do this elsewhere too)
- improved handling of hybridization assignment for new stereochem
- handle new stereo/hybridization in UFF
- tests for the above

* perception of non-tetrahedral stereo from 3D (from Roger S)
Basic testing of SP and TB based on opensmiles docs

* potential fixes for octahedral assignment
more tests

* docs update
need way more!

* map the TH tags directly to @ tags

* very basics of SMILES writing
this does not work with anything that changes the permutation order
like canonicalization or writing things in rings.

* start to support the getChiralAcross API

* more testing

* consistency

* add hasNonTetrahedralStereo() and getIdealAngleBetweenLigands()

* assignStereochemistry should only remove non-tetrahedral stereo

* re-simplify those tests

* cleanup matrix stream output

* initial pass at supporting nontet stereo in distgeom

* backup

* start on the reference docs

* TBP reference

* first pass at Oh finished

* update SP section

* more doc updates

* fix a typo

* add param to not remove Hs connected to non-tetrahedral atoms

* VERY basic coord generation for square planar

* TBP basics

* basic OH depiction

* start testing missing ligands
allow non-tet stereo in rings (ugly, but correct)

* add new TBP functions from Roger

* update depiction code for new API

* backup, the new tests work so far

* Finish the TB tests

* OH tests pass too

* cleanup

* first pass at getting correct SMILES with reordering
need way more testing than this

* ensure permutation 0 is correctly preserved

* some progress towards adding non-tetrahedral stereo to StereoInfo

* doc update

* add non-tet chiral classes to python wrappers

* make sure removeAllHs also gets neighbors of non-tetrahedral centers
more testing

* a bit of depictor cleanup

* make the assignment from 3D more tolerant
more testing

* improve the bulk testing

* cleanup

* remove a bit of redundant code

* ensure we don't write bogus permutation values to SMILES

* fix some rebase problems

* allow assignStereochemistryFrom3D() to be called without sanitization

* allow disabling the non-tetrahedral stereo when it's not explicit

* get that working on windows too
2022-05-20 09:07:16 +02:00

66 lines
3.0 KiB
C++

//
// Copyright (C) 2020 Greg Landrum and T5 Informatics GmbH
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#include <RDBoost/python.h>
#include <string>
#include <GraphMol/RDKitBase.h>
#include <GraphMol/Chirality.h>
#include <RDBoost/Wrap.h>
namespace python = boost::python;
namespace RDKit {
struct chirality_wrapper {
static void wrap() {
python::enum_<Chirality::StereoType>("StereoType")
.value("Unspecified", Chirality::StereoType::Unspecified)
.value("Atom_Tetrahedral", Chirality::StereoType::Atom_Tetrahedral)
.value("Atom_SquarePlanar", Chirality::StereoType::Atom_SquarePlanar)
.value("Atom_TrigonalBipyramidal",
Chirality::StereoType::Atom_TrigonalBipyramidal)
.value("Atom_Octahedral", Chirality::StereoType::Atom_Octahedral)
.value("Bond_Double", Chirality::StereoType::Bond_Double)
.value("Bond_Cumulene_Even", Chirality::StereoType::Bond_Cumulene_Even)
.value("Bond_Atropisomer", Chirality::StereoType::Bond_Atropisomer);
python::enum_<Chirality::StereoSpecified>("StereoSpecified")
.value("Unspecified", Chirality::StereoSpecified::Unspecified)
.value("Specified", Chirality::StereoSpecified::Specified)
.value("Unknown", Chirality::StereoSpecified::Unknown);
python::enum_<Chirality::StereoDescriptor>("StereoDescriptor")
.value("NoValue",
Chirality::StereoDescriptor::None) // can't use "None" in Python
.value("Tet_CW", Chirality::StereoDescriptor::Tet_CW)
.value("Tet_CCW", Chirality::StereoDescriptor::Tet_CCW)
.value("Bond_Cis", Chirality::StereoDescriptor::Bond_Cis)
.value("Bond_Trans", Chirality::StereoDescriptor::Bond_Trans);
python::class_<Chirality::StereoInfo>("StereoInfo",
"Class describing stereochemistry")
.def_readonly("NOATOM", &Chirality::StereoInfo::NOATOM,
"marker for unspecified int values")
.def_readwrite("type", &Chirality::StereoInfo::type,
"the type of stereo")
.def_readwrite("specified", &Chirality::StereoInfo::specified,
"whether or not it is specified")
.def_readwrite("centeredOn", &Chirality::StereoInfo::centeredOn,
"index of the item the stereo concerns")
.def_readwrite("descriptor", &Chirality::StereoInfo::descriptor,
"stereo descriptor")
.def_readwrite("permutation", &Chirality::StereoInfo::permutation,
"permutation index (used for non-tetrahedral chirality)")
.def_readonly("controllingAtoms",
&Chirality::StereoInfo::controllingAtoms,
"indices of the atoms controlling the stereo");
};
};
} // namespace RDKit
void wrap_chirality() { RDKit::chirality_wrapper::wrap(); }