diff options
author | zsloan | 2016-03-01 21:01:55 +0000 |
---|---|---|
committer | zsloan | 2016-03-01 21:01:55 +0000 |
commit | fa6aff6719cf180d4a5941d3ee6a538b33230124 (patch) | |
tree | 125bee1fd19f53643209cfc693e1c4e2d8cb283d | |
parent | c5ae746a29125bddeda5609916cf9ec25152cc35 (diff) | |
parent | d38f4c6c2176d935bcb4f235fb4eee8b3ad703c2 (diff) | |
download | genenetwork2-fa6aff6719cf180d4a5941d3ee6a538b33230124.tar.gz |
Merge branch 'master' of https://github.com/genenetwork/genenetwork2
-rw-r--r-- | wqflask/wqflask/marker_regression/gemma_mapping.py | 13 | ||||
-rwxr-xr-x | wqflask/wqflask/marker_regression/marker_regression.py | 9 | ||||
-rwxr-xr-x | wqflask/wqflask/show_trait/show_trait.py | 1 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/collections/list.html | 15 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/collections/view.html | 24 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/gsearch_gene.html | 19 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/gsearch_pheno.html | 19 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/search_result_page.html | 32 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/show_trait_mapping_tools.html | 8 | ||||
-rw-r--r-- | wqflask/wqflask/wgcna/wgcna_analysis.py | 2 |
10 files changed, 116 insertions, 26 deletions
diff --git a/wqflask/wqflask/marker_regression/gemma_mapping.py b/wqflask/wqflask/marker_regression/gemma_mapping.py index b1ab780c..997b692d 100644 --- a/wqflask/wqflask/marker_regression/gemma_mapping.py +++ b/wqflask/wqflask/marker_regression/gemma_mapping.py @@ -1,6 +1,9 @@ import os from base import webqtlConfig +from utility.tools import gemma_command + +GEMMA_PATH,GEMMA_COMMAND = gemma_command() def run_gemma(this_dataset, samples, vals): """Generates p-values for each marker using GEMMA""" @@ -9,9 +12,11 @@ def run_gemma(this_dataset, samples, vals): gen_pheno_txt_file(this_dataset, samples, vals) - os.chdir("{}gemma".format(webqtlConfig.HTMLPATH)) + os.chdir(GEMMA_PATH) - gemma_command = './gemma -bfile %s -k output_%s.cXX.txt -lmm 1 -o output/%s_output' % (this_dataset.group.name, + gemma_command = GEMMA_COMMAND + ' -bfile %s/%s -k %s/output/%s.cXX.txt -lmm 1 -o %s_output' % (GEMMA_PATH, + this_dataset.group.name, + GEMMA_PATH, this_dataset.group.name, this_dataset.group.name) print("gemma_command:" + gemma_command) @@ -25,14 +30,14 @@ def run_gemma(this_dataset, samples, vals): def gen_pheno_txt_file(this_dataset, samples, vals): """Generates phenotype file for GEMMA""" - with open("{}gemma/{}.fam".format(webqtlConfig.HTMLPATH, this_dataset.group.name), "w") as outfile: + with open("{}/{}.fam".format(GEMMA_PATH, this_dataset.group.name), "w") as outfile: for i, sample in enumerate(samples): outfile.write(str(sample) + " " + str(sample) + " 0 0 0 " + str(vals[i]) + "\n") def parse_gemma_output(this_dataset): included_markers = [] p_values = [] - with open("{}gemma/output/{}_output.assoc.txt".format(webqtlConfig.HTMLPATH, this_dataset.group.name)) as output_file: + with open("{}/output/{}_output.assoc.txt".format(GEMMA_PATH, this_dataset.group.name)) as output_file: for line in output_file: if line.startswith("chr"): continue diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index c16c885e..a6fa5274 100755 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -39,10 +39,11 @@ from utility import helper_functions from utility import Plot, Bunch from utility import temp_data from utility.benchmark import Bench -from utility.tools import pylmm_command, plink_command +from utility.tools import pylmm_command, plink_command, gemma_command PYLMM_PATH,PYLMM_COMMAND = pylmm_command() PLINK_PATH,PLINK_COMMAND = plink_command() +GEMMA_PATH,GEMMA_COMMAND = gemma_command() class MarkerRegression(object): @@ -219,9 +220,9 @@ class MarkerRegression(object): self.gen_pheno_txt_file() - os.chdir("/home/zas1024/gene/web/gemma") + #os.chdir("/home/zas1024/gene/web/gemma") - gemma_command = './gemma -bfile %s -k output_%s.cXX.txt -lmm 1 -o %s_output' % ( + gemma_command = GEMMA_COMMAND + ' -bfile %s -k output_%s.cXX.txt -lmm 1 -o %s_output' % ( self.dataset.group.name, self.dataset.group.name, self.dataset.group.name) @@ -491,7 +492,7 @@ class MarkerRegression(object): self.gen_pheno_txt_file_plink(pheno_filename = plink_output_filename) - plink_command = PLINK_COMMAND + ' --noweb --ped %s/%s.ped --no-fid --no-parents --no-sex --no-pheno --map %s/%s.map --pheno %s%s.txt --pheno-name %s --maf %s --missing-phenotype -9999 --out %s%s --assoc ' % (PLINK_PATH, self.dataset.group.name, PLINK_PATH, self.dataset.group.name, webqtlConfig.TMPDIR, plink_output_filename, self.this_trait.name, self.maf, webqtlConfig.TMPDIR, plink_output_filename) + plink_command = PLINK_COMMAND + ' --noweb --bed %s/%s.bed --bim %s/%s.bim --fam %s/%s.fam --no-fid --no-parents --no-sex --no-pheno --pheno %s%s.txt --pheno-name %s --maf %s --missing-phenotype -9999 --out %s%s --assoc ' % (PLINK_PATH, self.dataset.group.name, PLINK_PATH, self.dataset.group.name, PLINK_PATH, self.dataset.group.name, webqtlConfig.TMPDIR, plink_output_filename, self.this_trait.name, self.maf, webqtlConfig.TMPDIR, plink_output_filename) print("plink_command:", plink_command) os.system(plink_command) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index aa6f9562..d6c48a12 100755 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -161,7 +161,6 @@ class ShowTrait(object): def check_plink_gemma(): if (os.path.isfile(PLINK_PATH+"/"+self.dataset.group.name+".bed") and os.path.isfile(PLINK_PATH+"/"+self.dataset.group.name+".map")): - return True else: return False diff --git a/wqflask/wqflask/templates/collections/list.html b/wqflask/wqflask/templates/collections/list.html index 52106eae..0e7612aa 100755 --- a/wqflask/wqflask/templates/collections/list.html +++ b/wqflask/wqflask/templates/collections/list.html @@ -4,6 +4,7 @@ <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" /> <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" /> <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" /> + <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" /> {% endblock %} {% block content %} <!-- Start of body --> @@ -55,6 +56,10 @@ {% block js %} <script type="text/javascript" src="/static/packages/smart-time-ago/lib/timeago.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script> @@ -62,7 +67,15 @@ <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script> <script> $('#trait_table').dataTable( { - "sDom": "RZtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'collection_list', + fieldBoundary: '"' + } + ], + "sDom": "RZBtir", "iDisplayLength": -1, "autoWidth": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/collections/view.html b/wqflask/wqflask/templates/collections/view.html index 5450f903..a53759c4 100755 --- a/wqflask/wqflask/templates/collections/view.html +++ b/wqflask/wqflask/templates/collections/view.html @@ -4,6 +4,7 @@ <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" /> <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" /> <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" /> + <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" /> {% endblock %} {% block content %} <!-- Start of body --> @@ -73,12 +74,12 @@ <button class="btn btn-default" id="invert"><span class="glyphicon glyphicon-resize-vertical"></span> Invert</button> <button class="btn" id="add" disabled="disabled"><i class="icon-plus-sign"></i> Add Record to Other Collection</button> <button class="btn" id="remove" disabled="disabled"><i class="icon-minus-sign"></i> Remove Record</button> - <button class="btn btn-primary pull-right"><i class="icon-download icon-white"></i> Download Table</button> <br /> <br /> <table class="table table-hover table-striped" id='trait_table'> <thead> <tr> + <th></th> <th>Index</th> <th>Record</th> <th>Description</th> @@ -93,10 +94,11 @@ <tbody> {% for this_trait in trait_obs %} <TR id="trait:{{ this_trait.name }}:{{ this_trait.dataset.name }}"> - <TD>{{ loop.index }} + <TD> <INPUT TYPE="checkbox" NAME="searchResult" class="checkbox trait_checkbox" VALUE="{{ data_hmac('{}:{}'.format(this_trait.name, this_trait.dataset.name)) }}"> </TD> + <TD>{{ loop.index }}</TD> <TD> <a href="{{ url_for('show_trait_page', trait_id = this_trait.name, @@ -129,6 +131,10 @@ {% block js %} <script type="text/javascript" src="/static/new/javascript/search_results.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script> @@ -150,6 +156,7 @@ "columns": [ { "type": "natural" }, { "type": "natural" }, + { "type": "natural" }, { "type": "natural", "width": "35%" }, { "type": "natural", @@ -161,7 +168,18 @@ "width": "15%" }, { "type": "natural" } ], - "sDom": "ZRtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'collection', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8] + } + } + ], + "sDom": "ZRBtir", "iDisplayLength": -1, "autoWidth": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/gsearch_gene.html b/wqflask/wqflask/templates/gsearch_gene.html index 0a1839a1..7cc9a1bd 100755 --- a/wqflask/wqflask/templates/gsearch_gene.html +++ b/wqflask/wqflask/templates/gsearch_gene.html @@ -6,6 +6,7 @@ <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" /> <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.css" > <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css"> + <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" /> {% endblock %} {% block content %} <!-- Start of body --> @@ -20,7 +21,6 @@ <button class="btn btn-default" id="deselect_all"><span class="glyphicon glyphicon-remove"></span> Deselect All</button> <button class="btn btn-default" id="invert"><span class="glyphicon glyphicon-resize-vertical"></span> Invert</button> <button class="btn btn-default" id="add" disabled ><span class="glyphicon glyphicon-plus-sign"></span> Add</button> - <button class="btn btn-primary pull-right"><span class="glyphicon glyphicon-download"></span> Download Table</button> <input type="text" id="searchbox" class="form-control" style="width: 180px; display: inline;" placeholder="Search This Table For ..."> <input type="text" id="select_top" class="form-control" style="width: 120px; display: inline;" placeholder="Select Top ..."> @@ -77,6 +77,10 @@ <script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> @@ -169,7 +173,18 @@ { "type": "cust-txt" } ], "order": [[ 1, "asc" ]], - "sDom": "RZtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] + } + } + ], + "sDom": "RZBtir", "autoWidth": false, "bLengthChange": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/gsearch_pheno.html b/wqflask/wqflask/templates/gsearch_pheno.html index 2527bebf..0bdc4f4e 100755 --- a/wqflask/wqflask/templates/gsearch_pheno.html +++ b/wqflask/wqflask/templates/gsearch_pheno.html @@ -4,6 +4,7 @@ <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" /> <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" /> <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" /> + <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/buttons.bootstrap.css" /> <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.css" > <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/fixedcolumns/3.0.4/css/dataTables.fixedColumns.css"> {% endblock %} @@ -20,7 +21,6 @@ <button class="btn btn-default" id="deselect_all"><span class="glyphicon glyphicon-remove"></span> Deselect All</button> <button class="btn btn-default" id="invert"><span class="glyphicon glyphicon-resize-vertical"></span> Invert</button> <button class="btn btn-default" id="add" disabled ><span class="glyphicon glyphicon-plus-sign"></span> Add</button> - <button class="btn btn-primary pull-right"><span class="glyphicon glyphicon-download"></span> Download Table</button> <input type="text" id="searchbox" class="form-control" style="width: 200px; display: inline;" placeholder="Search This Table For ..."> <input type="text" id="select_top" class="form-control" style="width: 200px; display: inline;" placeholder="Select Top ..."> <br /> @@ -70,6 +70,10 @@ <script language="javascript" type="text/javascript" src="/static/new/javascript/search_results.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/dataTables.buttons.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.html5.min.js"></script> + <script language="javascript" type="text/javascript" src="https://cdn.datatables.net/buttons/1.0.0/js/buttons.bootstrap.min.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/js_external/jszip.min.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> @@ -137,7 +141,18 @@ { "type": "natural" } ], "order": [[ 1, "asc" ]], - "sDom": "RZtir", + "buttons": [ + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + } + } + ], + "sDom": "RZBtir", "autoWidth": false, "bLengthChange": true, "bDeferRender": true, diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 02365b1d..ff3e04bb 100755 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -167,7 +167,7 @@ <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/dataTables.naturalSort.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colResize.js"></script> <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.colReorder.js"></script> - <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.js"></script> + <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/extensions/dataTables.fixedHeader.min.js"></script> <script language="javascript" type="text/javascript" src="//cdn.datatables.net/fixedcolumns/3.0.4/js/dataTables.fixedColumns.min.js"></script> <script type="text/javascript" charset="utf-8"> @@ -234,7 +234,15 @@ ], "order": [[1, "asc" ]], "buttons": [ - 'csv' + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7, 8, 9] + } + } ], "sDom": "RZBtir", "iDisplayLength": -1, @@ -260,7 +268,15 @@ ], "order": [[1, "asc" ]], "buttons": [ - 'csv' + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3, 4, 5, 6, 7] + } + } ], "sDom": "RZBtir", "iDisplayLength": -1, @@ -281,7 +297,15 @@ ], "order": [[1, "asc" ]], "buttons": [ - 'csv' + { + extend: 'csvHtml5', + text: 'Download CSV', + title: 'search_results', + fieldBoundary: '"', + exportOptions: { + columns: [1, 2, 3] + } + } ], "sDom": "RZBtir", "iDisplayLength": -1, diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index c23cb010..6252f6f4 100755 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -256,8 +256,8 @@ <div class="tab-pane" id="plink"> <div style="padding: 20px" class="form-horizontal"> <div class="mapping_method_fields form-group"> - <label for="maf_plink" class="col-xs-2 control-label">Minor allele threshold</label> - <div style="margin-left: 20px;" class="col-xs-2 controls"> + <label for="maf_plink" class="col-xs-3 control-label">Minor allele threshold</label> + <div style="margin-left: 20px;" class="col-xs-3 controls"> <input name="maf_plink" value="0.01" type="text" class="form-control"> </div> </div> @@ -276,8 +276,8 @@ <div class="tab-pane" id="gemma"> <div style="padding: 20px" class="form-horizontal"> <div class="mapping_method_fields form-group"> - <label for="maf_gemma" class="col-xs-2 control-label">Minor allele threshold</label> - <div style="margin-left: 20px;" class="col-xs-2 controls"> + <label for="maf_gemma" class="col-xs-3 control-label">Minor allele threshold</label> + <div style="margin-left: 20px;" class="col-xs-3 controls"> <input name="maf_gemma" value="0.01" type="text" class="form-control"> </div> </div> diff --git a/wqflask/wqflask/wgcna/wgcna_analysis.py b/wqflask/wqflask/wgcna/wgcna_analysis.py index f23b1417..9e9f41bc 100644 --- a/wqflask/wqflask/wgcna/wgcna_analysis.py +++ b/wqflask/wqflask/wgcna/wgcna_analysis.py @@ -86,8 +86,8 @@ class WGCNA(object): trait = t[0] # R uses vectors every single element is a vector for s in uStrainsR: strain = s[0] # R uses vectors every single element is a vector - rM.rx[strain, trait] = self.input[trait].get(strain) # Update the matrix location #DEBUG: print(trait, strain, " in python: ", self.input[trait].get(strain), "in R:", rM.rx(strain,trait)[0]) + rM.rx[strain, trait] = self.input[trait].get(strain) # Update the matrix location sys.stdout.flush() self.results = {} |