diff options
Diffstat (limited to 'wqflask')
-rwxr-xr-x | wqflask/wqflask/marker_regression/marker_regression.py | 7 | ||||
-rwxr-xr-x | wqflask/wqflask/show_trait/show_trait.py | 25 | ||||
-rwxr-xr-x | wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js | 1 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/index_page.html | 2 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/show_trait_details.html | 12 | ||||
-rwxr-xr-x | wqflask/wqflask/templates/show_trait_mapping_tools.html | 54 | ||||
-rwxr-xr-x | wqflask/wqflask/views.py | 1 |
7 files changed, 65 insertions, 37 deletions
diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 757aeb72..b33efc1f 100755 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -91,6 +91,7 @@ class MarkerRegression(object): else: self.num_perm = start_vars['num_perm'] self.control = start_vars['control_marker'] + self.do_control = start_vars['do_control'] print("StartVars:", start_vars) self.method = start_vars['mapmethod_rqtl_geno'] self.model = start_vars['mapmodel_rqtl_geno'] @@ -352,7 +353,7 @@ class MarkerRegression(object): covar = self.create_covariates(cross_object) # Create the additive covariate matrix if self.pair_scan: - if(r_sum(covar)[0] > 0): # If sum(covar) > 0 we have a covariate matrix + if self.do_control == "true": # If sum(covar) > 0 we have a covariate matrix print("Using covariate"); result_data_frame = scantwo(cross_object, pheno = "the_pheno", addcovar = covar, model=self.model, method=self.method, n_cluster = 16) else: print("No covariates"); result_data_frame = scantwo(cross_object, pheno = "the_pheno", model=self.model, method=self.method, n_cluster = 16) @@ -367,13 +368,13 @@ class MarkerRegression(object): return self.process_pair_scan_results(result_data_frame) else: - if(r_sum(covar)[0] > 0): + if self.do_control == "true": print("Using covariate"); result_data_frame = scanone(cross_object, pheno = "the_pheno", addcovar = covar, model=self.model, method=self.method) else: print("No covariates"); result_data_frame = scanone(cross_object, pheno = "the_pheno", model=self.model, method=self.method) if int(self.num_perm) > 0: # Do permutation (if requested by user) - if(r_sum(covar)[0] > 0): + if self.do_control == "true": perm_data_frame = scanone(cross_object, pheno_col = "the_pheno", addcovar = covar, n_perm = int(self.num_perm), model=self.model, method=self.method) else: perm_data_frame = scanone(cross_object, pheno_col = "the_pheno", n_perm = int(self.num_perm), model=self.model, method=self.method) diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 871d1880..e83437ab 100755 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -102,11 +102,13 @@ class ShowTrait(object): print("self.dataset.type:", self.dataset.type) if hasattr(self.this_trait, 'locus_chr') and self.this_trait.locus_chr != "" and self.dataset.type != "Geno" and self.dataset.type != "Publish": - self.nearest_marker1 = get_nearest_marker(self.this_trait, self.dataset)[0] - self.nearest_marker2 = get_nearest_marker(self.this_trait, self.dataset)[1] + self.nearest_marker = get_nearest_marker(self.this_trait, self.dataset) + #self.nearest_marker1 = get_nearest_marker(self.this_trait, self.dataset)[0] + #self.nearest_marker2 = get_nearest_marker(self.this_trait, self.dataset)[1] else: - self.nearest_marker1 = "" - self.nearest_marker2 = "" + self.nearest_marker = "" + #self.nearest_marker1 = "" + #self.nearest_marker2 = "" self.make_sample_lists(self.this_trait) @@ -120,11 +122,13 @@ class ShowTrait(object): hddn['mapping_display_all'] = True hddn['suggestive'] = 0 hddn['num_perm'] = 0 - hddn['manhattan_plot'] = False + hddn['manhattan_plot'] = "" if hasattr(self.this_trait, 'locus_chr') and self.this_trait.locus_chr != "" and self.dataset.type != "Geno" and self.dataset.type != "Publish": - hddn['control_marker'] = self.nearest_marker1+","+self.nearest_marker2 + hddn['control_marker'] = self.nearest_marker + #hddn['control_marker'] = self.nearest_marker1+","+self.nearest_marker2 else: hddn['control_marker'] = "" + hddn['do_control'] = False hddn['maf'] = 0.01 hddn['compare_traits'] = [] hddn['export_data'] = "" @@ -1231,21 +1235,24 @@ def get_nearest_marker(this_trait, this_db): print("this_chr:", this_chr) this_mb = this_trait.locus_mb print("this_mb:", this_mb) + #One option is to take flanking markers, another is to take the two (or one) closest query = """SELECT Geno.Name FROM Geno, GenoXRef, GenoFreeze WHERE Geno.Chr = '{}' AND GenoXRef.GenoId = Geno.Id AND GenoFreeze.Id = GenoXRef.GenoFreezeId AND GenoFreeze.Name = '{}' - ORDER BY ABS( Geno.Mb - {}) LIMIT 2""".format(this_chr, this_db.group.name+"Geno", this_mb) + ORDER BY ABS( Geno.Mb - {}) LIMIT 1""".format(this_chr, this_db.group.name+"Geno", this_mb) print("query:", query) result = g.db.execute(query).fetchall() print("result:", result) if result == []: - return "", "" + return "" + #return "", "" else: - return result[0][0], result[1][0] + return result[0][0] + #return result[0][0], result[1][0] diff --git a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js index 3be40a57..2f26d6cb 100755 --- a/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js +++ b/wqflask/wqflask/static/new/javascript/show_trait_mapping_tools.js @@ -185,6 +185,7 @@ $('input[name=num_perm]').val($('input[name=num_perm_rqtl_geno]').val()); $('input[name=manhattan_plot]').val($('input[name=manhattan_plot_rqtl]:checked').val()); $('input[name=control_marker]').val($('input[name=control_rqtl_geno]').val()); + $('input[name=do_control]').val($('input[name=do_control_rqtl]:checked').val()); form_data = $('#trait_data_form').serialize(); console.log("form_data is:", form_data); return do_ajax_post(url, form_data); diff --git a/wqflask/wqflask/templates/index_page.html b/wqflask/wqflask/templates/index_page.html index 2bbfcd91..6c630344 100755 --- a/wqflask/wqflask/templates/index_page.html +++ b/wqflask/wqflask/templates/index_page.html @@ -271,7 +271,7 @@ // Has the enter key been pressed? if ( (window.event ? event.keyCode : e.which) == 13) { // If it has been so, manually submit the <form> - document.forms[0].submit(); + document.forms[1].submit(); } } </script> diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html index 3259d349..cdaa919e 100755 --- a/wqflask/wqflask/templates/show_trait_details.html +++ b/wqflask/wqflask/templates/show_trait_details.html @@ -38,12 +38,6 @@ <dt>Resource Links</dt> {% if this_trait.dataset.type == 'ProbeSet' %} <dd> - {% if this_trait.symbol != None %} - <a href="http://www.genotation.org/Getd2g.pl?gene_list={{ this_trait.symbol }}" target="_blank" title="Related descriptive, genomic, clinical, functional and drug-therapy information"> - Genotation - </a> - - {% endif %} {% if this_trait.geneid != None %} <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=gene&cmd=Retrieve&dopt=Graphics&list_uids={{ this_trait.geneid }}" target="_blank" title="Info from NCBI Entrez Gene"> Gene @@ -62,6 +56,12 @@ </a> {% endif %} + {% if this_trait.symbol != None %} + <a href="http://www.genotation.org/Getd2g.pl?gene_list={{ this_trait.symbol }}" target="_blank" title="Related descriptive, genomic, clinical, functional and drug-therapy information"> + Genotation + </a> + + {% endif %} </dd> {% endif %} </dl> diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index 7f26a252..de25f4ee 100755 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -1,6 +1,6 @@ <div> {% if (use_pylmm_rqtl and dataset.group.species != "human") or use_plink_gemma %} - <div class="col-xs-6"> + <div class="col-xs-4"> <div class="tabbable"> <!-- Only required for left/right tabs --> <ul class="nav nav-pills"> @@ -31,9 +31,9 @@ <div class="tab-content"> {% if use_pylmm_rqtl and not use_plink_gemma and dataset.group.species != "human" %} <div class="tab-pane active" id="pylmm"> - <div style="padding: 20px" class="form-horizontal"> + <div style="margin-top: 20px" class="form-horizontal"> <div class="mapping_method_fields form-group"> - <label for="mapping_permutations" class="col-xs-2 control-label">Permutations</label> + <label for="mapping_permutations" class="col-xs-3 control-label">Permutations</label> <div style="margin-left: 20px;" class="col-xs-4 controls"> <input name="num_perm_pylmm" value="" type="text" class="form-control"> </div> @@ -41,16 +41,26 @@ <div id="permutations_alert" class="alert alert-error alert-warning" style="display:none;"> Please be aware that permutations can take a very long time (~20 minutes for 500 permutations) </div> +<!-- <div class="mapping_method_fields form-group"> - <label for="control_for" class="col-xs-2 control-label">Control for</label> + <label for="control_for" class="col-xs-3 control-label">Control for</label> <div style="margin-left: 20px;" class="col-xs-4 controls"> {% if dataset.type == 'ProbeSet' and this_trait.locus_chr != "" %} - <input name="control_pylmm" value="{{ nearest_marker1+","+nearest_marker2 }}" type="text" /> + <input name="control_pylmm" value="{{ nearest_marker }}" type="text" /> {% else %} <input name="control_pylmm" value="" type="text" /> {% endif %} + <label class="radio-inline"> + <input type="radio" name="do_control_pylmm" value="true"> + Yes + </label> + <label class="radio-inline"> + <input type="radio" name="do_control_pylmm" value="false" checked=""> + No + </label> </div> </div> +--> <div class="mapping_method_fields form-group"> <label style="text-align:left;" class="col-xs-12 control-label">Manhattan Plot</label> @@ -68,7 +78,7 @@ <div class="form-group"> <div style="padding-left:15px;" class="controls"> <button id="pylmm_compute" class="btn submit_special btn-primary" title="Compute Marker Regression"> - <i class="icon-ok-circle icon-white"></i> Open Mapping Tool + <i class="icon-ok-circle icon-white"></i> Compute </button> </div> </div> @@ -76,29 +86,37 @@ </div> <div class="tab-pane" id="rqtl_geno"> - <div style="padding: 20px" class="form-horizontal"> + <div style="margin-top: 20px" class="form-horizontal"> <div class="mapping_method_fields form-group"> - <label for="mapping_permutations" class="col-xs-2 control-label">Permutations</label> + <label for="mapping_permutations" class="col-xs-3 control-label">Permutations</label> <div style="margin-left: 20px;" class="col-xs-4 controls"> - <input name="num_perm_rqtl_geno" value="2000" type="text" class="form-control"> + <input name="num_perm_rqtl_geno" value="" type="text" class="form-control"> </div> </div> <div id="permutations_alert" class="alert alert-error alert-warning" style="display:none;"> Please be aware that permutations can take a very long time (~20 minutes for 500 permutations) </div> <div class="mapping_method_fields form-group"> - <label for="control_for" class="col-xs-2 control-label">Control for</label> + <label for="control_for" class="col-xs-3 control-label">Control for</label> <div style="margin-left: 20px;" class="col-xs-4 controls"> {% if dataset.type == 'ProbeSet' and this_trait.locus_chr != "" %} - <input name="control_rqtl_geno" value="{{ nearest_marker1+","+nearest_marker2 }}" type="text" style="width: 160px;" class="form-control" /> + <input name="control_rqtl_geno" value="{{ nearest_marker }}" type="text" style="width: 160px;" class="form-control" /> {% else %} <input name="control_rqtl_geno" value="" type="text" class="form-control" /> {% endif %} + <label class="radio-inline"> + <input type="radio" name="do_control_rqtl" value="true"> + Yes + </label> + <label class="radio-inline"> + <input type="radio" name="do_control_rqtl" value="false" checked=""> + No + </label> </div> </div> <div class="mapping_method_fields form-group"> - <label for="mapmethod_rqtl_geno" style="text-align:left;" class="col-xs-2 control-label">Method</label> + <label for="mapmethod_rqtl_geno" style="text-align:left;" class="col-xs-3 control-label">Method</label> <div class="col-xs-4 controls"> <select name="mapmethod_rqtl_geno" class="form-control"> <option value="em">em</option> @@ -113,7 +131,7 @@ </div> <div class="mapping_method_fields form-group"> - <label for="mapmodel_rqtl_geno" style="text-align:left;" class="col-xs-2 control-label">Model</label> + <label for="mapmodel_rqtl_geno" style="text-align:left;" class="col-xs-3 control-label">Model</label> <div class="col-xs-4 controls"> <select name="mapmodel_rqtl_geno" class="form-control"> <option value="normal">normal</option> @@ -155,23 +173,23 @@ <div class="form-group"> <div style="padding-left:15px;" class="controls"> <button id="rqtl_geno_compute" class="btn submit_special btn-primary" data-url="/marker_regression" title="Compute Marker Regression"> - <i class="icon-ok-circle icon-white"></i> Open Mapping Tool + <i class="icon-ok-circle icon-white"></i> Compute </button> </div> </div> </div> </div> <div class="tab-pane" id="interval_mapping"> - <div style="padding: 20px" class="form-horizontal"> + <div style="margin-top: 20px" class="form-horizontal"> <div class="mapping_method_fields form-group"> - <label for="mapping_permutations" class="col-xs-2 control-label">Permutations</label> + <label for="mapping_permutations" class="col-xs-3 control-label">Permutations</label> <div style="margin-left: 20px;" class="col-xs-4 controls"> <input name="num_perm_reaper" value="2000" type="text" class="form-control"> </div> </div> <!-- <div class="mapping_method_fields form-group"> - <label for="mapping_bootstraps" class="col-xs-2 control-label" title="Bootstrapping Resamples">Bootstrap</label> + <label for="mapping_bootstraps" class="col-xs-3 control-label" title="Bootstrapping Resamples">Bootstrap</label> <div style="margin-left: 20px;" class="col-xs-4 controls"> <input name="mapping_bootstraps" value="2000" type="text" class="form-control"> </div> @@ -208,7 +226,7 @@ <div class="form-group"> <div style="padding-left:15px;" class="controls"> <button id="interval_mapping_compute" class="btn submit_special btn-primary" data-url="/interval_mapping" title="Compute Interval Mapping"> - <i class="icon-ok-circle icon-white"></i> Open Mapping Tool + <i class="icon-ok-circle icon-white"></i> Compute </button> </div> </div> diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 00c8d00d..3cff9a0c 100755 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -318,6 +318,7 @@ def marker_regression_page(): 'manhattan_plot', 'control_marker', 'control_marker_db', + 'do_control', 'pair_scan', 'mapmethod_rqtl_geno', 'mapmodel_rqtl_geno' |