def prt_hier(self, prt=sys.stdout): """Write hierarchy below specfied GO IDs.""" objwr = WrHierGO(self.gosubdag, **self.kws) assert self.goids, "NO VALID GO IDs WERE PROVIDED" if 'up' not in objwr.usrset: for goid in self.goids: objwr.prt_hier_down(goid, prt) else: objwr.prt_hier_up(self.goids, prt)
def prt_hier(self, prt=sys.stdout): """Write hierarchy below specfied GO IDs.""" objwr = WrHierGO(self.gosubdag, **self.kws) assert self.goids, "NO VALID GO IDs WERE PROVIDED" if 'up' not in objwr.usrset: for goid in self.goids: objwr.prt_hier_down(goid, prt) else: objwr.prt_hier_up(self.goids, prt)
def prt_hier(self, prt=sys.stdout): """Write hierarchy below specfied GO IDs.""" objwr = WrHierGO(self.gosubdag, **self.kws) assert self.goids, "NO VALID GO IDs WERE PROVIDED" # kws = {k:v for k, v in self.kws.items() if k in self.kws_dct_wr} # objwr.write_hier_all(prt=prt, **kws) # max_indent=None, num_child=None, short_prt=False): if 'up' not in objwr.usrset: for goid in self.goids: objwr.prt_hier_down(goid, prt) else: objwr.prt_hier_up(self.goids, prt)
def write_hier_up(gosubdag, out): """Print all paths, but mark GO Terms of interest. """ mark_dct = {'GO:0000001':'a', 'GO:0000003':'b', 'GO:0000006':'c', 'GO:0000008':'d'} out.write('\nTEST MARK DICT: 01->03->06->08->09:\n') objwr = WrHierGO(gosubdag, item_marks=mark_dct, sortby=lambda o: o.item_id) gos_printed = objwr.prt_hier_up(["GO:0000005"], out) assert gos_printed == ['GO:0000001', 'GO:0000002', 'GO:0000005', 'GO:0000003', 'GO:0000005']