From 6b612f1d17bd2dfb9057eb9e423ad3d6a92a64c3 Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Wed, 5 Feb 2014 11:43:16 -0600 Subject: On branch master --- wqflask/maintenance/dataset/genotypes.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'wqflask/maintenance') diff --git a/wqflask/maintenance/dataset/genotypes.py b/wqflask/maintenance/dataset/genotypes.py index c83fb8b7..164f0ff6 100644 --- a/wqflask/maintenance/dataset/genotypes.py +++ b/wqflask/maintenance/dataset/genotypes.py @@ -11,3 +11,26 @@ def get_geno(inbredsetid, name): """ cursor.execute(sql, (inbredsetid, name)) return cursor.fetchone() + +def load_genos(file): + genotypes = [] + file_geno = open(file, '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) + return strains, genotypes + \ No newline at end of file -- cgit v1.2.3