forked from zqfang/GSEApy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_commands.py
85 lines (69 loc) · 2.38 KB
/
test_commands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import pytest
from tempfile import NamedTemporaryFile, TemporaryDirectory, mkdtemp
from gseapy.gsea import gsea, prerank, ssgsea, replot
from gseapy.enrichr import enrichr
@pytest.fixture
def edbDIR():
return "tests/data"
@pytest.fixture
def genelist():
return "tests/data/gene_list.txt"
@pytest.fixture
def gseaGCT():
return "tests/data/P53_resampling_data.txt"
@pytest.fixture
def gseaCLS():
return "tests/data/P53.cls"
@pytest.fixture
def prernk():
return "tests/data/edb/gsea_data.gsea_data.rnk"
@pytest.fixture
def geneGMT():
return "tests/data/genes.gmt"
@pytest.fixture
def ssGMT():
return "tests/data/randomSets.gmt"
@pytest.fixture
def ssGCT():
return "tests/data/testSet_rand1200.gct"
def test_gsea(gseaGCT, gseaCLS, geneGMT):
# Only tests of the command runs successfully,
# doesnt't check the image
tmpdir= TemporaryDirectory(dir="tests")
gsea(data=gseaGCT, gene_sets=geneGMT, cls=gseaCLS,
outdir=tmpdir.name, permutation_type='phenotype',
permutation_num=10)
tmpdir.cleanup()
def test_prerank(prernk, geneGMT):
# Only tests of the command runs successfully,
# doesnt't check the image
tmpdir= TemporaryDirectory(dir="tests")
prerank(prernk, geneGMT, tmpdir.name, permutation_num=10)
tmpdir.cleanup()
prerank(prernk, geneGMT, None, permutation_num=10)
def test_ssgsea1(ssGCT, geneGMT):
# Only tests of the command runs successfully,
# doesnt't check the image
tmpdir= TemporaryDirectory(dir="tests")
ssgsea(ssGCT, geneGMT, tmpdir.name, permutation_num=100)
tmpdir.cleanup()
def test_ssgsea2(ssGCT, geneGMT):
# Only tests of the command runs successfully,
# doesnt't check the image
tmpdir= TemporaryDirectory(dir="tests")
ssgsea(ssGCT, geneGMT, tmpdir.name, permutation_num=0)
tmpdir.cleanup()
ssgsea(ssGCT, geneGMT, None, permutation_num=0)
def test_enrichr(genelist, geneGMT):
# Only tests of the command runs successfully,
# doesnt't check the image
tmpdir= TemporaryDirectory(dir="tests")
enrichr(genelist, gene_sets=['KEGG_2016', geneGMT], outdir=tmpdir.name)
tmpdir.cleanup()
enrichr(genelist, gene_sets='KEGG_2013,KEGG_2016', outdir=None)
def test_replot(edbDIR):
# Only tests of the command runs successfully,
# doesnt't check the image
tmpdir= TemporaryDirectory(dir="tests")
replot(edbDIR, tmpdir.name)
tmpdir.cleanup()