From 8fac924710a287d5afefceef37b8367b251d508d Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Thu, 13 Jul 2023 04:43:56 -0600 Subject: [PATCH] Add MolEnumerator to C# (#6542) * Include enumerator in C# wrappers * Add MolBundle to C# and create test --- .../csharp_wrapper/GraphMolCSharp.i | 4 ++ .../RDKitCSharpTest/MolEnumeratorTest.cs | 48 +++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Code/JavaWrappers/csharp_wrapper/RDKitCSharpTest/MolEnumeratorTest.cs diff --git a/Code/JavaWrappers/csharp_wrapper/GraphMolCSharp.i b/Code/JavaWrappers/csharp_wrapper/GraphMolCSharp.i index effea3b02..3b2f80c28 100644 --- a/Code/JavaWrappers/csharp_wrapper/GraphMolCSharp.i +++ b/Code/JavaWrappers/csharp_wrapper/GraphMolCSharp.i @@ -159,6 +159,8 @@ typedef unsigned long long int uintmax_t; %shared_ptr(RDKit::QueryAtom) %shared_ptr(RDKit::QueryBond) %shared_ptr(RDKit::QueryOps) +%shared_ptr(RDKit::MolBundle) +%shared_ptr(RDKit::FixedMolSizeMolBundle) %shared_ptr(RDKit::MolSanitizeException) %shared_ptr(RDKit::AtomSanitizeException) %shared_ptr(RDKit::AtomValenceException) @@ -206,6 +208,7 @@ typedef unsigned long long int uintmax_t; %include "../QueryAtom.i" %include "../QueryBond.i" %include "../QueryOps.i" +%include "../MolBundle.i" %include "../MonomerInfo.i" %include "../PeriodicTable.i" %include "../SanitException.i" @@ -237,6 +240,7 @@ typedef unsigned long long int uintmax_t; %include "../SubstructLibrary.i" %include "../ScaffoldNetwork.i" %include "../TautomerQuery.i" +%include "../MolEnumerator.i" %include "../SubstanceGroup.i" %include "../MolHash.i" %include "../Abbreviations.i" diff --git a/Code/JavaWrappers/csharp_wrapper/RDKitCSharpTest/MolEnumeratorTest.cs b/Code/JavaWrappers/csharp_wrapper/RDKitCSharpTest/MolEnumeratorTest.cs new file mode 100644 index 000000000..877763edb --- /dev/null +++ b/Code/JavaWrappers/csharp_wrapper/RDKitCSharpTest/MolEnumeratorTest.cs @@ -0,0 +1,48 @@ +using GraphMolWrap; +using Xunit; + +namespace RdkitTests +{ + + public class MolEnumeratorTest + { + [Fact] + public void TestEnumerator() + { + var block = @" + Mrv2008 07102308312D + + 0 0 0 0 0 999 V3000 +M V30 BEGIN CTAB +M V30 COUNTS 10 8 0 0 0 +M V30 BEGIN ATOM +M V30 1 C -4.2917 4.9984 0 0 +M V30 2 C -5.6253 4.2284 0 0 +M V30 3 C -5.6253 2.6883 0 0 +M V30 4 C -4.2917 1.9183 0 0 +M V30 5 C -2.958 2.6883 0 0 +M V30 6 C -2.958 4.2284 0 0 +M V30 7 * -3.6248 4.6134 0 0 +M V30 8 Cl -3.6248 6.9234 0 0 +M V30 9 * -5.6253 3.4583 0 0 +M V30 10 Cl -7.2521 3.4583 0 0 +M V30 END ATOM +M V30 BEGIN BOND +M V30 1 1 1 2 +M V30 2 2 2 3 +M V30 3 1 3 4 +M V30 4 2 4 5 +M V30 5 1 5 6 +M V30 6 2 1 6 +M V30 7 1 7 8 ENDPTS=(2 1 6) ATTACH=ANY +M V30 8 1 9 10 ENDPTS=(2 2 3) ATTACH=ANY +M V30 END BOND +M V30 END CTAB +M END +"; + var mol = RWMol.MolFromMolBlock(block); + var bundle = RDKFuncs.enumerate(mol); + Assert.Equal(4U, bundle.size()); + } + } +} \ No newline at end of file