def testSdfMCSAlignAtomMap(self):
     """Test case -  match test with return of atom maps for foreign SDF with a CC definition"""
     self.__lfh.write(
         "\nStarting OeAlignDepictTests testSdfMCSAlignAtomMap\n")
     try:
         extPairTup = (os.path.join(self.__datadir, "ATP.sdf"),
                       os.path.join(self.__datadir, "ATP.cif"))
         refPath = extPairTup[0]
         fitId = extPairTup[1]
         fitPath = extPairTup[1]
         oed = OeDepictMCSAlign(verbose=self.__verbose, log=self.__lfh)
         # oed.setSearchType(sType='exact')
         oed.setSearchType(sType="exact")
         #
         oed.setRefPath(refPath, type="SDF")
         # oed.setFitId(fitId,cachePath=self.__topCachePath)
         oed.setFitPath(fitPath, title="ATP")
         aML = oed.testAlign(suppressHydrogens=False,
                             unique=False,
                             minFrac=0.9)
         if len(aML) > 0:
             self.__lfh.write("Match suceeded for: %s %s\n" %
                              (refPath, fitId))
             for ii, aM in enumerate(aML):
                 self.__lfh.write("Mapping: %4d %s\n" % (ii, aM))
         else:
             self.__lfh.write("Match failed for: %s %s\n" %
                              (refPath, fitId))
     except:  # noqa: E722 pylint: disable=bare-except
         traceback.print_exc(file=self.__lfh)
         self.fail()
    def testMCSAlignPairListDepict(self):
        """Test case -  List view of  pairwise MCS alignment using pair id list input"""
        self.__lfh.write(
            "\nStarting OeAlignDepictTests testMCSAlignPairListDepict\n")
        try:
            oed = OeDepictMCSAlign(verbose=self.__verbose, log=self.__lfh)
            oed.setPairIdList(self.__pairIdList, cachePath=self.__topCachePath)
            imageFile = os.path.join(self.__testoutput,
                                     "pair-list-example-mcs-alignment.pdf")
            aML = oed.alignPairList(imagePath=imageFile)
            if len(aML) > 0:
                for (rCC, rAt, tCC, tAt) in aML:
                    self.__lfh.write("%5s %-5s %5s %-5s\n" %
                                     (rCC, rAt, tCC, tAt))

        except:  # noqa: E722 pylint: disable=bare-except
            traceback.print_exc(file=self.__lfh)
            self.fail()
 def testMCSAlignAtomMap(self):
     """Test case -  match test with return of atom maps"""
     self.__lfh.write("\nStarting OeAlignDepictTests testMCSAlignAtomMap\n")
     try:
         pairIdList = self.__readPairList(fn=self.__rnaPairFile)
         oed = OeDepictMCSAlign(verbose=self.__verbose, log=self.__lfh)
         for refId, fitId in pairIdList:
             oed.setRefId(refId, cachePath=self.__topCachePath)
             oed.setFitId(fitId, cachePath=self.__topCachePath)
             aML = oed.testAlign()
             if len(aML) > 0:
                 self.__lfh.write("Match suceeded for: %s %s\n" %
                                  (refId, fitId))
             else:
                 self.__lfh.write("Match failed for: %s %s\n" %
                                  (refId, fitId))
     except:  # noqa: E722 pylint: disable=bare-except
         traceback.print_exc(file=self.__lfh)
         self.fail()
    def testMCSAlignRnaPairListDepict(self):
        """Test case -  Modified RNA nucleotide alignment with parent nucleotied using pair list input"""
        self.__lfh.write(
            "\nStarting OeAlignDepictTests testMCSAlignRnaPairListDepict\n")
        try:
            pairIdList = self.__readPairList(fn=self.__rnaPairFile)
            oed = OeDepictMCSAlign(verbose=self.__verbose, log=self.__lfh)
            oed.setPairIdList(pairIdList, cachePath=self.__topCachePath)
            imageFile = os.path.join(self.__testoutput,
                                     "rna-modified-pair-alignment.pdf")
            aML = oed.alignPairList(imagePath=imageFile)
            if len(aML) > 0:
                for (rCC, rAt, tCC, tAt) in aML:
                    self.__lfh.write("%5s %-5s %5s %-5s\n" %
                                     (rCC, rAt, tCC, tAt))

        except:  # noqa: E722 pylint: disable=bare-except
            traceback.print_exc(file=self.__lfh)
            self.fail()
 def testMCSAlignPairDepict(self):
     """Test case -  Simple pairwise MCSS alignment  -  Each aligned pair output to a separate image file"""
     self.__lfh.write(
         "\nStarting OeAlignDepictTests tstMCSalignPairDepict\n")
     try:
         oed = OeDepictMCSAlign(verbose=self.__verbose, log=self.__lfh)
         oed.setRefId(self.__refId, cachePath=self.__topCachePath)
         for fitId in self.__idList:
             oed.setFitId(fitId, cachePath=self.__topCachePath)
             fName = os.path.join(
                 self.__testoutput,
                 "ref-" + self.__refId + "-trg-" + fitId + ".png")
             aML = oed.alignPair(imagePath=fName)
             if len(aML) > 0:
                 for (rCC, rAt, tCC, tAt) in aML:
                     self.__lfh.write("%5s %-5s %5s %-5s\n" %
                                      (rCC, rAt, tCC, tAt))
     except:  # noqa: E722 pylint: disable=bare-except
         traceback.print_exc(file=self.__lfh)
         self.fail()
 def testMCSRelaxAlignPairDepict(self):
     """Test case -  Relaxed pairwise MCSS alignment  -"""
     self.__lfh.write(
         "\nStarting OeAlignDepictTests testMCSRelaceAlignPairDepict\n")
     try:
         oed = OeDepictMCSAlign(verbose=self.__verbose, log=self.__lfh)
         oed.setSearchType(sType="relaxed")
         oed.setRefPath(ccPath=os.path.join(self.__examples,
                                            "PRDCC_000225.cif"),
                        title="PRD_000225",
                        suppressHydrogens=False)
         oed.setFitPath(ccPath=os.path.join(self.__examples,
                                            "L_LDI_990_.comp.cif"),
                        title="L_LDI_990",
                        suppressHydrogens=False)
         fName = os.path.join(self.__testoutput, "relaxed-fit.png")
         aML = oed.alignPair(imagePath=fName)
         if len(aML) > 0:
             for (rCC, rAt, tCC, tAt) in aML:
                 self.__lfh.write("%5s %-5s %5s %-5s\n" %
                                  (rCC, rAt, tCC, tAt))
     except Exception as e:  # noqa: F841 pylint: disable=unused-variable
         traceback.print_exc(file=self.__lfh)
         self.fail()