def matchByDescriptor(self,
                          descriptor,
                          descriptorType,
                          matchOpts="graph-relaxed",
                          searchId=None):
        """Return graph match (w/  finger print pre-filtering) and finger print search results for the
           input desriptor.

        Args:
            descriptor (str):  molecular descriptor (SMILES, InChI)
            descriptorType (str): descriptor type (SMILES, InChI
            matchOpts (str, optional): graph match criteria (graph-relaxed, graph-relaxed-stereo, graph-strict,
                                       fingerprint-similarity, Defaults to "graph-relaxed")
            searchId (str, optional): search identifier for logging. Defaults to None.

        Returns:
            (statusCode, list, list): status, graph match and finger match lists of type (MatchResults)
                                      -100 descriptor processing error
                                      -200 search execution error
                                         0 search execution success
        """
        ssL = fpL = []
        retStatus = False
        statusCode = -200
        try:
            fpTypeCuttoffD = self.__configD["oesmpKwargs"][
                "fpTypeCuttoffD"] if "fpTypeCuttoffD" in self.__configD[
                    "oesmpKwargs"] else {}
            maxFpResults = self.__configD["oesmpKwargs"][
                "maxFpResults"] if "maxFpResults" in self.__configD[
                    "oesmpKwargs"] else 50
            limitPerceptions = self.__configD["oesmpKwargs"][
                "limitPerceptions"] if "limitPerceptions" in self.__configD[
                    "oesmpKwargs"] else False
            #
            searchId = searchId if searchId else "query"
            messageTag = searchId + ":" + descriptorType
            oeioU = OeIoUtils()
            oeMol = oeioU.descriptorToMol(descriptor,
                                          descriptorType,
                                          limitPerceptions=limitPerceptions,
                                          messageTag=messageTag)
            oeMol = oeioU.suppressHydrogens(oeMol)
            if not oeMol:
                logger.warning("descriptor type %r molecule build fails: %r",
                               descriptorType, descriptor)
                return self.__statusDescriptorError, ssL, fpL
            #
            retStatus, ssL, fpL = self.__oesU.searchSubStructureAndFingerPrint(
                oeMol,
                list(fpTypeCuttoffD.items())[:2],
                maxFpResults,
                matchOpts=matchOpts)
            statusCode = 0 if retStatus else self.__searchError
        except Exception as e:
            logger.exception("Failing with %s", str(e))
            #
        return statusCode, ssL, fpL
    def subStructSearchByDescriptor(self,
                                    descriptor,
                                    descriptorType,
                                    matchOpts="sub-struct-graph-relaxed",
                                    searchId=None):
        """Return graph match (w/  finger print pre-filtering) and finger print search results for the
           input desriptor.

        Args:
            descriptor (str):  molecular descriptor (SMILES, InChI)
            descriptorType (str): descriptor type (SMILES, InChI)
            matchOpts (str, optional): graph match criteria (sub-struct-graph-relaxed, sub-struct-graph-relaxed-stereo,
                                       sub-struct-graph-strict). Defaults to "sub-struct-graph-relaxed".
            searchId (str, optional): search identifier for logging. Defaults to None.

        Returns:
            (statusCode, list, list): status, substructure search results of type (MatchResults), empty list placeholder
                                      -100 descriptor processing error
                                      -200 search execution error
                                         0 search execution success
        """
        ssL = []
        retStatus = False
        statusCode = -200
        try:
            limitPerceptions = self.__configD["oesmpKwargs"][
                "limitPerceptions"] if "limitPerceptions" in self.__configD[
                    "oesmpKwargs"] else False
            numProc = self.__configD["oesmpKwargs"][
                "numProc"] if "numProc" in self.__configD["oesmpKwargs"] else 4
            #
            searchId = searchId if searchId else "query"
            messageTag = searchId + ":" + descriptorType
            oeioU = OeIoUtils()
            oeMol = oeioU.descriptorToMol(descriptor,
                                          descriptorType,
                                          limitPerceptions=limitPerceptions,
                                          messageTag=messageTag)
            oeMol = oeioU.suppressHydrogens(oeMol)
            if not oeMol:
                logger.warning("descriptor type %r molecule build fails: %r",
                               descriptorType, descriptor)
                return self.__statusDescriptorError, ssL, []
            #
            ccIdL = self.__oesubsU.prefilterIndex(oeMol,
                                                  self.__siIdxP,
                                                  matchOpts=matchOpts)
            retStatus, ssL = self.__oesubsU.searchSubStructure(
                oeMol, ccIdList=ccIdL, matchOpts=matchOpts, numProc=numProc)
            statusCode = 0 if retStatus else self.__searchError
        except Exception as e:
            logger.exception("Failing with %s", str(e))
            #
        return statusCode, ssL, []
 def __getMol(self,
              query,
              queryType,
              queryId,
              limitPerceptions=False,
              suppressHydrogens=True):
     oeioU = OeIoUtils()
     if queryType == "CC":
         oeMol = self.__oesmP.getMol(query)
     else:
         oeMol = oeioU.descriptorToMol(query,
                                       queryType,
                                       limitPerceptions=limitPerceptions,
                                       messageTag=queryId)
     #
     if suppressHydrogens:
         oeMol = oeioU.suppressHydrogens(oeMol)
     oeMol.SetTitle(queryId)
     return oeMol