File: rdMolStandardize.cpp

package info (click to toggle)
rdkit 202503.1-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 220,160 kB
  • sloc: cpp: 399,240; python: 77,453; ansic: 25,517; java: 8,173; javascript: 4,005; sql: 2,389; yacc: 1,565; lex: 1,263; cs: 1,081; makefile: 578; xml: 229; fortran: 183; sh: 105
file content (672 lines) | stat: -rw-r--r-- 30,467 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
//
//  Copyright (C) 2018-2023 Susan H. Leung and other RDKit contributors
//
//   @@ 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/Wrap.h>

#include <GraphMol/RDKitBase.h>
#include <GraphMol/MolStandardize/MolStandardize.h>

#include <vector>

namespace python = boost::python;

namespace {
template <typename FUNCTYPE>
RDKit::ROMol *msHelper(const RDKit::ROMol *mol, python::object params,
                       FUNCTYPE func) {
  if (!mol) {
    throw_value_error("Molecule is None");
  }
  const RDKit::MolStandardize::CleanupParameters *ps =
      &RDKit::MolStandardize::defaultCleanupParameters;
  if (params) {
    ps = python::extract<RDKit::MolStandardize::CleanupParameters *>(params);
  }
  return static_cast<RDKit::ROMol *>(
      func(static_cast<const RDKit::RWMol *>(mol), *ps));
}

RDKit::ROMol *cleanupHelper(const RDKit::ROMol *mol, python::object params) {
  return msHelper(
      mol, params,
      static_cast<
          RDKit::RWMol *(*)(const RDKit::RWMol *,
                            const RDKit::MolStandardize::CleanupParameters &)>(
          RDKit::MolStandardize::cleanup));
}

RDKit::ROMol *normalizeHelper(const RDKit::ROMol *mol, python::object params) {
  return msHelper(mol, params, RDKit::MolStandardize::normalize);
}

RDKit::ROMol *reionizeHelper(const RDKit::ROMol *mol, python::object params) {
  return msHelper(mol, params, RDKit::MolStandardize::reionize);
}

RDKit::ROMol *removeFragsHelper(const RDKit::ROMol *mol,
                                python::object params) {
  return msHelper(mol, params, RDKit::MolStandardize::removeFragments);
}

RDKit::ROMol *canonicalTautomerHelper(const RDKit::ROMol *mol,
                                      python::object params) {
  return msHelper(mol, params, RDKit::MolStandardize::canonicalTautomer);
}

template <typename FUNCTYPE>
void inPlaceHelper(RDKit::ROMol *mol, python::object params, FUNCTYPE func) {
  if (!mol) {
    throw_value_error("Molecule is None");
  }
  const RDKit::MolStandardize::CleanupParameters *ps =
      &RDKit::MolStandardize::defaultCleanupParameters;
  if (params) {
    ps = python::extract<RDKit::MolStandardize::CleanupParameters *>(params);
  }
  func(*static_cast<RDKit::RWMol *>(mol), *ps);
}

template <typename FUNCTYPE>
void inPlaceHelper2(RDKit::ROMol *mol, python::object params,
                    bool skip_standardize, FUNCTYPE func) {
  if (!mol) {
    throw_value_error("Molecule is None");
  }
  const RDKit::MolStandardize::CleanupParameters *ps =
      &RDKit::MolStandardize::defaultCleanupParameters;
  if (params) {
    ps = python::extract<RDKit::MolStandardize::CleanupParameters *>(params);
  }
  func(*static_cast<RDKit::RWMol *>(mol), *ps, skip_standardize);
}
void cleanupInPlaceHelper(RDKit::ROMol *mol, python::object params) {
  inPlaceHelper(
      mol, params,
      static_cast<void (*)(RDKit::RWMol &,
                           const RDKit::MolStandardize::CleanupParameters &)>(
          RDKit::MolStandardize::cleanupInPlace));
}

void normalizeInPlaceHelper(RDKit::ROMol *mol, python::object params) {
  inPlaceHelper(
      mol, params,
      static_cast<void (*)(RDKit::RWMol &,
                           const RDKit::MolStandardize::CleanupParameters &)>(
          RDKit::MolStandardize::normalizeInPlace));
}

void reionizeInPlaceHelper(RDKit::ROMol *mol, python::object params) {
  inPlaceHelper(
      mol, params,
      static_cast<void (*)(RDKit::RWMol &,
                           const RDKit::MolStandardize::CleanupParameters &)>(
          RDKit::MolStandardize::reionizeInPlace));
}

void removeFragmentsInPlaceHelper(RDKit::ROMol *mol, python::object params) {
  inPlaceHelper(
      mol, params,
      static_cast<void (*)(RDKit::RWMol &,
                           const RDKit::MolStandardize::CleanupParameters &)>(
          RDKit::MolStandardize::removeFragmentsInPlace));
}

void fragmentParentInPlaceHelper(RDKit::ROMol *mol, python::object params,
                                 bool skip_standardize) {
  inPlaceHelper2(
      mol, params, skip_standardize,
      static_cast<void (*)(
          RDKit::RWMol &, const RDKit::MolStandardize::CleanupParameters &,
          bool)>(RDKit::MolStandardize::fragmentParentInPlace));
}

void stereoParentInPlaceHelper(RDKit::ROMol *mol, python::object params,
                               bool skip_standardize) {
  inPlaceHelper2(
      mol, params, skip_standardize,
      static_cast<void (*)(RDKit::RWMol &,
                           const RDKit::MolStandardize::CleanupParameters &,
                           bool)>(RDKit::MolStandardize::stereoParentInPlace));
}

void isotopeParentInPlaceHelper(RDKit::ROMol *mol, python::object params,
                                bool skip_standardize) {
  inPlaceHelper2(
      mol, params, skip_standardize,
      static_cast<void (*)(RDKit::RWMol &,
                           const RDKit::MolStandardize::CleanupParameters &,
                           bool)>(RDKit::MolStandardize::isotopeParentInPlace));
}

void chargeParentInPlaceHelper(RDKit::ROMol *mol, python::object params,
                               bool skip_standardize) {
  inPlaceHelper2(
      mol, params, skip_standardize,
      static_cast<void (*)(RDKit::RWMol &,
                           const RDKit::MolStandardize::CleanupParameters &,
                           bool)>(RDKit::MolStandardize::chargeParentInPlace));
}

void superParentInPlaceHelper(RDKit::ROMol *mol, python::object params,
                              bool skip_standardize) {
  inPlaceHelper2(
      mol, params, skip_standardize,
      static_cast<void (*)(RDKit::RWMol &,
                           const RDKit::MolStandardize::CleanupParameters &,
                           bool)>(RDKit::MolStandardize::superParentInPlace));
}

void tautomerParentInPlaceHelper(RDKit::ROMol *mol, python::object params,
                                 bool skip_standardize) {
  inPlaceHelper2(
      mol, params, skip_standardize,
      static_cast<void (*)(
          RDKit::RWMol &, const RDKit::MolStandardize::CleanupParameters &,
          bool)>(RDKit::MolStandardize::tautomerParentInPlace));
}

template <typename FUNCTYPE>
void mtinPlaceHelper(python::object pymols, int numThreads,
                     python::object params, FUNCTYPE func) {
  const RDKit::MolStandardize::CleanupParameters *ps =
      &RDKit::MolStandardize::defaultCleanupParameters;
  if (params) {
    ps = python::extract<RDKit::MolStandardize::CleanupParameters *>(params);
  }
  unsigned int nmols = python::extract<unsigned int>(pymols.attr("__len__")());
  std::vector<RDKit::RWMol *> mols(nmols);
  for (auto i = 0u; i < nmols; ++i) {
    auto mol = static_cast<RDKit::RWMol *>(
        python::extract<RDKit::ROMol *>(pymols[i])());
    mols[i] = mol;
  }
  {
    NOGIL gil;
    func(mols, numThreads, *ps);
  }
}
template <typename FUNCTYPE>
void mtinPlaceHelper2(python::object pymols, int numThreads,
                      python::object params, bool skip_standardize,
                      FUNCTYPE func) {
  const auto *ps = &RDKit::MolStandardize::defaultCleanupParameters;
  if (params) {
    ps = python::extract<RDKit::MolStandardize::CleanupParameters *>(params);
  }
  unsigned int nmols = python::extract<unsigned int>(pymols.attr("__len__")());
  std::vector<RDKit::RWMol *> mols(nmols);
  for (auto i = 0u; i < nmols; ++i) {
    auto mol = static_cast<RDKit::RWMol *>(
        python::extract<RDKit::ROMol *>(pymols[i])());
    mols[i] = mol;
  }
  {
    NOGIL gil;
    func(mols, numThreads, *ps, skip_standardize);
  }
}

void mtcleanupInPlaceHelper(python::object mols, int numThreads,
                            python::object params) {
  mtinPlaceHelper(
      mols, numThreads, params,
      static_cast<void (*)(std::vector<RDKit::RWMol *> &, int,
                           const RDKit::MolStandardize::CleanupParameters &)>(
          RDKit::MolStandardize::cleanupInPlace));
}

void mtnormalizeInPlaceHelper(python::object mols, int numThreads,
                              python::object params) {
  mtinPlaceHelper(
      mols, numThreads, params,
      static_cast<void (*)(std::vector<RDKit::RWMol *> &, int,
                           const RDKit::MolStandardize::CleanupParameters &)>(
          RDKit::MolStandardize::normalizeInPlace));
}

void mtreionizeInPlaceHelper(python::object mols, int numThreads,
                             python::object params) {
  mtinPlaceHelper(
      mols, numThreads, params,
      static_cast<void (*)(std::vector<RDKit::RWMol *> &, int,
                           const RDKit::MolStandardize::CleanupParameters &)>(
          RDKit::MolStandardize::reionizeInPlace));
}

void mtremoveFragmentsInPlaceHelper(python::object mols, int numThreads,
                                    python::object params) {
  mtinPlaceHelper(
      mols, numThreads, params,
      static_cast<void (*)(std::vector<RDKit::RWMol *> &, int,
                           const RDKit::MolStandardize::CleanupParameters &)>(
          RDKit::MolStandardize::removeFragmentsInPlace));
}

void mtfragmentParentInPlaceHelper(python::object mols, int numThreads,
                                   python::object params,
                                   bool skip_standardize) {
  mtinPlaceHelper2(mols, numThreads, params, skip_standardize,
                   static_cast<void (*)(
                       std::vector<RDKit::RWMol *> &, int,
                       const RDKit::MolStandardize::CleanupParameters &, bool)>(
                       RDKit::MolStandardize::fragmentParentInPlace));
}

void mtstereoParentInPlaceHelper(python::object mols, int numThreads,
                                 python::object params, bool skip_standardize) {
  mtinPlaceHelper2(
      mols, numThreads, params, skip_standardize,
      static_cast<void (*)(std::vector<RDKit::RWMol *> &, int,
                           const RDKit::MolStandardize::CleanupParameters &,
                           bool)>(RDKit::MolStandardize::stereoParentInPlace));
}

void mtisotopeParentInPlaceHelper(python::object mols, int numThreads,
                                  python::object params,
                                  bool skip_standardize) {
  mtinPlaceHelper2(
      mols, numThreads, params, skip_standardize,
      static_cast<void (*)(std::vector<RDKit::RWMol *> &, int,
                           const RDKit::MolStandardize::CleanupParameters &,
                           bool)>(RDKit::MolStandardize::isotopeParentInPlace));
}

void mtchargeParentInPlaceHelper(python::object mols, int numThreads,
                                 python::object params, bool skip_standardize) {
  mtinPlaceHelper2(
      mols, numThreads, params, skip_standardize,
      static_cast<void (*)(std::vector<RDKit::RWMol *> &, int,
                           const RDKit::MolStandardize::CleanupParameters &,
                           bool)>(RDKit::MolStandardize::chargeParentInPlace));
}

void mtsuperParentInPlaceHelper(python::object mols, int numThreads,
                                python::object params, bool skip_standardize) {
  mtinPlaceHelper2(
      mols, numThreads, params, skip_standardize,
      static_cast<void (*)(std::vector<RDKit::RWMol *> &, int,
                           const RDKit::MolStandardize::CleanupParameters &,
                           bool)>(RDKit::MolStandardize::superParentInPlace));
}

void mttautomerParentInPlaceHelper(python::object mols, int numThreads,
                                   python::object params,
                                   bool skip_standardize) {
  mtinPlaceHelper2(mols, numThreads, params, skip_standardize,
                   static_cast<void (*)(
                       std::vector<RDKit::RWMol *> &, int,
                       const RDKit::MolStandardize::CleanupParameters &, bool)>(
                       RDKit::MolStandardize::tautomerParentInPlace));
}

template <typename FUNCTYPE>
RDKit::ROMol *parentHelper(const RDKit::ROMol *mol, python::object params,
                           bool skip_standardize, FUNCTYPE func) {
  if (!mol) {
    throw_value_error("Molecule is None");
  }
  const RDKit::MolStandardize::CleanupParameters *ps =
      &RDKit::MolStandardize::defaultCleanupParameters;
  if (params) {
    ps = python::extract<RDKit::MolStandardize::CleanupParameters *>(params);
  }
  return static_cast<RDKit::ROMol *>(
      func(static_cast<const RDKit::RWMol &>(*mol), *ps, skip_standardize));
}

RDKit::ROMol *tautomerParentHelper(const RDKit::ROMol *mol,
                                   python::object params,
                                   bool skip_standardize) {
  return parentHelper(mol, params, skip_standardize,
                      RDKit::MolStandardize::tautomerParent);
}
RDKit::ROMol *fragmentParentHelper(const RDKit::ROMol *mol,
                                   python::object params,
                                   bool skip_standardize) {
  return parentHelper(mol, params, skip_standardize,
                      RDKit::MolStandardize::fragmentParent);
}
RDKit::ROMol *stereoParentHelper(const RDKit::ROMol *mol, python::object params,
                                 bool skip_standardize) {
  return parentHelper(mol, params, skip_standardize,
                      RDKit::MolStandardize::stereoParent);
}
RDKit::ROMol *isotopeParentHelper(const RDKit::ROMol *mol,
                                  python::object params,
                                  bool skip_standardize) {
  return parentHelper(mol, params, skip_standardize,
                      RDKit::MolStandardize::isotopeParent);
}
RDKit::ROMol *chargeParentHelper(const RDKit::ROMol *mol, python::object params,
                                 bool skip_standardize) {
  return parentHelper(mol, params, skip_standardize,
                      RDKit::MolStandardize::chargeParent);
}
RDKit::ROMol *superParentHelper(const RDKit::ROMol *mol, python::object params,
                                bool skip_standardize) {
  return parentHelper(mol, params, skip_standardize,
                      RDKit::MolStandardize::superParent);
}
RDKit::ROMol *disconnectOrganometallicsHelper(RDKit::ROMol &mol,
                                              python::object params) {
  if (params) {
    RDKit::MolStandardize::MetalDisconnectorOptions *mdo =
        python::extract<RDKit::MolStandardize::MetalDisconnectorOptions *>(
            params);
    return RDKit::MolStandardize::disconnectOrganometallics(mol, *mdo);
  } else {
    return RDKit::MolStandardize::disconnectOrganometallics(mol);
  }
}
void disconnectOrganometallicsInPlaceHelper(RDKit::ROMol *mol,
                                            python::object params) {
  if (params) {
    RDKit::MolStandardize::MetalDisconnectorOptions *mdo =
        python::extract<RDKit::MolStandardize::MetalDisconnectorOptions *>(
            params);
    return RDKit::MolStandardize::disconnectOrganometallicsInPlace(
        *static_cast<RDKit::RWMol *>(mol), *mdo);
  } else {
    return RDKit::MolStandardize::disconnectOrganometallicsInPlace(
        *static_cast<RDKit::RWMol *>(mol));
  }
}

}  // namespace

