aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance/get_group_samplelists.py
diff options
context:
space:
mode:
authorpjotrp2015-11-18 11:19:01 +0100
committerpjotrp2015-11-18 11:19:01 +0100
commitcb0f10fc4850b6b06f2237b532317a5c6668584a (patch)
treed143662ecceac5e05bd06afee4c87b2beb88859b /wqflask/maintenance/get_group_samplelists.py
parent28ec342362ba068b3d0b5b9a302bc279d251f160 (diff)
parent0310301b30c59eca45235cd1bd1ff8e15923950a (diff)
downloadgenenetwork2-cb0f10fc4850b6b06f2237b532317a5c6668584a.tar.gz
Merge branch 'master' of https://github.com/zsloan/genenetwork2 into zsloan
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