-
Notifications
You must be signed in to change notification settings - Fork 25
/
pheno_info.py
executable file
·45 lines (33 loc) · 1.15 KB
/
pheno_info.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Describe phenotypical info
Usage:
pheno_info.py
pheno_info.py (-h | --help)
Options:
-h --help Show this screen
"""
from docopt import docopt
from utils import (load_phenotypes)
if __name__ == "__main__":
arguments = docopt(__doc__)
pheno_path = "./data/phenotypes/Phenotypic_V1_0b_preprocessed1.csv"
pheno = load_phenotypes(pheno_path)
for site, df_site in pheno.groupby("SITE_ID"):
asd = df_site[df_site["DX_GROUP"] == 0]
tc = df_site[df_site["DX_GROUP"] == 1]
fmt = "% 8s & % 8.1f (% 8.1f) & % 8.1f (% 8.1f) & M % 3d, F % 3d & % 8.1f (% 8.1f) & M % 3d, F % 3d \\\\"
print (fmt % (
site,
asd["AGE"].mean(),
asd["AGE"].std(),
asd["ADOS"].mean(),
asd["ADOS"].std(),
int(asd[asd["SEX"] == "M"].shape[0]),
int(asd[asd["SEX"] == "F"].shape[0]),
tc["AGE"].mean(),
tc["AGE"].std(),
int(tc[tc["SEX"] == "M"].shape[0]),
int(tc[tc["SEX"] == "F"].shape[0]),
)).replace(" nan", "$\dag$").replace("_", " ")