Ejemplo n.º 1
0
    def testDefaults(self):
        """Test the default case of using only dictionary content."""
        try:
            dictApi = self.__dP.getApiByLocators(dictLocators=[self.__pathPdbxDictionaryFile])
            ok = dictApi.testCache()
            self.assertTrue(ok)
            sdi = ContentDefinition(dictApi)
            nS = sdi.getSchemaNames()
            logger.debug("schema name length %d", len(nS))
            self.assertGreaterEqual(len(nS), 600)

        except Exception as e:
            logger.exception("Failing with %s", str(e))
            self.fail()
Ejemplo n.º 2
0
    def testHelper(self):
        """Test the dictionary content supplemented by helper function"""
        try:
            cH = ContentDefinitionHelper(cfgOb=self.__cfgOb)
            dictApi = self.__dP.getApiByLocators(dictLocators=[self.__pathPdbxDictionaryFile])
            sdi = ContentDefinition(dictApi, databaseName="chem_comp", contentDefHelper=cH)
            catNameL = sdi.getCategories()
            cfD = {}
            afD = {}
            for catName in catNameL:
                cfD[catName] = sdi.getCategoryFeatures(catName)
                afD[catName] = sdi.getAttributeFeatures(catName)

            #
            logger.debug("Dictionary category name length %d", len(catNameL))
            self.assertGreaterEqual(len(catNameL), 600)

        except Exception as e:
            logger.exception("Failing with %s", str(e))
            self.fail()
 def __getContentFeatures(self):
     """Get category and attribute features"""
     try:
         cH = ContentDefinitionHelper(cfgOb=self.__cfgOb)
         dictApi = self.__dP.getApiByLocators(dictLocators=[
             self.__pathPdbxDictionaryFile, self.__pathRcsbDictionaryFile
         ])
         # logger.info("units = %r", dictApi.getUnits("pdbx_nmr_spectrometer", "manufacturer"))
         sdi = ContentDefinition(dictApi,
                                 databaseName="pdbx_core",
                                 contentDefHelper=cH)
         catNameL = sdi.getCategories()
         cfD = {}
         afD = {}
         for catName in catNameL:
             cfD[catName] = sdi.getCategoryFeatures(catName)
             afD[catName] = sdi.getAttributeFeatures(catName)
         #
         return cfD, afD
     except Exception as e:
         logger.exception("Failing with %s", str(e))
     return None, None