diff options
author | pjotrp | 2015-11-18 11:19:01 +0100 |
---|---|---|
committer | pjotrp | 2015-11-18 11:19:01 +0100 |
commit | cb0f10fc4850b6b06f2237b532317a5c6668584a (patch) | |
tree | d143662ecceac5e05bd06afee4c87b2beb88859b /wqflask/maintenance/get_group_samplelists.py | |
parent | 28ec342362ba068b3d0b5b9a302bc279d251f160 (diff) | |
parent | 0310301b30c59eca45235cd1bd1ff8e15923950a (diff) | |
download | genenetwork2-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-x | wqflask/maintenance/get_group_samplelists.py | 18 |
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 |