aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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