Ejemplo n.º 1
0
    def child_seq_sets(self):
        """
        Return iterator of all sequence sets descended from this prep.
        """
        self.logger.debug("In child_seq_sets.")

        linkage_query = '"{}"[linkage.sequenced_from]'.format(self.id)

        from WgsRawSeqSet import WgsRawSeqSet
        from MicrobTranscriptomicsRawSeqSet import MicrobTranscriptomicsRawSeqSet
        from ViralSeqSet import ViralSeqSet

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

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

            for doc in res['results']:
                if doc['node_type'] == "wgs_raw_seq_set":
                    yield WgsRawSeqSet.load_wgsRawSeqSet(doc)
                elif doc['node_type'] == "viral_seq_set":
                    yield ViralSeqSet.load_viral_seq_set(doc)
                elif doc['node_type'] == "microb_transcriptomics_raw_seq_set":
                    yield MicrobTranscriptomicsRawSeqSet.load_microb_transcriptomics_raw_set_set(doc)

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

            if res_count < 1:
                break
Ejemplo n.º 2
0
    def viral_seq_sets(self):
        """
        Returns an iterator of all ViralSeqSet nodes connected to this object.
        """
        self.logger.debug("In viral_seq_sets().")

        linkage_query = '"{}"[linkage.computed_from]'.format(self.id)

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

        from ViralSeqSet import ViralSeqSet

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

            for doc in res['results']:
                yield ViralSeqSet.load_viral_seq_set(doc)

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

            if res_count < 1:
                break