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)
def metabolomes(self): """ Returns an iterator of all Metabolomes connected to this HostAssayPrep. """ self.logger.debug("In metabolomes().") linkage_query = '"{}"[linkage.derived_from] and "metabolome"[node_type]'.format(self.id) query = iHMPSession.get_session().get_osdf().oql_query from Metabolome import Metabolome 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 Metabolome.load_metabolome(doc) res_count -= len(res['results']) if res_count < 1: break