Exemplo n.º 1
0
    def annotations(self):
        """
        Returns an iterator of all Annotation nodes connected to this
        object.
        """
        self.logger.debug("In annotations().")

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

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

        from Annotation import Annotation

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

            for doc in res['results']:
                yield Annotation.load_annotation(doc)

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

            if res_count < 1:
                break