about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDannyArends2015-10-08 10:49:23 +0200
committerDannyArends2015-10-08 10:49:23 +0200
commit6d833e9f99ff6275fd1997c6993419a66bbbe392 (patch)
tree9712c97881c54cb7e6827345f65169f9066f6f43
parent2e30a64ca583d990cd46bb9eafdad7d84b46b48d (diff)
downloadgenenetwork2-6d833e9f99ff6275fd1997c6993419a66bbbe392.tar.gz
Massive update to the templates, adding error checking and handling + the eigen genes per module
-rw-r--r--wqflask/wqflask/templates/wgcna_results.html65
-rw-r--r--wqflask/wqflask/templates/wgcna_setup.html19
2 files changed, 61 insertions, 23 deletions
diff --git a/wqflask/wqflask/templates/wgcna_results.html b/wqflask/wqflask/templates/wgcna_results.html
index 077238a5..0dc030b1 100644
--- a/wqflask/wqflask/templates/wgcna_results.html
+++ b/wqflask/wqflask/templates/wgcna_results.html
@@ -4,40 +4,73 @@
 {% block content %} <!-- Start of body -->
   <div class="container">
     <h1>WGCNA Results</h1>
-    <h4>Soft threshold table</h4>
+    Analysis found {{results['nmod']}} modules when scanning {{results['nphe']}} phenotypes, measured on {{results['nstr']}} strains.<br>
+    Additional parameters settings:
+    <ul>
+      <li>Soft thresholds checked = {{results['requestform']['SoftThresholds']}}</li>
+      <li>Power used for this analysis = {{results['Power']}}</li>
+      <li>TomType = {{results['requestform']['TOMtype']}}</li>
+      <li>Minimum module size = {{results['requestform']['MinModuleSize'] }}</li>
+      <li>mergeCutHeight = {{results['requestform']['mergeCutHeight'] }}</li>
+    </ul>
+
+    <h3>Soft threshold table</h3>
     <table width="80%">
       <tr><th>Power</th><th>SFT.R.sq</th><th>slope</th><th>truncated.R.sq</th><th>mean.k</th><th>median.k</th><th>max.k</th><th>Analysis</th></tr>
       {% for r in range(powers[0][0]|length) %}
-        <tr>
+        {% if powers[0][1][r] > 0.85 %}
+        <tr style="color: #00ff00;">
+        {% elif powers[0][1][r] > 0.75 %}
+        <tr style="color: #aaaa00;">
+        {% else %}
+        <tr style="color: #ff0000;">
+        {% endif %}
         {% for c in range(powers[0]|length) %}
         <td>{{powers[0][c][r]|round(3)}}</td>
        {% endfor %}
-        <td><input type="submit" value="Redo use power = {{powers[0][0][r]}}" /></td></tr>
+        <td style="color: #000000;">
+          {% if powers[0][1][r] > 0.75 %}
+          <input type="submit" value="Redo use power = {{powers[0][0][r]}}" /></td>
+          {% endif %}
+        </tr>
     {% endfor %}
     </table>
+    <h3>WGCNA module plot</h3>
+                <a href="/tmp/{{ results['imgurl'] }}">
+                    <img alt="Embedded Image" src="data:image/png;base64,
+                    {% for elem in results['imgdata'] -%}
+                    {% print("%c"|format(elem)) %}
+                    {%- endfor %}
+                    " /></a>
 
-    <h4>Phenotype / Module table</h4>
 
-    debug: {{results['network']|length}}
-    debug: {{results['network'][0]|length}}
-    {{phenotypes[0][0]}}
+    <h3>Phenotype / Module table</h3>
     <table width="80%">
       <tr><th>Phenotype</th><th>Module</th></tr>
-      {% for r in range(results['network'][0]|length) %}
+      {% for r in range(results['nphe']) %}
         <tr>
-          <td>{{phenotypes[r][0]}}</td>
+          <td>{{results['phenotypes'][r][0]}}</td>
           <td>{{results['network'][0][r]}}</td>
         </tr>
     {% endfor %}
     </table>
 
-    <h2>WGCNA module plot</h2>
-                <a href="/tmp/{{ results['imgurl'] }}">
-                    <img alt="Embedded Image" src="data:image/png;base64,
-                    {% for elem in results['imgdata'] -%}
-                    {% print("%c"|format(elem)) %}
-                    {%- endfor %}
-                    " /></a>
+    <h3>Module eigen genes</h3>
+    <table width="80%">
+      <tr><th>Phenotype</th>
+      {% for m in range(results['nmod']) %}
+        <th><input type="submit" value="Add module {{m}} to collection" /></th>
+      {% endfor %}
+      </tr>
+      {% for r in range(results['nstr']) %}
+        <tr>
+          <td>{{results['strains'][r][0]}}</td>
+          {% for m in range(results['nmod']) %}
+          <td>{{results['network'][2][m][r]}}</td>
+          {% endfor %}
+        </tr>
+    {% endfor %}
+    </table>
   </div>
 {% endblock %}
 
diff --git a/wqflask/wqflask/templates/wgcna_setup.html b/wqflask/wqflask/templates/wgcna_setup.html
index 821e4954..49181938 100644
--- a/wqflask/wqflask/templates/wgcna_setup.html
+++ b/wqflask/wqflask/templates/wgcna_setup.html
@@ -6,17 +6,22 @@
   <div class="container">
 
     <h1>WGCNA analysis parameters</h1>
-    Phenotypes used as input: {{request.form}}
-    <input type="hidden" name="trait_list" id="trait_list" value= "{{request.form['trait_list']}}">
+    {% if request.form['trait_list'].split(",")|length <= 4 %}
+
+      <h2 style="color: #ff0000;">ERROR: Too few phenotypes as input</h2>
+      Please make sure you select enough phenotypes / genes to perform WGCNA, 
+      your collection needs to contain at least 4 different phenotypes. You provided {{request.form['trait_list'].split(',')|length}} phenotypes as input
 
+    {% else %}
+    <input type="hidden" name="trait_list" id="trait_list" value= "{{request.form['trait_list']}}">
     <table>
-      <tr><td>Soft threshold:</td><td><input type="text" class="form-inline" id="SoftThreshold", value="1,2,3,4,5,6,7,8,9"></td></tr>
-      <tr><td>Power:</td><td><input type="text" class="form-inline" id="Power", value="6"></td></tr>
-      <tr><td>Minimum module size:</td><td><input type="text" class="form-inline" id="MinModuleSize", value="30"></td></tr>
-      <tr><td>TOMtype:</td><td><input type="text" class="form-inline" id="TOMtype", value="unsigned"></td></tr>
-      <tr><td>mergeCutHeight:</td><td><input type="text" class="form-inline" id="mergeCutHeight", value="0.25"></td></tr>
+      <tr><td>Soft threshold:</td><td><input type="text" class="form-inline" name="SoftThresholds" id="SoftThresholds" value="1,2,3,4,5,6,7,8,9"></td></tr>
+      <tr><td>Minimum module size:</td><td><input type="text" class="form-inline" name="MinModuleSize" id="MinModuleSize" value="30"></td></tr>
+      <tr><td>TOMtype:</td><td><input type="text" class="form-inline" name="TOMtype" id="TOMtype" value="unsigned"></td></tr>
+      <tr><td>mergeCutHeight:</td><td><input type="text" class="form-inline" name="mergeCutHeight" id="mergeCutHeight" value="0.25"></td></tr>
     </table>
     <input type="submit" class="btn btn-primary" value="Run WGCNA using these settings" />
+    {% endif %}
   </div>
 </form>
 {% endblock %}