From 1263f44f7ddfaeeed5e32bfb30248e3ce5cf3adf Mon Sep 17 00:00:00 2001 From: DannyArends Date: Fri, 11 Sep 2015 18:27:21 +0200 Subject: Start R and load the WGCNA library in wgcna_analysis.py --- wqflask/wqflask/wgcna/wgcna_analysis.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'wqflask') 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 + +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): -- cgit v1.2.3