@@ 137-146 (lines=10) @@ | ||
134 | """Set colors of GO terms.""" |
|
135 | goid2color = {} |
|
136 | # 1. colors based on p-value override colors based on source GO |
|
137 | if self.go2res is not None: |
|
138 | alpha2col = self.pltvars.alpha2col |
|
139 | pval_name = self.pval_name |
|
140 | for goid, res in self.go2res.items(): |
|
141 | pval = getattr(res, pval_name, None) |
|
142 | if pval is not None: |
|
143 | for alpha, color in alpha2col.items(): |
|
144 | if pval <= alpha and res.study_count != 0: |
|
145 | if goid not in goid2color: |
|
146 | goid2color[goid] = color |
|
147 | # 2. GO source color |
|
148 | color = self.pltvars.key2col['go_sources'] |
|
149 | for goid in self.godag.go_sources: |
@@ 58-66 (lines=9) @@ | ||
55 | def set_goid2color_pval(self, goid2color): |
|
56 | """Fill missing colors based on p-value of an enriched GO term.""" |
|
57 | alpha2col = self.alpha2col |
|
58 | if self.pval_name is not None: |
|
59 | pval_name = self.pval_name |
|
60 | for goid, res in self.go2res.items(): |
|
61 | pval = getattr(res, pval_name, None) |
|
62 | if pval is not None: |
|
63 | for alpha, color in alpha2col.items(): |
|
64 | if pval <= alpha and res.study_count != 0: |
|
65 | if goid not in goid2color: |
|
66 | goid2color[goid] = color |
|
67 | ||
68 | def get_goid2color_pval(self): |
|
69 | """Return a go2color dict containing GO colors determined by P-value.""" |