Add hasQueryHs (#6702)

This commit is contained in:
Brian Kelley
2023-09-15 02:59:56 -04:00
committed by GitHub
parent 9249ca5cc8
commit cccee15a91
7 changed files with 155 additions and 9 deletions

View File

@@ -29,6 +29,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
%include "std_pair.i"
%{
#include <GraphMol/MolOps.h>
@@ -46,6 +47,7 @@
%ignore RDKit::MolOps::detectChemistryProblems;
%include <GraphMol/MolOps.h>
%ignore RDKit::MolOps::sanitizeMol(RWMol &,unsigned int &,unsigned int &);
%template(BoolPair) std::pair<bool, bool>;
%inline %{
int sanitizeMol(RDKit::RWMol &mol,int sanitizeOps){

View File

@@ -63,6 +63,19 @@ public class MolQueryTests extends GraphMolTest {
assertTrue(m1.hasSubstructMatch(aqmol));
assertFalse(m2.hasSubstructMatch(aqmol));
}
@Test public void testHasQueryHs() {
ROMol m2;
m2 = RWMol.MolFromSmarts("[#1]",0,false);
BoolPair res = RDKFuncs.hasQueryHs(m2);
assertTrue(res.getFirst());
assertFalse(res.getSecond());
m2 = RWMol.MolFromSmarts("[#1,C]",0,false);
res = RDKFuncs.hasQueryHs(m2);
assertTrue(res.getFirst());
assertTrue(res.getSecond());
}
public static void main(String args[]) {
org.junit.runner.JUnitCore.main("org.RDKit.BasicMoleculeTests");
}