diff options
author | Zachary Sloan | 2012-12-18 17:15:09 -0600 |
---|---|---|
committer | Zachary Sloan | 2012-12-18 17:15:09 -0600 |
commit | daea7eb0eb4eef445140275522703e7e2214154b (patch) | |
tree | 7290ce8e531fd26170af9b72d577170649de2d95 | |
parent | a0ab498f670a674b96e6f10064e787fb995403ac (diff) | |
download | genenetwork2-daea7eb0eb4eef445140275522703e7e2214154b.tar.gz |
Created new file species.py and species class object TheSpecies
Converted html for the mapping tabs to bootstrap and redid html inside of
the Interval Mapping tab
Added text input for # of permutation tests and bootstrap tests
-rwxr-xr-x | wqflask/base/data_set.py | 8 | ||||
-rw-r--r-- | wqflask/base/species.py | 16 | ||||
-rwxr-xr-x | wqflask/wqflask/show_trait/show_trait.py | 3 | ||||
-rw-r--r-- | wqflask/wqflask/templates/show_trait_mapping_tools.html | 551 | ||||
-rw-r--r-- | wqflask/wqflask/views.py | 8 |
5 files changed, 218 insertions, 368 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 2182fe9e..612b9209 100755 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -30,6 +30,7 @@ from htmlgen import HTMLgen2 as HT import reaper import webqtlConfig +from base import species from dbFunction import webqtlDatabaseFunction from utility import webqtlUtil @@ -145,7 +146,7 @@ class DataSet(object): def __init__(self, name): - assert name + assert name, "Need a name" self.name = name self.id = None self.type = None @@ -155,7 +156,10 @@ class DataSet(object): self.check_confidentiality() self.retrieve_other_names() - self.group = DatasetGroup(self) # sets self.group and self.group_id + + self.species = species.TheSpecies(self) + self.group = DatasetGroup(self) # sets self.group and self.group_id and gets genotype + def get_desc(self): diff --git a/wqflask/base/species.py b/wqflask/base/species.py new file mode 100644 index 00000000..98941ce5 --- /dev/null +++ b/wqflask/base/species.py @@ -0,0 +1,16 @@ +from __future__ import print_function, division + + +class TheSpecies(object): + def __init__(self, dataset): + self.dataset = dataset + + @property + def chromosomes(self): + chromosomes = [("All", -1)] + + for counter, genotype in enumerate(self.dataset.group.genotype): + if len(genotype) > 1: + chromosomes.append((genotype.name, counter)) + + return chromosomes diff --git a/wqflask/wqflask/show_trait/show_trait.py b/wqflask/wqflask/show_trait/show_trait.py index 836d37ea..c605cb58 100755 --- a/wqflask/wqflask/show_trait/show_trait.py +++ b/wqflask/wqflask/show_trait/show_trait.py @@ -1354,7 +1354,8 @@ class ShowTrait(object): return_results_menu_selected = return_results_menu_selected,) - def dispMappingTools(self, fd, title4Body, this_trait): + def build_mapping_tools(self, this_trait): + _Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, group=fd.group) diff --git a/wqflask/wqflask/templates/show_trait_mapping_tools.html b/wqflask/wqflask/templates/show_trait_mapping_tools.html index 90498e9a..1109ded3 100644 --- a/wqflask/wqflask/templates/show_trait_mapping_tools.html +++ b/wqflask/wqflask/templates/show_trait_mapping_tools.html @@ -1,382 +1,203 @@ - <p class="sectionheader" id="title4" style="border-radius: 5px;"> Mapping Tools</p> - - <p id="sectionbody4"></p> - - <table class="target2" cellpadding="0" cellspacing="0" width="100%"> - <tr> - <td> - <div class="ui-tabs" id="mapping_tabs"> - <ul> - <li><a href="#mappingtabs-1">Interval</a></li> - - <li><a href="#mappingtabs-2">Marker Regression</a></li> - - <li><a href="#mappingtabs-3">Composite</a></li> - - <li><a href="#mappingtabs-4">Pair-Scan</a></li> - </ul> - - <div id="mappingtabs-1"> - <table cellpadding="0" cellspacing="0" width="100%"> - <tr> - <td class="fs12 fwn" nowrap="on" valign="top"> - <table cellpadding="2" cellspacing="0" width="263px"> - <tr> - <td><span class="ffl fwb fs12">Chromosome:</span></td> - - <td colspan="3"><select name="chromosomes1" size="1"> - <option value="-1"> - All - </option> - - <option value="0"> - 1 - </option> - - <option value="1"> - 2 - </option> - - <option value="2"> - 3 - </option> - - <option value="3"> - 4 - </option> - - <option value="4"> - 5 - </option> - - <option value="5"> - 6 - </option> - - <option value="6"> - 7 - </option> - - <option value="7"> - 8 - </option> - - <option value="8"> - 9 - </option> - - <option value="9"> - 10 - </option> - - <option value="10"> - 11 - </option> - - <option value="11"> - 12 - </option> - - <option value="12"> - 13 - </option> - - <option value="13"> - 14 - </option> - - <option value="14"> - 15 - </option> - - <option value="15"> - 16 - </option> - - <option value="16"> - 17 - </option> - - <option value="17"> - 18 - </option> - - <option value="18"> - 19 - </option> - - <option value="19"> - X - </option> - </select></td> - </tr> - - <tr> - <td><span class="ffl fwb fs12">Mapping Scale:</span></td> - - <td><select name="scale1" size="1" onchange= - "checkUncheck(window.document.dataInput.scale1.value, window.document.dataInput.permCheck1, window.document.dataInput.bootCheck1)"> - <option value="physic"> - Megabase - </option> - - <option value="morgan"> - Centimorgan - </option> - </select></td> - </tr> - </table><br> - <input type="checkbox" name="permCheck1" class="checkbox" checked>Permutation Test (n=2000)<br> - <input type="checkbox" name="bootCheck1" class="checkbox">Bootstrap Test (n=2000)<br> - <input type="checkbox" name="parentsf14regression1" class="checkbox">Use Parents<br> - <input type="checkbox" name="applyVarianceSE1" class="checkbox">Use Weighted<br> - <br> - <input type="button" name="interval" class="btn" value=" Compute "><br> - <br> - </td> - </tr> - - <tr> +<div> + <h2>Mapping Tools</h2> + + <div class="tabbable"> <!-- Only required for left/right tabs --> + <ul class="nav nav-tabs"> + <li class="active"> + <a href="#interval_mapping" data-toggle="tab">Interval Mapping</a> + </li> + <li> + <a href="#marker_regression" data-toggle="tab">Marker Regression</a> + </li> + <li> + <a href="#pair_scan" data-toggle="tab">Pair Scan</a> + </li> + </ul> + + <div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;"> + <div class="tab-pane active" id="interval_mapping"> + <label for="chromosome">Chromosome: </label> + <select name="chromosome"> + {% for name, value in dataset.species.chromosomes %} + <option value="{{ value }}">{{ name }}</option> + {% endfor %} + </select> + <br> + {% if dataset.group.genotype.Mbmap %} + <label for="scale">Scale: </label> + <select name="scale"> + <option value="megabase">Megabase</option> + <option value="centimorgan">Centimorgan</option> + </select> + {% endif %} + <br> + + <label for="use_permutations" class="checkbox">Permutation Test n= + <input type="checkbox" name="use_permutations" /> + <input name="num_permutations" value="2000" /> + </label> + <label for="use_bootstraps" class="checkbox">Bootstrap Test n= + <input type="checkbox" name="use_bootstraps" /> + <input name="num_bootstraps" value="2000" /> + </label> + + <br> + <label class="checkbox"> + <input type="checkbox" name="use_parents" /> Use Parents + </label> + <label class="checkbox"> + <input type="checkbox" name="use_weighted" /> Use Weighted + </label> + <br> + <input type="button" id="interval_mapping" class="btn" value="Compute"> + </div> + <div class="tab-pane" id="marker_regression"> + <table cellpadding="0" cellspacing="0" width="100%"> + <tr> + <td class="fs12 fwn" nowrap="on" valign="top"> + <table cellpadding="2" cellspacing="0" width="263px"> + <tr> + <td><span class="ffl fwb fs12"><strong>Display LRS greater than:</strong></span></td> + + <td><input type="text" name="suggestive" size="5" maxlength="8"></td> + </tr> + + <tr> + <td><input type="checkbox" name="displayAllLRS" class="checkbox"> <span class="ffl fs12">Display all LRS</span></td> + </tr> + + <tr> + <td><input type="checkbox" name="parentsf14regression2" class="checkbox"> <span class="ffl fs12">Use Parents</span></td> + </tr> + + <tr> + <td><input type="checkbox" name="applyVarianceSE2" class="checkbox"> <span class="ffl fs12">Use Weighted</span></td> + </tr> + </table><br> + <input type="button" name="marker" class="btn" value=" Compute "><br> + <br> + </td> + </tr> + + <tr> + <td valign="top"><span class="fs12"><a href="/glossary.html#" target="_blank">Marker regression</a> computes and displays LRS + values for individual markers.<br> + This function also lists additive effects (phenotype units per allele) and<br> + dominance deviations for some datasets.<br></span><br></td> + </tr> + </table> + </div> + + <div class="tab-pane" id="pair_scan"> + <table cellpadding="0" cellspacing="0" width="100%"> + <tr> + <td class="fs12 fwn" nowrap="on"> + <table cellpadding="2" cellspacing="0" width="232px"> + <tr> + <td><span class="ffl fwb fs12"><strong>Sort by:</strong></span></td> + + <td><select name="graphSort" size="1"> + <option value="0"> + LRS Full + </option> + + <option value="1"> + LRS Interact + </option> + </select></td> + </tr> + + <tr> + <td><span class="ffl fwb fs12"><strong>Return:</strong></span></td> + + <td><select name="pairScanReturn" size="1"> + <option value="50"> + top 50 + </option> + + <option value="100"> + top 100 + </option> + + <option value="200"> + top 200 + </option> + + <option value="500"> + top 500 + </option> + </select></td> + </tr> + </table><br> + <input type="checkbox" name="directPermuCheckbox" class="checkbox" checked><span class="ffl fs12">Permutation Test + (n=500)</span><br> + <br> + <input type="button" class="btn" value=" Compute " onclick="dataEditingFunc(this.form,'directPlot');"><br> + <br> + </td> + </tr> + + <tr> + <td valign="top"><span><a href="/glossary.html#Pair_Scan" target="_blank">Pair-Scan</a> searches for pairs of chromosomal regions + that are<br> + involved in two-locus epistatic interactions.</span><br></td> + </tr> + </table> + </div> + </div> + </div> +</div> + +<!-- <tr> <td valign="top"><span class="fs12"><a href="/glossary.html#intmap" target="_blank">Interval Mapping</a> computes linkage maps for the entire genome or single<br> chromosomes. The <a href="/glossary.html#permutation" target="_blank">Permutation Test</a> estimates suggestive and significant<br> linkage scores. The <a href="/glossary.html#bootstrap" target="_blank">Bootstrap Test</a> estimates the precision of the QTL location.</span><br></td> - </tr> - </table> - </div> - - <div id="mappingtabs-2"> - <table cellpadding="0" cellspacing="0" width="100%"> - <tr> - <td class="fs12 fwn" nowrap="on" valign="top"> - <table cellpadding="2" cellspacing="0" width="263px"> - <tr> - <td><span class="ffl fwb fs12"><strong>Display LRS greater than:</strong></span></td> - - <td><input type="text" name="suggestive" size="5" maxlength="8"></td> - </tr> - - <tr> - <td><input type="checkbox" name="displayAllLRS" class="checkbox"> <span class="ffl fs12">Display all LRS</span></td> - </tr> - - <tr> - <td><input type="checkbox" name="parentsf14regression2" class="checkbox"> <span class="ffl fs12">Use Parents</span></td> - </tr> + </tr> - <tr> - <td><input type="checkbox" name="applyVarianceSE2" class="checkbox"> <span class="ffl fs12">Use Weighted</span></td> - </tr> - </table><br> - <input type="button" name="marker" class="btn" value=" Compute "><br> - <br> - </td> - </tr> - <tr> - <td valign="top"><span class="fs12"><a href="/glossary.html#" target="_blank">Marker regression</a> computes and displays LRS - values for individual markers.<br> - This function also lists additive effects (phenotype units per allele) and<br> - dominance deviations for some datasets.<br></span><br></td> - </tr> - </table> - </div> - <div id="mappingtabs-3"> - <table cellpadding="3" cellspacing="0" width="100%"> - <tr> - <td class="fs12 fwn" nowrap="on" valign="top"> - <table cellpadding="2" cellspacing="0" width="325px"> - <tr> - <td><span class="ffl fwb fs12">Chromosome:</span></td> + <tr> + <td><span class="ffl fwb fs12">Mapping Scale:</span></td> - <td colspan="3"><select name="chromosomes2" size="1"> - <option value="-1"> - All - </option> + <td><select name="scale2" size="1" onchange= + "checkUncheck(window.document.dataInput.scale2.value, window.document.dataInput.permCheck2, window.document.dataInput.bootCheck2)"> + <option value="physic"> + Megabase + </option> - <option value="0"> - 1 - </option> + <option value="morgan"> + Centimorgan + </option> + </select></td> + </tr> - <option value="1"> - 2 - </option> + <tr> + <td><span class="ffl fwb fs12">Control Locus:</span></td> - <option value="2"> - 3 - </option> - - <option value="3"> - 4 - </option> - - <option value="4"> - 5 - </option> - - <option value="5"> - 6 - </option> - - <option value="6"> - 7 - </option> - - <option value="7"> - 8 - </option> - - <option value="8"> - 9 - </option> - - <option value="9"> - 10 - </option> - - <option value="10"> - 11 - </option> - - <option value="11"> - 12 - </option> - - <option value="12"> - 13 - </option> - - <option value="13"> - 14 - </option> - - <option value="14"> - 15 - </option> - - <option value="15"> - 16 - </option> - - <option value="16"> - 17 - </option> - - <option value="17"> - 18 - </option> - - <option value="18"> - 19 - </option> - - <option value="19"> - X - </option> - </select></td> - </tr> - - <tr> - <td><span class="ffl fwb fs12">Mapping Scale:</span></td> - - <td><select name="scale2" size="1" onchange= - "checkUncheck(window.document.dataInput.scale2.value, window.document.dataInput.permCheck2, window.document.dataInput.bootCheck2)"> - <option value="physic"> - Megabase - </option> - - <option value="morgan"> - Centimorgan - </option> - </select></td> - </tr> - - <tr> - <td><span class="ffl fwb fs12">Control Locus:</span></td> - - <td><input type="text" name="controlLocus" class="controlLocus"></td> - </tr> - </table><br> - <input type="checkbox" name="permCheck2" class="checkbox" checked>Permutation Test (n=2000)<br> - <input type="checkbox" name="bootCheck2" class="checkbox">Bootstrap Test (n=2000)<br> - <input type="checkbox" name="parentsf14regression3" class="checkbox">Use Parents<br> - <br> - <input type="button" name="composite" class="btn" value=" Compute "><br> - <br> - </td> - </tr> - - <tr> - <td valign="top"><span><a href="/glossary.html#Composite" target="_blank">Composite Interval Mapping</a> allows you to control - for a single marker as<br> - a cofactor. To find a control marker, run the <strong>Marker Regression</strong> function.</span><br></td> - </tr> - </table> - </div> - - <div id="mappingtabs-4"> - <table cellpadding="0" cellspacing="0" width="100%"> - <tr> - <td class="fs12 fwn" nowrap="on"> - <table cellpadding="2" cellspacing="0" width="232px"> - <tr> - <td><span class="ffl fwb fs12"><strong>Sort by:</strong></span></td> - - <td><select name="graphSort" size="1"> - <option value="0"> - LRS Full - </option> - - <option value="1"> - LRS Interact - </option> - </select></td> - </tr> - - <tr> - <td><span class="ffl fwb fs12"><strong>Return:</strong></span></td> - - <td><select name="pairScanReturn" size="1"> - <option value="50"> - top 50 - </option> - - <option value="100"> - top 100 - </option> - - <option value="200"> - top 200 - </option> - - <option value="500"> - top 500 - </option> - </select></td> - </tr> - </table><br> - <input type="checkbox" name="directPermuCheckbox" class="checkbox" checked><span class="ffl fs12">Permutation Test - (n=500)</span><br> - <br> - <input type="button" class="btn" value=" Compute " onclick="dataEditingFunc(this.form,'directPlot');"><br> - <br> - </td> - </tr> - - <tr> - <td valign="top"><span><a href="/glossary.html#Pair_Scan" target="_blank">Pair-Scan</a> searches for pairs of chromosomal regions - that are<br> - involved in two-locus epistatic interactions.</span><br></td> - </tr> - </table> - </div> - </div> + <td><input type="text" name="controlLocus" class="controlLocus"></td> + </tr> + </table><br> + <input type="checkbox" name="permCheck2" class="checkbox" checked>Permutation Test (n=2000)<br> + <input type="checkbox" name="bootCheck2" class="checkbox">Bootstrap Test (n=2000)<br> + <input type="checkbox" name="parentsf14regression3" class="checkbox">Use Parents<br> + <br> + <input type="button" name="composite" class="btn" value=" Compute "><br> + <br> </td> </tr> - </table> + <tr> + <td valign="top"><span><a href="/glossary.html#Composite" target="_blank">Composite Interval Mapping</a> allows you to control + for a single marker as<br> + a cofactor. To find a control marker, run the <strong>Marker Regression</strong> function.</span><br></td> + </tr> - </div> + + <tr> + <td valign="top"><span><a href="/glossary.html#Pair_Scan" target="_blank">Pair-Scan</a> searches for pairs of chromosomal regions + that are<br> + involved in two-locus epistatic interactions.</span><br></td> + </tr>--> diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py index 70d8cd20..503b0972 100644 --- a/wqflask/wqflask/views.py +++ b/wqflask/wqflask/views.py @@ -160,6 +160,14 @@ def corr_compute_page(): print("Made it to rendering") return render_template("correlation_page.html", **template_vars.__dict__) +@app.route("/int_mapping", methods=('POST',)) +def interval_mapping_page(): + fd = webqtlFormData.webqtlFormData(request.form) + print("Have fd") + template_vars = CorrelationPage.CorrelationPage(fd) + print("Made it to rendering") + return render_template("correlation_page.html", **template_vars.__dict__) + # Todo: Can we simplify this? -Sam def sharing_info_page(): |