aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorDannyArends2015-09-11 18:27:21 +0200
committerDannyArends2015-09-11 18:27:21 +0200
commit1263f44f7ddfaeeed5e32bfb30248e3ce5cf3adf (patch)
tree98293775d39fa27e238b6e75179ebe61d3b9fc26 /wqflask
parente48f0d98a74152908e3924b4d660fae639471a8b (diff)
downloadgenenetwork2-1263f44f7ddfaeeed5e32bfb30248e3ce5cf3adf.tar.gz
Start R and load the WGCNA library in wgcna_analysis.py
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/wgcna/wgcna_analysis.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/wqflask/wqflask/wgcna/wgcna_analysis.py b/wqflask/wqflask/wgcna/wgcna_analysis.py
index 824b943c..45c87d3f 100644
--- a/wqflask/wqflask/wgcna/wgcna_analysis.py
+++ b/wqflask/wqflask/wgcna/wgcna_analysis.py
@@ -1,3 +1,33 @@
+# WGCNA analysis for GN2
+# Author / Maintainer: Danny Arends <Danny.Arends@gmail.com>
+
+from numpy import *
+from pandas import *
+
+import scipy as sp # SciPy
+import rpy2.robjects as ro # R Objects
+import pandas.rpy.common as com # R common functions
+
+from rpy2.robjects.packages import importr
+utils = importr("utils")
+
+## Get pointers to some common R functions
+r_library = ro.r["library"] # Map the library function
+r_options = ro.r["options"] # Map the options function
+r_read_csv = ro.r["read.csv"] # Map the read.csv function
+r_dim = ro.r["dim"] # Map the dim function
+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_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):