aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance/get_group_samplelists.py
diff options
context:
space:
mode:
authorLei Yan2015-07-10 20:12:00 +0000
committerLei Yan2015-07-10 20:12:00 +0000
commitaa159a17785cc415e81346963aa76f05f5f9d4ad (patch)
treeae0502dac39d8cf20115b58817df4931a03b727c /wqflask/maintenance/get_group_samplelists.py
parent239c5ff97a88bd9ae3c439ca244daca2696fe68b (diff)
parent840285e3533790760b763aaa43d3099f9b0a5d69 (diff)
downloadgenenetwork2-aa159a17785cc415e81346963aa76f05f5f9d4ad.tar.gz
Merge https://github.com/genenetwork/genenetwork2
Diffstat (limited to 'wqflask/maintenance/get_group_samplelists.py')
-rwxr-xr-xwqflask/maintenance/get_group_samplelists.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/wqflask/maintenance/get_group_samplelists.py b/wqflask/maintenance/get_group_samplelists.py
index c9ec3872..b8397b47 100755
--- a/wqflask/maintenance/get_group_samplelists.py
+++ b/wqflask/maintenance/get_group_samplelists.py
@@ -17,8 +17,13 @@ def process_genofiles(geno_dir=webqtlConfig.GENODIR):
sample_list = get_samplelist(geno_file)
-def get_samplelist(geno_file):
- genofilename = os.path.join(webqtlConfig.GENODIR, geno_file)
+def get_samplelist(file_type, geno_file):
+ if file_type == "geno":
+ return get_samplelist_from_geno(geno_file)
+ elif file_type == "plink":
+ return get_samplelist_from_plink(geno_file)
+
+def get_samplelist_from_geno(genofilename):
if os.path.isfile(genofilename + '.gz'):
genofilename += '.gz'
genofile = gzip.open(genofilename)
@@ -41,3 +46,12 @@ def get_samplelist(geno_file):
samplelist = headers[3:]
return samplelist
+def get_samplelist_from_plink(genofilename):
+ genofile = open(genofilename)
+
+ samplelist = []
+ for line in genofile:
+ line = line.split(" ")
+ samplelist.append(line[0])
+
+ return samplelist \ No newline at end of file