void wrap_validate();
void wrap_charge();
void wrap_metal();
void wrap_fragment();
void wrap_normalize();
void wrap_tautomer();
void wrap_pipeline();

BOOST_PYTHON_MODULE(rdMolStandardize) {
  python::scope().attr("__doc__") =
      "Module containing functions for molecular standardization";

  bool noproxy = true;
  RegisterVectorConverter<RDKit::ROMOL_SPTR>("MOL_SPTR_VECT", noproxy);

  std::string docString = "";

  python::class_<RDKit::MolStandardize::CleanupParameters, boost::noncopyable>(
      "CleanupParameters", "Parameters controlling molecular standardization")
      .def_readwrite("normalizationsFile",
                     &RDKit::MolStandardize::CleanupParameters::normalizations,
                     "file containing the normalization transformations")
      .def_readwrite("acidbaseFile",
                     &RDKit::MolStandardize::CleanupParameters::acidbaseFile,
                     "file containing the acid and base definitions")
      .def_readwrite("fragmentFile",
                     &RDKit::MolStandardize::CleanupParameters::fragmentFile,
                     "file containing the acid and base definitions")
      .def_readwrite(
          "tautomerTransformsFile",
          &RDKit::MolStandardize::CleanupParameters::tautomerTransforms,
          "file containing the tautomer transformations")
      .def_readwrite("maxRestarts",
                     &RDKit::MolStandardize::CleanupParameters::maxRestarts,
                     "maximum number of restarts")
      .def_readwrite("preferOrganic",
                     &RDKit::MolStandardize::CleanupParameters::preferOrganic,
                     "prefer organic fragments to inorganic ones when deciding "
                     "what to keep")
      .def_readwrite("doCanonical",
                     &RDKit::MolStandardize::CleanupParameters::doCanonical,
                     "apply atom-order dependent normalizations (like "
                     "uncharging) in a canonical order")
      .def_readwrite("maxTautomers",
                     &RDKit::MolStandardize::CleanupParameters::maxTautomers,
                     "maximum number of tautomers to generate (defaults to "
                     "1000)")
      .def_readwrite("maxTransforms",
                     &RDKit::MolStandardize::CleanupParameters::maxTransforms,
                     "maximum number of transforms to apply during tautomer "
                     "enumeration (defaults to 1000)")
      .def_readwrite(
          "tautomerRemoveSp3Stereo",
          &RDKit::MolStandardize::CleanupParameters::tautomerRemoveSp3Stereo,
          "remove stereochemistry from sp3 centers involved in "
          "tautomerism (defaults to True)")
      .def_readwrite(
          "tautomerRemoveBondStereo",
          &RDKit::MolStandardize::CleanupParameters::tautomerRemoveBondStereo,
          "remove stereochemistry from double bonds involved in "
          "tautomerism (defaults to True)")
      .def_readwrite(
          "tautomerRemoveIsotopicHs",
          &RDKit::MolStandardize::CleanupParameters::tautomerRemoveIsotopicHs,
          "remove isotopic Hs from centers involved in "
          "tautomerism (defaults to True)")
      .def_readwrite(
          "tautomerReassignStereo",
          &RDKit::MolStandardize::CleanupParameters::tautomerReassignStereo,
          "call AssignStereochemistry on all generated tautomers "
          "(defaults to True)")
      .def_readwrite("largestFragmentChooserUseAtomCount",
                     &RDKit::MolStandardize::CleanupParameters::
                         largestFragmentChooserUseAtomCount,
                     "Whether LargestFragmentChooser should use atom "
                     "count as main criterion before MW (defaults to True)")
      .def_readwrite("largestFragmentChooserCountHeavyAtomsOnly",
                     &RDKit::MolStandardize::CleanupParameters::
                         largestFragmentChooserCountHeavyAtomsOnly,
                     "whether LargestFragmentChooser should only count "
                     "heavy atoms (defaults to False)");

  python::def("UpdateParamsFromJSON",
              &RDKit::MolStandardize::updateCleanupParamsFromJSON,
              python::args("params", "json"),
              "updates the cleanup parameters from the provided JSON string");

  docString = "Standardizes a molecule";
  python::def("Cleanup", cleanupHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString = "Standardizes a molecule in place";
  python::def("CleanupInPlace", cleanupInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str());
  docString = "Standardizes multiple molecules in place";
  python::def("CleanupInPlace", mtcleanupInPlaceHelper,
              (python::arg("mols"), python::arg("numThreads"),
               python::arg("params") = python::object()),
              docString.c_str());
  docString = "Convenience function for standardizing a SMILES";
  python::def("StandardizeSmiles", RDKit::MolStandardize::standardizeSmiles,
              (python::arg("smiles")), docString.c_str());
  docString =
      "Returns the tautomer parent of a given molecule. The fragment parent is "
      "the standardized canonical tautomer of the molecule";
  python::def("TautomerParent", tautomerParentHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString = "Generates the tautomer parent in place";
  python::def("TautomerParentInPlace", tautomerParentInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());
  docString = "Generates the tautomer parent in place for multiple molecules";
  python::def("TautomerParentInPlace", mttautomerParentInPlaceHelper,
              (python::arg("mols"), python::arg("numThreads"),
               python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());

  docString = "Returns the largest fragment after doing a cleanup";
  python::def("FragmentParent", fragmentParentHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString = "Generates the largest fragment in place";
  python::def("FragmentParentInPlace", fragmentParentInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());
  docString = "Generates the largest fragment in place for multiple molecules";
  python::def("FragmentParentInPlace", mtfragmentParentInPlaceHelper,
              (python::arg("mols"), python::arg("numThreads"),
               python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());

  python::def("StereoParent", stereoParentHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString = "Generates the stereo parent in place";
  python::def("StereoParentInPlace", stereoParentInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());
  docString = "Generates the stereo parent in place for multiple molecules";
  python::def("StereoParentInPlace", mtstereoParentInPlaceHelper,
              (python::arg("mols"), python::arg("numThreads"),
               python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());
  docString = "removes all isotopes specifications from the given molecule";
  python::def("IsotopeParent", isotopeParentHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString = "Generates the isotope parent in place";
  python::def("IsotopeParentInPlace", isotopeParentInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());
  docString = "Generates the isotope parent in place for multiple molecules";
  python::def("IsotopeParentInPlace", mtisotopeParentInPlaceHelper,
              (python::arg("mols"), python::arg("numThreads"),
               python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());
  docString = "Returns the uncharged version of the largest fragment";
  python::def("ChargeParent", chargeParentHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString = "Generates the charge parent in place";
  python::def("ChargeParentInPlace", chargeParentInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());
  docString = "Generates the chargeparent in place for multiple molecules";
  python::def("ChargeParentInPlace", mtchargeParentInPlaceHelper,
              (python::arg("mols"), python::arg("numThreads"),
               python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());

  docString =
      "Returns the super parent. The super parent is the fragment, charge, "
      "isotope, stereo, and tautomer parent of the molecule.";
  python::def("SuperParent", superParentHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString = "Generates the super parent in place";
  python::def("SuperParentInPlace", superParentInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());
  docString = "Generates the super parent in place for multiple molecules";
  python::def("SuperParentInPlace", mtsuperParentInPlaceHelper,
              (python::arg("mols"), python::arg("numThreads"),
               python::arg("params") = python::object(),
               python::arg("skipStandardize") = false),
              docString.c_str());

  docString =
      "Applies a series of standard transformations to correct functional "
      "groups and recombine charges";
  python::def("Normalize", normalizeHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString =
      "Applies a series of standard transformations to correct functional "
      "groups and recombine charges, modifies the input molecule";
  python::def("NormalizeInPlace", normalizeInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str());
  docString = "Normalizes multiple molecules in place";
  python::def("NormalizeInPlace", mtnormalizeInPlaceHelper,
              (python::arg("mols"), python::arg("numThreads"),
               python::arg("params") = python::object()),
              docString.c_str());
  docString = "Ensures the strongest acid groups are charged first";
  python::def("Reionize", reionizeHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString =
      "Ensures the strongest acid groups are charged first, modifies the input molecule";
  python::def("ReionizeInPlace", reionizeInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str());
  docString = "Reionizes multiple molecules in place";
  python::def("ReionizeInPlace", mtreionizeInPlaceHelper,
              (python::arg("mols"), python::arg("numThreads"),
               python::arg("params") = python::object()),
              docString.c_str());
  docString = "Removes fragments from the molecule";
  python::def("RemoveFragments", removeFragsHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString =
      "Removes fragments from the molecule, modifies the input molecule";
  python::def("RemoveFragmentsInPlace", removeFragmentsInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str());
  docString = "Removes fragments from multiple molecules in place";
  python::def("RemoveFragmentsInPlace", mtremoveFragmentsInPlaceHelper,
              (python::arg("mols"), python::arg("numThreads"),
               python::arg("params") = python::object()),
              docString.c_str());
  docString = "Returns the canonical tautomer for the molecule";
  python::def("CanonicalTautomer", canonicalTautomerHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());

  docString =
      "Returns the molecule disconnected using the organometallics"
      " rules.";
  python::def("DisconnectOrganometallics", disconnectOrganometallicsHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str(),
              python::return_value_policy<python::manage_new_object>());
  docString =
      "Disconnects the molecule using the organometallics"
      " rules, modifies the input molecule";
  python::def("DisconnectOrganometallicsInPlace",
              disconnectOrganometallicsInPlaceHelper,
              (python::arg("mol"), python::arg("params") = python::object()),
              docString.c_str());

  wrap_validate();
  wrap_charge();
  wrap_metal();
  wrap_fragment();
  wrap_normalize();
  wrap_tautomer();
  wrap_pipeline();
}