Exemple #1
0
 def testFetchIds(self):
     """Test individual entry fetch"""
     idList = None
     try:
         fobj = UniProtUtils(saveText=True)
         for tId in self.__unpIdList3:
             idList = [tId]
             retD, matchD = fobj.fetchList(idList,
                                           usePrimary=self.__usePrimary,
                                           retryAltApi=self.__retryAltApi)
             numPrimary, numSecondary, numNone = self.__matchSummary(matchD)
             logger.debug("%d %d %d", numPrimary, numSecondary, numNone)
             #
             rematchD = fobj.rebuildMatchResultIndex(idList, retD)
             self.assertDictEqual(matchD, rematchD)
             #
             self.assertGreaterEqual(len(retD), len(idList))
             if retD and self.__export:
                 fobj.writeUnpXml(
                     os.path.join(self.__workPath, tId + ".xml"))
                 self.__mU.doExport(os.path.join(self.__workPath,
                                                 tId + ".json"),
                                    retD,
                                    fmt="json",
                                    indent=3)
     except Exception as e:
         logger.exception("Failing with idList %r %s", idList, str(e))
         self.fail()
 def __rebuildReferenceMatchIndex(self, idList, referenceD):
     fobj = UniProtUtils()
     logger.info("Rebuilding match index on idList (%d) using reference data (%d) %r", len(idList), len(referenceD), type(referenceD))
     matchD = fobj.rebuildMatchResultIndex(idList, referenceD)
     return matchD