aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDannyArends2016-03-24 22:08:44 +0100
committerPjotr Prins2016-04-20 10:18:41 +0000
commit1053764068a50e2b95e0f0b07cb4111369ce8ff8 (patch)
tree883009bbd40f87cbd11d8a2b8dee53c5cdfd84e5
parent1f32d6a71beec407ffdf0ef5b17240ee07d68939 (diff)
downloadgenenetwork2-1053764068a50e2b95e0f0b07cb4111369ce8ff8.tar.gz
Adding parameters, and passing them to the CTL algorithm
-rw-r--r--wqflask/wqflask/ctl/ctl_analysis.py26
-rw-r--r--wqflask/wqflask/templates/ctl_setup.html46
2 files changed, 65 insertions, 7 deletions
diff --git a/wqflask/wqflask/ctl/ctl_analysis.py b/wqflask/wqflask/ctl/ctl_analysis.py
index 44bade5c..77e34143 100644
--- a/wqflask/wqflask/ctl/ctl_analysis.py
+++ b/wqflask/wqflask/ctl/ctl_analysis.py
@@ -79,6 +79,18 @@ class CTL(object):
self.trait_db_list = [trait.strip() for trait in requestform['trait_list'].split(',')]
self.trait_db_list = [x for x in self.trait_db_list if x]
+ print("strategy:", requestform.get("strategy"))
+ strategy = requestform.get("strategy")
+
+ print("nperm:", requestform.get("nperm"))
+ nperm = int(requestform.get("nperm"))
+
+ print("parametric:", requestform.get("parametric"))
+ parametric = bool(requestform.get("parametric"))
+
+ print("significance:", requestform.get("significance"))
+ significance = float(requestform.get("significance"))
+
# Get the name of the .geno file belonging to the first phenotype
datasetname = self.trait_db_list[0].split(":")[1]
dataset = data_set.create_dataset(datasetname)
@@ -120,26 +132,26 @@ class CTL(object):
rPheno = r_data_frame(rPheno)
rGeno = r_data_frame(rGeno)
- r_write_table(rGeno, "~/outputGN/geno.csv")
- r_write_table(rPheno, "~/outputGN/pheno.csv")
+ # Debug: Print the genotype and phenotype files to disk
+ #r_write_table(rGeno, "~/outputGN/geno.csv")
+ #r_write_table(rPheno, "~/outputGN/pheno.csv")
# Perform the CTL scan
- res = self.r_CTLscan(rGeno, rPheno, ncores = 6)
+ res = self.r_CTLscan(rGeno, rPheno, strategy = strategy, nperm = nperm, parametric = parametric, ncores = 6)
# Get significant interactions
- significant = self.r_CTLsignificant(res)
-
- print(significant[0])
+ significant = self.r_CTLsignificant(res, significance = significance)
# Create an image for output
self.results = {}
self.results['imgurl'] = webqtlUtil.genRandStr("WGCNAoutput_") + ".png"
self.results['imgloc'] = GENERATED_IMAGE_DIR + self.results['imgurl']
self.results['ctlresult'] = significant
+ self.results['requestform'] = requestform # Store the user specified parameters for the output page
# Create the lineplot
r_png(self.results['imgloc'], width=1000, height=600)
- self.r_lineplot(res)
+ self.r_lineplot(res, significance = significance)
r_dev_off()
# Flush any output from R
diff --git a/wqflask/wqflask/templates/ctl_setup.html b/wqflask/wqflask/templates/ctl_setup.html
index 0ba281c6..9c0d7bea 100644
--- a/wqflask/wqflask/templates/ctl_setup.html
+++ b/wqflask/wqflask/templates/ctl_setup.html
@@ -8,11 +8,57 @@
<form action="/ctl_results" method="post" class="form-horizontal">
<input type="hidden" name="trait_list" id="trait_list" value= "{{request.form['trait_list']}}">
+
+ <div class="dropdown">
+ <label for="Strategy">Strategy</label>
+ <div class="col-sm-10">
+ <select name="strategy" id="strategy">
+ <option value="Exact">Exact</option>
+ <option value="Full">Full</option>
+ <option value="Pairwise">Pairwise</option>
+ </select>
+ </div>
+ </div>
+
+ <div class="dropdown">
+ <label for="Permutations">Number of permutation (Used when strategy is Full or Pairwise)</label>
+ <div class="col-sm-10">
+ <select name="nperm" id="nperm">
+ <option value="100">100</option>
+ <option value="1000" selected="selected">1000</option>
+ <option value="10000">10000</option>
+ </select>
+ </div>
+ </div>
+
+ <div class="dropdown">
+ <label for="Coefficient">Type of correlation coefficient</label>
+ <div class="col-sm-10">
+ <select name="parametric" id="parametric">
+ <option value="False">Spearman</option>
+ <option value="True">Pearson</option>
+ </select>
+ </div>
+ </div>
+
+
+ <div class="dropdown">
+ <label for="Significance">Significance level</label>
+ <div class="col-sm-10">
+ <select name="significance" id="significance">
+ <option value="0.1">0.1</option>
+ <option value="0.05" selected="selected">0.05</option>
+ <option value="0.001">0.001</option>
+ </select>
+ </div>
+ </div>
+ <br>
<div class="form-group">
<div class="col-sm-10">
<input type="submit" class="btn btn-primary" value="Run CTL using these settings" />
</div>
</div>
+
</form>
</div>