Return annotations as id2gos
773124
def _get_id2gos(self):
        """"""
        kws = {}
        if self.args.ev_inc is not None:
            kws['ev_include'] = set(self.args.ev_inc.split(','))
        if self.args.ev_exc is not None:
            kws['ev_exclude'] = set(self.args.ev_exc.split(','))
        return self.objanno.get_id2gos(**kws)
1308834
def initial_annotate_kwargs():
    """"""
    return dict(
        xycoords="data", textcoords="data",
        rotation=90, horizontalalignment="center", verticalalignment="center",
        arrowprops=dict(arrowstyle="-", relpos=(0.5, 0.0))
    )
761032
def _annotate_query(query, generate_dict):
    """"""
    annotate_key_list = []
    for field_name, annotate_dict in generate_dict.items():
        for annotate_name, annotate_func in annotate_dict["annotate_dict"].items():
            query = annotate_func(query)
            annotate_key_list.append(annotate_name)
    return query, annotate_key_list
936979
def get_annotations(cls, __fn):
        """"""
        if hasattr(__fn, '__func__'):
            __fn = __fn.__func__
        if hasattr(__fn, '__notes__'):
            return __fn.__notes__
        raise AttributeError('{!r} does not have annotations'.format(__fn))
1032670
def get_go2obj(self, goids):
        """"""
        go2obj = self.go2obj
        return {go:go2obj[go] for go in goids}
819730
def get_annotations(self) -> Dict:
        """"""
        return {
            EVIDENCE: self.evidence,
            CITATION: self.citation.copy(),
            ANNOTATIONS: self.annotations.copy()
        }
1006420
def _get_dbid2goids(associations):
        """"""
        id2gos = cx.defaultdict(set)
        for ntd in associations:
            id2gos[ntd.DB_ID].add(ntd.GO_ID)
        return dict(id2gos)
791078
def annotate(self, *args, **kwargs):
        
        obj = self._clone()

        for arg in args:
            if isinstance(arg, Facet):
                obj._facets.append(arg)
            elif isinstance(arg, six.string_types):
                obj._facets.append(TermFacet(arg.replace("__", ".")))
            elif isinstance(arg, Agg):
                obj._aggs.append(arg)
            elif isinstance(arg, six.string_types):
                obj._facets.append(TermFacet(arg.replace("__", ".")))
            else:
                raise NotImplementedError("invalid type")


        # Add the aggregates/facet to the query
        for name, field in kwargs.items():
            obj._facets.append(TermFacet(field=field.replace("__", "."), name=name.replace("__", ".")))
            obj._aggs.append(TermsAgg(field=field.replace("__", "."), name=name.replace("__", ".")))
        return obj
51368
def cli(ctx, feature_id, name, organism="", sequence=""):
    
    return ctx.gi.annotations.set_name(feature_id, name, organism=organism, sequence=sequence)
612814
def get_annotations(self, min_rho=None):
        '''
        
        '''
        return (a for a in self.annotations if min_rho is None or a.score > min_rho)
1001863
def _get_kwsdag(self, goids, go2obj, **kws_all):
        """"""
        kws_dag = {}
        # Term Counts for GO Term information score
        tcntobj = self._get_tcntobj(goids, go2obj, **kws_all)  # TermCounts or None
        if tcntobj is not None:
            kws_dag['tcntobj'] = tcntobj
        # GO letters specified by the user
        if 'go_aliases' in kws_all:
            fin_go_aliases = kws_all['go_aliases']
            if os.path.exists(fin_go_aliases):
                go2letter = read_d1_letter(fin_go_aliases)
                if go2letter:
                    kws_dag['go2letter'] = go2letter
        return kws_dag
1328137
def _init_go2nt_aug(self, go2nt):
        """"""
        go2obj = self.gosubdag.go2obj
        # Get alt GO IDs
        go2nt_aug = {}
        # NOW
        for goid_usr, nt_usr in go2nt.items():
            goobj = go2obj[goid_usr]
            if goobj.alt_ids:
                alts = set(goobj.alt_ids)
                alts.add(goobj.id)
                for goid_alt in alts:
                    if goid_alt not in go2nt:
                        go2nt_aug[goid_alt] = nt_usr
        # WAS
        # Add alt GO IDs to go2nt
        for goid, gont in go2nt_aug.items():
            go2nt[goid] = gont
        return go2nt
331747
def get_ids_g_goids(self, goids):
        """"""
        return set(nt.DB_ID for nt in self.associations if nt.GO_ID in goids)
296308
def annotate(results, settings):
    ''''''
    annotations = (generate_annotation(result, setting)
                   for result, setting in zip(results, settings))
    return '\n'.join(annot for annot in annotations if annot)
45264
def get_annotation(self, id_):
        """"""
        endpoint = "annotations/{id}".format(id=id_)
        return self._make_request(endpoint)
479847
def get_gene2gos(go2nt):
        """"""
        gene2gos = cx.defaultdict(set)
        nt0 = next(iter(go2nt.values()))
        b_str = isinstance(nt0.study_items, str)
        # print("NNNNTTTT", nt0)
        for goid, ntgo in go2nt.items():
            study_items = ntgo.study_items.split(', ') if b_str else ntgo.study_items
            for geneid in study_items:
                gene2gos[geneid].add(goid)
        if b_str:
          b_set = set(isinstance(g.isdigit(), int) for g in nt0.study_items.split(', '))
          if b_set == set([True]):
            return {int(g):gos for g, gos in gene2gos.items()}
        return {g:gos for g, gos in gene2gos.items()}
393026
def annotations(self, qname=True):
        
        if qname:
            return sorted([(uri2niceString(x, self.namespaces)
                            ), (uri2niceString(y, self.namespaces)), z]
                          for x, y, z in self.triples)
        else:
            return sorted(self.triples)