aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/wgcna/wgcna_analysis.py39
1 files changed, 26 insertions, 13 deletions
diff --git a/wqflask/wqflask/wgcna/wgcna_analysis.py b/wqflask/wqflask/wgcna/wgcna_analysis.py
index 45c87d3f..5b6c1c1b 100644
--- a/wqflask/wqflask/wgcna/wgcna_analysis.py
+++ b/wqflask/wqflask/wgcna/wgcna_analysis.py
@@ -20,23 +20,36 @@ r_c = ro.r["c"] # Map the c function
r_seq = ro.r["seq"] # Map the seq function
r_table = ro.r["table"] # Map the table function
r_names = ro.r["names"] # Map the names function
+r_sink = ro.r["sink"] # Map the sink function
+r_file = ro.r["file"] # Map the file function
r_png = ro.r["png"] # Map the png function for plotting
r_dev_off = ro.r["dev.off"] # Map the dev.off function
-
-#TODO: This should only be done once, since it is quite expensive
-print(r_library("WGCNA")) # Load WGCNA
-print(r_options(stringsAsFactors = False))
-
-
-
class WGCNA(object):
- def __init__(self, start_vars):
+ def __init__(self):
print("Initialization of WGCNA")
-
- def run_wgcna(self):
- print("Starting WGCNA analysis")
-
- def process_wgcna_results(self, results):
+ log = r_file("/tmp/genenetwork_wcgna.log", open = "wt")
+ #r_sink(log) # Uncomment the r_sink() commands to log output from stdout/stderr to a file
+ #r_sink(log, type = "message")
+ r_library("WGCNA") # Load WGCNA - Should only be done once, since it is quite expensive
+ r_options(stringsAsFactors = False)
+ print("Initialization of WGCNA done, package loaded in R session")
+ r_enableWGCNAThreads = ro.r["enableWGCNAThreads"] # Map the enableWGCNAThreads function
+ r_pickSoftThreshold = ro.r["pickSoftThreshold"] # Map the pickSoftThreshold function
+ r_blockwiseModules = ro.r["blockwiseModules"] # Map the blockwiseModules function
+ r_labels2colors = ro.r["labels2colors"] # Map the labels2colors function
+ r_plotDendroAndColors = ro.r["plotDendroAndColors"] # Map the plotDendroAndColors function
+ print("Obtained pointers to WGCNA functions")
+
+ def run_analysis(self, requestform):
+ print("Starting WGCNA analysis on dataset")
+ results = {}
+
+ def process_results(self, results):
print("Processing WGCNA output")
+ template_vars = {}
+ template_vars["result"] = "OK"
+ #r_sink(type = "message") # This restores R output to the stdout/stderr
+ #r_sink() # We should end the Rpy session more or less
+ return(dict(template_vars))