Skip to content

Commit

Permalink
pylint. re-run travis.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvklopfenstein committed Oct 13, 2018
1 parent 329dadb commit 4f138cc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion goatools/go_enrichment.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def prt_tsv(self, prt, goea_results, **kws):
"""Write tab-separated table data"""
prt_flds = kws.get('prt_flds', self.get_prtflds_default(goea_results))
tsv_data = MgrNtGOEAs(goea_results).get_goea_nts_prt(prt_flds, **kws)
RPT.prt_tsv(prt, tsv_data, prt_flds, **kws)
RPT.prt_tsv(prt, tsv_data, **kws)

@staticmethod
def get_ns2nts(results, fldnames=None, **kws):
Expand Down
39 changes: 39 additions & 0 deletions tests/test_print_tsv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python
"""Test GOEnrichmentStudy::print_results."""

import os
import sys
from goatools.test_data.genes_NCBI_10090_ProteinCoding import GENEID2NT as GeneID2nt_mus
from goatools.test_data.nature3102_goea import get_geneid2symbol, get_goeaobj

__copyright__ = "Copyright (C) 2016-2017, DV Klopfenstein, H Tang, All rights reserved."

REPO = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../")


def test_example():
"""Test writing GOEA results into a tab-separated file."""
# --------------------------------------------------------------------
# --------------------------------------------------------------------
# Gene Ontology Enrichment Analysis (GOEA)
# --------------------------------------------------------------------
# --------------------------------------------------------------------
fout_tsv = os.path.join(REPO, 'goea_results.tsv')
taxid = 10090 # Mouse study
# Load ontologies, associations, and population ids
geneids_pop = GeneID2nt_mus.keys()
geneids2symbol_study = get_geneid2symbol("nbt.3102-S4_GeneIDs.xlsx")
geneids_study = geneids2symbol_study.keys()
goeaobj = get_goeaobj("fdr_bh", geneids_pop, taxid)
# Run GOEA on study
goea_results_all = goeaobj.run_study(geneids_study)
goea_results_sig = [r for r in goea_results_all if r.p_fdr_bh < 0.05]
goeaobj.wr_tsv(fout_tsv, goea_results_sig)
assert os.path.exists(fout_tsv)
goeaobj.prt_tsv(sys.stdout, goea_results_sig)


if __name__ == '__main__':
test_example()

# Copyright (C) 2016-2017, DV Klopfenstein, H Tang, All rights reserved.

0 comments on commit 4f138cc

Please sign in to comment.