Completed
Push — master ( 402c3f...588c1f )
by Haibao
36s
created

test_statsdescribe()   B

Complexity

Conditions 5

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 5
c 2
b 0
f 0
dl 0
loc 17
rs 8.5454
1
"""Test StatsDescribe."""
2
3
from goatools.statsdescribe import StatsDescribe
4
from goatools.test_data.goids_GOATOOLS_Consistent_Increase import nts
5
6
def test_statsdescribe():
7
    """Use StatsDescribe to create a markdown table.
8
9
fdr_bh
10
name     | # fdr_bh | range of fdr_bh      | 25th perc|   median | 75th perc|     mean | stddev
11
---------|----------|----------------------|----------|----------|----------|----------|---------
12
GOATOOLS |       59 | 1.87e-07 to 4.94e-02 | 2.72e-04 | 1.03e-02 | 3.04e-02 | 1.56e-02 | 1.82e-02
13
14
    """
15
    #pylint: disable=no-member
16
    # Somehow nts contains fields of empty string, which we can check with:
17
    # print([(nt.GO, nt.p_fdr_bh) for nt in nts])
18
    nts_goids = [nt for nt in nts if nt.p_fdr_bh != '' and nt.p_fdr_bh < 0.05]
19
    fdr_vals = [nt.p_fdr_bh for nt in nts_goids]
20
    statsobj = StatsDescribe("fdr_bh", fmtstr="{:>8.2e}")
21
    statsobj.prt_hdr()
22
    statsobj.prt_data("GOATOOLS", fdr_vals)
23
24
25
if __name__ == '__main__':
26
    test_statsdescribe()
27