Skip to content

Commit

Permalink
If specifiying multiple top GO IDs, print in same order in report.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvklopfenstein committed Jul 19, 2018
1 parent 350ae8f commit 4c6d1ea
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions goatools/cli/wr_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from goatools.cli.gos_get import GetGOs
from goatools.gosubdag.gosubdag import GoSubDag
from goatools.gosubdag.rpt.write_hierarchy import WrHierGO
from goatools.godag.consts import Consts


def cli():
Expand Down Expand Up @@ -82,9 +83,20 @@ def __init__(self, args=None, prt=sys.stdout):
self._adj_for_assc()

def _init_goids(self):
goids = GetGOs().get_goids(self.kws.get('GO'), self.kws.get('i'), sys.stdout)
if goids:
return goids
goids_ret = []
godagconsts = Consts()
for goid in self.kws['GO']:
if goid[:3] == "GO:":
assert len(goid) == 10, "BAD GO ID({GO})".format(GO=goid)
goids_ret.append(goid)
elif goid in godagconsts.NS2GO:
goids_ret.append(godagconsts.NS2GO[goid])
if 'i' in self.kws:
goids_fin = GetGOs().rdtxt_gos(self.kws['i'], sys.stdout)
if goids_fin:
goids_ret.extend(list(goids_fin))
if goids_ret:
return goids_ret
# If GO DAG is small, print hierarchy for the entire DAG
if len(self.gosubdag.go2nt) < 100:
return set(self.gosubdag.go2nt.keys())
Expand Down

0 comments on commit 4c6d1ea

Please sign in to comment.