示例#1
0
    def derivations(self):
        """
        Return an iterator of all the derived nodes from this prep, including
        lipidomes, metabolomes, cytokines, etc...
        """
        self.logger.debug("In derivations().")

        from Cytokine import Cytokine
        from Lipidome import Lipidome
        from Metabolome import Metabolome
        from Proteome import Proteome

        for doc in self._derived_docs():
            if doc['node_type'] == "lipidome":
                yield Lipidome.load_lipidome(doc)
            elif doc['node_type'] == "metabolome":
                yield Metabolome.load_metabolome(doc)
            elif doc['node_type'] == "cytokine":
                yield Cytokine.load_cytokine(doc)
            elif doc['node_type'] == "proteome":
                yield Proteome.load_proteome(doc)
示例#2
0
    def cytokines(self):
        """
        Returns an iterator of all Cytokines connected to this HostAssayPrep.
        """
        self.logger.debug("In cytokines().")

        linkage_query = '"{}"[linkage.derived_from] and "cytokine"[node_type]'.format(self.id)

        query = iHMPSession.get_session().get_osdf().oql_query

        from Cytokine import Cytokine

        for page_no in count(1):
            res = query(HostAssayPrep.namespace, linkage_query, page=page_no)
            res_count = res['result_count']

            for doc in res['results']:
                yield Cytokine.load_cytokine(doc)

            res_count -= len(res['results'])

            if res_count < 1:
                break