Files
rdkit/Code/GraphMol/Wrap/Chirality.cpp
Greg Landrum 19bdd21de1 Updated code for chirality perception (#3324)
* add new test (it fails, of course)

* isAtomPotentialTetrahedralCenter() there and tested
tests cases for molecular stereo written (but failing, of course)
create new_chirality.cpp, we will probably want to change this at some point
new StereoInfo structure

* more infrastructure
- isBondPotentialStereoBond()
- two getStereoInfo() functions
- associated unit tests

* backup

* oops

* backup

* switch to always using four atoms for bonds

* backup

* add new test (it fails, of course)

* isAtomPotentialTetrahedralCenter() there and tested
tests cases for molecular stereo written (but failing, of course)
create new_chirality.cpp, we will probably want to change this at some point
new StereoInfo structure

* more infrastructure
- isBondPotentialStereoBond()
- two getStereoInfo() functions
- associated unit tests

* backup

* oops

* backup

* switch to always using four atoms for bonds

* backup

* this now actually works

* doc update

* add a test to demo that ring stereo is not working

* more testing

* add a fun CIP test

* add review note

* debugging

* remove extraneous debugging
turn off tests for ring-double bond stereo

* disable the ring-stereo fix... this breaks a few tests, but we will recover

* works, needs cleanup, chirality code needs re-testing

* nothing works

* Fixes #3322

* Python and C++ tests now pass

* clang-format

* first pass at python wrappers

* improve doctest

* basic optimization...
stop with the copying

* rename

* all tests passing again

* optimization

* fix the sort in the tests

* looks like this might fix the windows-dll build problems

* update tests

* the fun never ends

* comment cleanup

* handle deliberately unspecified atoms/bonds

* add cleanIt option

* add flagPossible

* add option to use the new code to the SMILES parser

* additional testing

* additional testing

* a bit of additional testing never hurts

* changes in response to review

* fixes a bug with potential parastereo not being cleared

other changes in response to review

* update docs
2020-09-02 15:00:29 +02:00

60 lines
2.6 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("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_readonly("controllingAtoms",
&Chirality::StereoInfo::controllingAtoms,
"indices of the atoms controlling the stereo");
};
};
} // namespace RDKit
void wrap_chirality() { RDKit::chirality_wrapper::wrap(); }