diff options
author | Zachary Sloan | 2014-07-21 16:07:42 +0000 |
---|---|---|
committer | Zachary Sloan | 2014-07-21 16:07:42 +0000 |
commit | d952a23662eb4c46041be3945b5c3ccacf5506b6 (patch) | |
tree | 00750c5c88fb7dc6f300a148ea40f95a7b46be3a /wqflask/maintenance/dataset/correlations.py | |
parent | 818de422631392c246646b52a5b227d23153e667 (diff) | |
parent | c424db452c243c6f0f64ee58d2d7baeb147dd3c8 (diff) | |
download | genenetwork2-d952a23662eb4c46041be3945b5c3ccacf5506b6.tar.gz |
Merge /home/lei/gene
Diffstat (limited to 'wqflask/maintenance/dataset/correlations.py')
-rw-r--r-- | wqflask/maintenance/dataset/correlations.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/wqflask/maintenance/dataset/correlations.py b/wqflask/maintenance/dataset/correlations.py new file mode 100644 index 00000000..b089e446 --- /dev/null +++ b/wqflask/maintenance/dataset/correlations.py @@ -0,0 +1,47 @@ +# Author: Lei Yan +# Create Date: 2014-01-21 +# Last Update Date: 2014-01-24 + +# import +import sys +import os +import re +import MySQLdb +import ConfigParser + +def main(argv): + + # load configuration from configuration file + config = ConfigParser.ConfigParser() + config.read(argv[1]) + genofile = config.get('configuration', 'genofile') + + # parse genofile + genotypes = [] + file_geno = open(genofile, 'r') + for line in file_geno: + line = line.strip() + if line.startswith('#'): + continue + if line.startswith('@'): + continue + cells = line.split() + if line.startswith("Chr"): + strains = cells[4:] + continue + genotype = {} + genotype['chr'] = cells[0] + genotype['locus'] = cells[1] + genotype['cm'] = cells[2] + genotype['mb'] = cells[3] + genotype['values'] = cells[4:] + genotypes.append(genotype) + print "get %d strains:\t%s" % (len(strains), strains) + print "load %d genotypes" % len(genotypes) + + # phenotypes + +# main +if __name__ == "__main__": + main(sys.argv) + print "exit successfully" |