Ejemplo n.º 1
0
    def testDDLApi(self):
        """Test case -  DDL API linkage counts"""
        try:
            myIo = IoAdapter(raiseExceptions=True)
            containerList = myIo.readFile(
                inputFilePath=self.__pathDdlGeneratedDictionary)
            dApi = DictionaryApi(containerList=containerList,
                                 consolidate=True,
                                 expandItemLinked=True)
            cL = dApi.getCategoryList()
            logger.info("Category length %r", len(cL))
            self.assertGreaterEqual(len(cL), 63)
            cL = dApi.getFullChildList("category", "id")
            logger.info("Children of category.id (%d)", len(cL))
            self.assertGreaterEqual(len(cL), 11)
            #
            cL = dApi.getFullDescendentList("category", "id")
            logger.info("Descendents of category.id (%d)", len(cL))
            self.assertGreaterEqual(len(cL), 13)
            #
            cL = dApi.getFullChildList("item", "name")
            logger.info("Children of item.name (%d)", len(cL))
            self.assertGreaterEqual(len(cL), 36)
            cL = dApi.getFullDescendentList("item", "name")
            logger.info("Descendents of item.name (%d)", len(cL))
            self.assertGreaterEqual(len(cL), 38)
            #

            val = dApi.getDictionaryVersion()
            self.assertEqual(val, "2.2.2")
            val = dApi.getDictionaryTitle()
            self.assertEqual(val, "mmcif_ddl.dic")
            val = dApi.getDictionaryUpdate(order="reverse")
            self.assertEqual(val, "2020-06-05")
            val = dApi.getDictionaryRevisionCount()
            self.assertGreaterEqual(val, 78)
            valL = dApi.getDictionaryHistory(order="reverse")
            self.assertGreaterEqual(len(valL), 78)
            #
            val = dApi.getDictionaryComponentCount()
            self.assertGreaterEqual(val, 6)
            #
            valL = dApi.getDictionaryComponentDetails()
            self.assertGreaterEqual(len(valL), 6)

            valL = dApi.getDictionaryComponents()
            self.assertGreaterEqual(len(valL), 6)
            for dictionaryComponentId in dApi.getDictionaryComponents():
                valL = dApi.getDictionaryComponentHistory(
                    dictionaryComponentId, order="reverse")
                self.assertGreaterEqual(len(valL), 2)

            #
        except Exception as e:
            logger.exception("Failing with %s", str(e))
            self.fail()
Ejemplo n.º 2
0
    def testConsolidateDictionary(self):
        """Test case -  dump methods for dictionary metadata"""

        try:
            myIo = IoAdapter(raiseExceptions=True)
            self.__containerList = myIo.readFile(inputFilePath=self.__pathPdbxDictionary)
            dApi = DictionaryApi(containerList=self.__containerList, consolidate=True, expandItemLinked=False, verbose=self.__verbose)
            for itemName in [
                "_entity.id",
                "_entity_poly_seq.num",
                "_atom_site.label_asym_id",
                "_struct_asym.id",
                "_chem_comp.id",
                "chem_comp_atom.comp_id",
                "chem_comp_bond.comp_id",
            ]:
                categoryName = CifName.categoryPart(itemName)
                attributeName = CifName.attributePart(itemName)
                logger.debug("Full parent list for  %s : %s\n", itemName, dApi.getFullParentList(categoryName, attributeName))
                logger.debug("Full child  list for  %s : %s\n", itemName, dApi.getFullChildList(categoryName, attributeName))
                logger.debug("Ultimate parent for  %s : %s\n", itemName, dApi.getUltimateParent(categoryName, attributeName))
                logger.debug("Type code for  %s : %s\n", itemName, dApi.getTypeCode(categoryName, attributeName))
                self.assertIsNotNone(dApi.getTypeCode(categoryName, attributeName))
        except Exception as e:
            logger.exception("Failing with %s", str(e))
            self.fail()
Ejemplo n.º 3
0
    def test_consolidate_dictionary(self, api_paths):
        myIo = IoAdapter(raiseExceptions=True)
        containerList = myIo.readFile(
            inputFilePath=str(api_paths['pathPdbxDictionary']))
        dApi = DictionaryApi(containerList=containerList, consolidate=True)

        for itemName in [
                '_entity.id', '_entity_poly_seq.num',
                '_atom_site.label_asym_id', '_struct_asym.id', '_chem_comp.id',
                'chem_comp_atom.comp_id', 'chem_comp_bond.comp_id'
        ]:
            categoryName = CifName.categoryPart(itemName)
            attributeName = CifName.attributePart(itemName)
            print("Full parent list for  %s : %s\n" %
                  (itemName, dApi.getFullParentList(categoryName,
                                                    attributeName)))
            print(
                "Full child  list for  %s : %s\n" %
                (itemName, dApi.getFullChildList(categoryName, attributeName)))
            print("Ultimate parent for  %s : %s\n" %
                  (itemName, dApi.getUltimateParent(categoryName,
                                                    attributeName)))
            print("Type code for  %s : %s\n" %
                  (itemName, dApi.getTypeCode(categoryName, attributeName)))
            assert dApi.getTypeCode(categoryName, attributeName) is not None