aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance
diff options
context:
space:
mode:
authorLei Yan2014-02-05 11:43:16 -0600
committerLei Yan2014-02-05 11:43:16 -0600
commit6b612f1d17bd2dfb9057eb9e423ad3d6a92a64c3 (patch)
tree30d6430ad3163d84bf3e878289f942959e6ae5ea /wqflask/maintenance
parent9f52d42b9f89cf3b878e5ea67290ab3514503819 (diff)
downloadgenenetwork2-6b612f1d17bd2dfb9057eb9e423ad3d6a92a64c3.tar.gz
On branch master
Diffstat (limited to 'wqflask/maintenance')
-rw-r--r--wqflask/maintenance/dataset/genotypes.py23
1 files changed, 23 insertions, 0 deletions
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