From cc28c56df8430271e5b16a08ab0ada1409039dc7 Mon Sep 17 00:00:00 2001 From: anibalsolon Date: Sat, 6 May 2017 21:30:21 -0300 Subject: [PATCH] Get pheno info --- pheno_info.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 pheno_info.py diff --git a/pheno_info.py b/pheno_info.py new file mode 100644 index 0000000..6efaeab --- /dev/null +++ b/pheno_info.py @@ -0,0 +1,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("_", " ")