-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix cyclic imports in goatools.go_enrichment
- Loading branch information
1 parent
fe91e7e
commit 540935f
Showing
4 changed files
with
41 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: UTF-8 -*- | ||
|
||
|
||
from collections import defaultdict | ||
|
||
|
||
def count_terms(geneset, assoc, obo_dag): | ||
"""count the number of terms in the study group | ||
""" | ||
term_cnt = defaultdict(int) | ||
for gene in (g for g in geneset if g in assoc): | ||
for x in assoc[gene]: | ||
if x in obo_dag: | ||
term_cnt[obo_dag[x].id] += 1 | ||
|
||
return term_cnt | ||
|
||
|
||
def is_ratio_different(min_ratio, study_go, study_n, pop_go, pop_n): | ||
""" | ||
check if the ratio go /n is different between the study group and | ||
the population | ||
""" | ||
if min_ratio is None: | ||
return True | ||
s = float(study_go) / study_n | ||
p = float(pop_go) / pop_n | ||
if s > p: | ||
return s / p > min_ratio | ||
return p / s > min_ratio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.5.2" | ||
__version__ = "0.5.3" |