From 4622a72a183864d8d085206f948bb67d94602982 Mon Sep 17 00:00:00 2001 From: DannyArends Date: Tue, 7 Feb 2017 16:40:03 +0100 Subject: Adding a new panel to hold the upcomming PheWAS tools --- wqflask/wqflask/templates/show_trait.html | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/templates/show_trait.html b/wqflask/wqflask/templates/show_trait.html index 59e0185e..e5500a7e 100644 --- a/wqflask/wqflask/templates/show_trait.html +++ b/wqflask/wqflask/templates/show_trait.html @@ -92,12 +92,25 @@
Phenotype | Phenosome | Additional | LOD | LODBH |
---|---|---|---|---|
Phenotype 1 | Phenosome 1 | Additional 1 | LOD 1 | BH 1 |
With | Phenosome | Additional | LOD | LODBH | |
---|---|---|---|---|---|
Phenotype | Phenosome | Additional 1 | LOD 1 | BH 1 | Mediate |
GN ID | Phenotype | Phenosome | LOD |
---|---|---|---|
+ {% if c == 4 %} + {{results['phewas3'][c][r]|float|round(2)}} + {% else %} + {{results['phewas3'][c][r]}} + {% endif %} + | + {%- endfor %} + {%- endfor %} + +
GN ID | Phenotype | Phenosome | LOD | |||||||
---|---|---|---|---|---|---|---|---|---|---|
- {% if c == 4 %} - {{results['phewas3'][c][r]|float|round(2)}} + {% if c == 3 %} + {{results['tabulardata'][c][r]|float|round(2)}} {% else %} - {{results['phewas3'][c][r]}} + {{results['tabulardata'][c][r]}} {% endif %} | {%- endfor %} -- cgit v1.2.3 From c465eb3e4b17a3cd3c9ce20d330295c5d1d44567 Mon Sep 17 00:00:00 2001 From: DannyArends Date: Fri, 17 Feb 2017 21:30:41 +0100 Subject: Connecting p.adjust parameters, and updating the region size parameter --- wqflask/wqflask/auwerx/phewas_analysis.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wqflask/wqflask/auwerx/phewas_analysis.py b/wqflask/wqflask/auwerx/phewas_analysis.py index ed2df01f..b9789404 100644 --- a/wqflask/wqflask/auwerx/phewas_analysis.py +++ b/wqflask/wqflask/auwerx/phewas_analysis.py @@ -55,6 +55,8 @@ class PheWAS(object): self.trait_id = requestform["trait_id"] self.datasetname = requestform["dataset"] self.dataset = data_set.create_dataset(self.datasetname) + self.region = int(requestform["num_region"]) + self.mtadjust = str(requestform["sel_mtadjust"]) # Print some debug print "self.trait_id:" + self.trait_id + "\n" @@ -70,7 +72,7 @@ class PheWAS(object): self.mb = int(self.this_trait.mb); # print some debug - print "location:" + self.chr + ":" + str(self.mb) + "\n" + print "location:" + self.chr + ":" + str(self.mb) + "+/-" + str(self.region) + "\n" # Load in the genotypes file *sigh* to make the markermap parser = genofile_parser.ConvertGenoFile(genofilelocation) @@ -92,11 +94,12 @@ class PheWAS(object): self.results = {} self.results['imgurl1'] = webqtlUtil.genRandStr("phewas_") + ".png" self.results['imgloc1'] = GENERATED_IMAGE_DIR + self.results['imgurl1'] + self.results['mtadjust'] = self.mtadjust print("IMAGE AT:", self.results['imgurl1'] ) print("IMAGE AT:", self.results['imgloc1'] ) # Create the PheWAS plot (The gene/probe name, chromosome and gene/probe positions should come from the user input) # TODO: generate the PDF in the temp folder, with a unique name - phewasres = self.r_PheWASManhattan("Test", precompfile, phenoaligner, snpaligner, "None", self.chr, self.mb, self.mb, self.results['imgloc1'] ) + phewasres = self.r_PheWASManhattan("Test", precompfile, phenoaligner, snpaligner, "None", self.chr, self.mb, self.region, self.results['imgloc1'] , self.mtadjust) self.results['phewas1'] = phewasres[0] self.results['phewas2'] = phewasres[1] self.results['tabulardata'] = phewasres[2] -- cgit v1.2.3 From 0c9ec1de388359916abc7386154093fd0d76dbf0 Mon Sep 17 00:00:00 2001 From: DannyArends Date: Fri, 17 Feb 2017 21:31:09 +0100 Subject: Cleaning up the templates, adding the LOC adjusted column --- wqflask/wqflask/templates/phewas_analysis.html | 4 ++-- wqflask/wqflask/templates/show_trait_PheWAS_tools.html | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/wqflask/wqflask/templates/phewas_analysis.html b/wqflask/wqflask/templates/phewas_analysis.html index 4dbc071f..91c47a10 100644 --- a/wqflask/wqflask/templates/phewas_analysis.html +++ b/wqflask/wqflask/templates/phewas_analysis.html @@ -10,12 +10,12 @@ {%- endfor %}
GN ID | Phenotype | Phenosome | LOD | |
---|---|---|---|---|
GN ID | Phenotype | Phenosome | LOD | LOD( {{ results['mtadjust'] }} ) |
- {% if c == 3 %}
+ {% if c >= 3 %}
{{results['tabulardata'][c][r]|float|round(2)}}
{% else %}
{{results['tabulardata'][c][r]}}
diff --git a/wqflask/wqflask/templates/show_trait_PheWAS_tools.html b/wqflask/wqflask/templates/show_trait_PheWAS_tools.html
index d8193652..d4e9ae66 100644
--- a/wqflask/wqflask/templates/show_trait_PheWAS_tools.html
+++ b/wqflask/wqflask/templates/show_trait_PheWAS_tools.html
@@ -17,24 +17,30 @@
PheWAS options: +
-
+
-
+
+
--
cgit v1.2.3
From 1d1c7dd0b4a186df6d71ea7b2859e8ea9b12d38e Mon Sep 17 00:00:00 2001
From: DannyArends
Date: Sat, 4 Mar 2017 10:50:03 +0100
Subject: Minor update to the comments
---
wqflask/wqflask/auwerx/phewas_analysis.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/wqflask/wqflask/auwerx/phewas_analysis.py b/wqflask/wqflask/auwerx/phewas_analysis.py
index b9789404..e9455fba 100644
--- a/wqflask/wqflask/auwerx/phewas_analysis.py
+++ b/wqflask/wqflask/auwerx/phewas_analysis.py
@@ -31,7 +31,7 @@ r_load = ro.r["load"] # Map the head function
r_colnames = ro.r["colnames"] # Map the colnames function
r_list = ro.r["list"] # Map the list function
r_c = ro.r["c"] # Map the c (combine) function
-r_print = ro.r["print"] # Map the c (combine) function
+r_print = ro.r["print"] # Map the print function
r_seq = ro.r["seq"] # Map the rep (repeat) function
class PheWAS(object):
@@ -86,7 +86,6 @@ class PheWAS(object):
rnames = r_seq(1, len(parser.markers))
# Create the snp aligner object out of the BXD genotypes
snpaligner = ro.r.matrix(snpinfo, nrow=len(parser.markers), dimnames = r_list(rnames, r_c("SNP", "Chr", "Pos")), ncol = 3, byrow=True)
- #r_write_table(snpaligner, "~/snpaligner_GN2.txt", row_names=False)
# Create the phenotype aligner object using R
phenoaligner = self.r_create_Pheno_aligner()
--
cgit v1.2.3
From 81c47ad8bc5a0bfe3b8a5f23a599894b24a5da48 Mon Sep 17 00:00:00 2001
From: DannyArends
Date: Sat, 4 Mar 2017 10:50:21 +0100
Subject: Starting integration of the ePheWas tool
---
wqflask/wqflask/auwerx/ephewas_analysis.py | 43 ++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/wqflask/wqflask/auwerx/ephewas_analysis.py b/wqflask/wqflask/auwerx/ephewas_analysis.py
index edfb2801..2f6d6061 100644
--- a/wqflask/wqflask/auwerx/ephewas_analysis.py
+++ b/wqflask/wqflask/auwerx/ephewas_analysis.py
@@ -24,13 +24,56 @@ from utility.tools import locate
from rpy2.robjects.packages import importr
utils = importr("utils")
+r_library = ro.r["library"] # Map the library function
+r_options = ro.r["options"] # Map the options function
+r_write_table = ro.r["write.table"] # Map the write.table function
+r_head = ro.r["head"] # Map the head function
+r_load = ro.r["load"] # Map the head function
+r_colnames = ro.r["colnames"] # Map the colnames function
+r_list = ro.r["list"] # Map the list function
+r_c = ro.r["c"] # Map the c (combine) function
+r_print = ro.r["print"] # Map the print function
+r_seq = ro.r["seq"] # Map the rep (repeat) function
+
class EPheWAS(object):
def __init__(self):
print("Initialization of ePheWAS")
+ print(r_library("auwerx")) # Load the auwerx package
+ self.r_create_Pheno_aligner = ro.r["create.Pheno_aligner"] # Map the create.Pheno_aligner function
+ self.r_data_gatherer = ro.r["data.gatherer"] # Map the data.gatherer function
print("Initialization of ePheWAS done !")
def run_analysis(self, requestform):
print("Starting ePheWAS analysis on dataset")
+ genofilelocation = locate("BXD.geno", "genotype") # Get the location of the BXD genotypes
+ tissuealignerloc = locate("Tissue_color_aligner.csv", "auwerx") # Get the location of the Tissue_color_aligner
+
+ # Get user parameters, trait_id and dataset, and store/update them in self
+ self.trait_id = requestform["trait_id"]
+ self.datasetname = requestform["dataset"]
+ self.dataset = data_set.create_dataset(self.datasetname)
+
+ # Print some debug
+ print "self.trait_id:" + self.trait_id + "\n"
+ print "self.datasetname:" + self.datasetname + "\n"
+ print "self.dataset.type:" + self.dataset.type + "\n"
+
+ # Load in the genotypes file *sigh* to make the markermap
+ parser = genofile_parser.ConvertGenoFile(genofilelocation)
+ parser.process_csv()
+ snpinfo = []
+ for marker in parser.markers:
+ snpinfo.append(marker["name"]);
+ snpinfo.append(marker["chr"]);
+ snpinfo.append(marker["Mb"]);
+
+ rnames = r_seq(1, len(parser.markers))
+ # Create the snp aligner object out of the BXD genotypes
+ snpaligner = ro.r.matrix(snpinfo, nrow=len(parser.markers), dimnames = r_list(rnames, r_c("SNP", "Chr", "Pos")), ncol = 3, byrow=True)
+
+ # Create the phenotype aligner object using R
+ phenoaligner = self.r_create_Pheno_aligner()
+
print("Initialization of ePheWAS done !")
def process_results(self, results):
--
cgit v1.2.3
From 1c9914b07559fa3706f469c94112806455053613 Mon Sep 17 00:00:00 2001
From: DannyArends
Date: Sat, 4 Mar 2017 10:50:44 +0100
Subject: Creating the EPheWas object in python
---
wqflask/wqflask/views.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 047982bf..b49f32d2 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -50,6 +50,7 @@ from wqflask.correlation import corr_scatter_plot
from wqflask.wgcna import wgcna_analysis
from wqflask.ctl import ctl_analysis
from wqflask.auwerx import phewas_analysis
+from wqflask.auwerx import ephewas_analysis
from utility import temp_data
from utility.tools import SQL_URI,TEMPDIR,USE_REDIS,USE_GN_SERVER,GN_SERVER_URL
@@ -258,6 +259,7 @@ def phewas():
@app.route("/ephewas", methods=('POST',))
def ephewas():
logger.info("In ephewas, request.form is:", request.form) # We are going to get additional user input for the analysis
+ ephewasO = ephewas_analysis.EPheWAS() # Start R, load the package and pointers and create the analysis
return render_template("ephewas_analysis.html", **request.form) # Display them using the template
@app.route("/mediation", methods=('POST',))
--
cgit v1.2.3
|