Skip to content

Commit

Permalink
Add test_godag_ecs() per #292 (#293)
Browse files Browse the repository at this point in the history
* Add test_godag_ecs() per #292

* upgrade versions in build.yml

* Add test_get_godag.py in test list
  • Loading branch information
tanghaibao committed May 5, 2024
1 parent f21c24c commit 795fb27
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 52 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
strategy:
max-parallel: 4
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.7", "3.10"]
os: [ubuntu-latest, macos-13]
python-version: ["3.8", "3.10"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
88 changes: 44 additions & 44 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ dnld_anno_uniprot:
# tests/test_nbt3102.py \
# tests/test_optional_fields.py \
# tests/test_dnlds.py \
# tests/test_get_godag.py \
# tests/test_gpad_dnld.py \
#
# tests/test_plot_get_parents.py \
Expand All @@ -347,50 +346,51 @@ dnld_anno_uniprot:
# tests/test_quickgo_xml.py \
NOSETESTS := \
tests/test_study_zero.py \
tests/test_annotations_gaf.py::test_gaf_read_fb \
tests/test_parents_ancestors.py \
tests/test_rpt_gene2go_evidencecodes.py \
tests/test_sorter_sections.py \
tests/test_sorter_desc2nts.py \
tests/test_compare_gos.py \
tests/test_wr_sections_txt.py \
tests/test_altid_gosubdag.py \
tests/test_dcnt_r01.py \
tests/test_grprobj.py \
tests/test_grpr_get_sections_2d.py \
tests/test_sorter.py \
tests/test_gosubdag_relationships.py \
tests/test_go_depth1.py \
tests/test_i92_relationship_parentchild.py \
tests/test_i96_goea_ncbi.py \
tests/test_gosearch_emptydict.py \
tests/test_david_nts.py \
tests/test_get_parents.py \
tests/test_get_children.py \
tests/test_optional_attributes.py \
tests/test_genes_cell_cycle.py \
tests/test_semantic_similarity.py \
tests/test_goea_errors.py \
tests/test_ncbi_entrez_annotations.py \
tests/test_wr_tbl_subset.py \
tests/test_goea_local.py \
tests/test_write_hier.py \
tests/test_altid_godag.py \
tests/test_altid_gosubdag.py \
tests/test_annotations_gaf.py::test_gaf_read_fb \
tests/test_cli_write_hierarchy.py \
tests/test_go_print.py \
tests/test_read_gaf_allow_nd.py \
tests/test_write_summary_cnts.py \
tests/test_pvalcalc.py \
tests/test_altid_godag.py \
tests/test_combine_nt_lists.py \
tests/test_get_paths.py \
tests/test_get_unique_fields.py \
tests/test_go_draw.py \
tests/test_goea_statsmodels.py \
tests/test_goea_rpt_bonferroni.py \
tests/test_wr_py_goea_results.py \
tests/test_mapslim.py \
tests/test_multiple_testing.py
tests/test_combine_nt_lists.py \
tests/test_compare_gos.py \
tests/test_david_nts.py \
tests/test_dcnt_r01.py \
tests/test_genes_cell_cycle.py \
tests/test_get_children.py \
tests/test_get_godag.py \
tests/test_get_parents.py \
tests/test_get_paths.py \
tests/test_get_unique_fields.py \
tests/test_go_depth1.py \
tests/test_go_draw.py \
tests/test_go_print.py \
tests/test_goea_errors.py \
tests/test_goea_local.py \
tests/test_goea_rpt_bonferroni.py \
tests/test_goea_statsmodels.py \
tests/test_gosearch_emptydict.py \
tests/test_gosubdag_relationships.py \
tests/test_grpr_get_sections_2d.py \
tests/test_grprobj.py \
tests/test_i92_relationship_parentchild.py \
tests/test_i96_goea_ncbi.py \
tests/test_mapslim.py \
tests/test_multiple_testing.py \
tests/test_ncbi_entrez_annotations.py \
tests/test_optional_attributes.py \
tests/test_parents_ancestors.py \
tests/test_pvalcalc.py \
tests/test_read_gaf_allow_nd.py \
tests/test_rpt_gene2go_evidencecodes.py \
tests/test_semantic_similarity.py \
tests/test_sorter_desc2nts.py \
tests/test_sorter_sections.py \
tests/test_sorter.py \
tests/test_study_zero.py \
tests/test_wr_py_goea_results.py \
tests/test_wr_sections_txt.py \
tests/test_wr_tbl_subset.py \
tests/test_write_hier.py \
tests/test_write_summary_cnts.py

# Run all tests. If you are submitting a pull request, all tests must pass.
update:
Expand Down
23 changes: 19 additions & 4 deletions tests/test_get_godag.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,29 @@
import sys
from goatools.base import get_godag


def test_godag(prt=sys.stdout):
"""Test downloading GO DAG."""
"""
Test downloading GO DAG.
"""
cwd = os.getcwd()
for fin_obo in ['go-basic.obo', 'goslim_generic.obo']:
for fin_obo in ["go-basic.obo", "goslim_generic.obo"]:
fin_full = os.path.join(cwd, fin_obo)
os.system("rm -f {OBO}".format(OBO=fin_obo))
godag = get_godag(fin_full, prt, loading_bar=None) # Get GODag object
godag = get_godag(fin_full, prt, loading_bar=None) # Get GODag object
assert godag, "GO-DAG({OBO}) NOT PROPERLY LOADED".format(OBO=fin_obo)

if __name__ == '__main__':

def test_godag_ecs():
"""
Test downloading GO DAG and extract ECs.
"""
godag = get_godag("go-basic.obo", optional_attrs="xref")
go = godag["GO:0000010"]
ecs = [x for x in go.xref if x.startswith("EC:")]
assert "EC:2.5.1.30" in ecs


if __name__ == "__main__":
test_godag()
test_godag_ecs()

0 comments on commit 795fb27

Please sign in to comment.