Code Duplication    Length = 16-17 lines in 2 locations

goatools/cli/gos_get.py 1 location

@@ 68-84 (lines=17) @@
65
                prt.write("  {N} GO IDs READ: {TXT}\n".format(N=len(goids), TXT=go_file))
66
        return goids
67
68
    @staticmethod
69
    def get_goargs(go_args, prt):
70
        """Get GO IDs and colors for GO IDs from the GO ID runtime arguments."""
71
        goids = set()
72
        go2color = {}
73
        # Match on "GO ID" or "GO ID and color"
74
        re_gocolor = re.compile(r'(GO:\d{7})((?:#[0-9a-fA-F]{6})?)')
75
        for go_arg in go_args:
76
            mtch = re_gocolor.match(go_arg)
77
            if mtch:
78
                goid, color = mtch.groups()
79
                goids.add(goid)
80
                if color:
81
                    go2color[goid] = color
82
            elif prt:
83
                prt.write("WARNING: UNRECOGNIZED ARG({})".format(go_arg))
84
        return goids
85
86
# Copyright (C) 2016-2018, DV Klopfenstein, H Tang. All rights reserved.
87

goatools/cli/gosubdag_plot.py 1 location

@@ 122-137 (lines=16) @@
119
        go2obj = {go:self.go2obj[go] for go in ret['GOs']}
120
        ret['GOs'] = set(get_go2obj_unique(go2obj))
121
        return [ret['GOs'], ret['go2color']]
122
123
    def _goargs(self, ret, go_args):
124
        """Get GO IDs and colors for GO IDs from the GO ID runtime arguments."""
125
        goids = set()
126
        go2color = {}
127
        # Match on "GO ID" or "GO ID and color"
128
        re_gocolor = re.compile(r'(GO:\d{7})((?:#[0-9a-fA-F]{6})?)')
129
        for go_arg in go_args:
130
            mtch = re_gocolor.match(go_arg)
131
            if mtch:
132
                goid, color = mtch.groups()
133
                goids.add(goid)
134
                if color:
135
                    go2color[goid] = color
136
            else:
137
                print("WARNING: UNRECOGNIZED ARG({})".format(go_arg))
138
        self._update_ret(ret, goids, go2color)
139
140
    def _rdtxt_gos(self, ret, go_file):