From e6afa39ac0bf769bed181ad9e16fc4fc8e16bb22 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Mon, 22 May 2017 15:48:25 +0000
Subject: Added print lines showing url to views.py and updated dataset menu
json file
---
.../new/javascript/dataset_menu_structure.json | 284 +++++++++++++++++----
wqflask/wqflask/views.py | 34 ++-
2 files changed, 264 insertions(+), 54 deletions(-)
(limited to 'wqflask')
diff --git a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
index 861af3d6..f3712b5d 100644
--- a/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
+++ b/wqflask/wqflask/static/new/javascript/dataset_menu_structure.json
@@ -1339,15 +1339,15 @@
"HLC_0311",
"GSE9588 Human Liver Normal (Mar11) Both Sexes"
],
- [
- "384",
- "HLCF_0311",
- "GSE9588 Human Liver Normal (Mar11) Females"
- ],
[
"383",
"HLCM_0311",
"GSE9588 Human Liver Normal (Mar11) Males"
+ ],
+ [
+ "384",
+ "HLCF_0311",
+ "GSE9588 Human Liver Normal (Mar11) Females"
]
],
"Phenotypes": [
@@ -1493,6 +1493,15 @@
]
]
},
+ "Islets-Gerling": {
+ "Phenotypes": [
+ [
+ "None",
+ "Islets-GerlingPublish",
+ "Islets-Gerling Published Phenotypes"
+ ]
+ ]
+ },
"TIGEM-Retina-RNA-Seq": {
"Phenotypes": [
[
@@ -1560,6 +1569,11 @@
]
],
"Heart mRNA": [
+ [
+ "820",
+ "UCLA_AXB_BXA_Aor_Jan16",
+ "UCLA AXB/BXA Aorta Affy M430 2.0 (Jan16) RMA"
+ ],
[
"421",
"IRCM_AXBXA_HRI0213",
@@ -1567,6 +1581,11 @@
]
],
"Liver mRNA": [
+ [
+ "822",
+ "UCLA_AXB_BXA_Liv_Jan16",
+ "UCLA AXB/BXA Liver Affy M430 2.0 (Jan16) RMA"
+ ],
[
"352",
"GSE16780AB_UCLA_ML0911",
@@ -1726,11 +1745,6 @@
]
],
"Striatum mRNA": [
- [
- "85",
- "SA_M2_0905_P",
- "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) PDNN"
- ],
[
"84",
"SA_M2_0905_R",
@@ -1740,21 +1754,26 @@
"83",
"SA_M2_0905_M",
"OHSU/VA B6D2F2 Striatum M430v2 (Sep05) MAS5"
+ ],
+ [
+ "85",
+ "SA_M2_0905_P",
+ "OHSU/VA B6D2F2 Striatum M430v2 (Sep05) PDNN"
]
]
},
"BHF2": {
"Adipose mRNA": [
- [
- "197",
- "UCLA_BHF2_ADIPOSE_FEMALE",
- "UCLA BHF2 Adipose Female mlratio"
- ],
[
"196",
"UCLA_BHF2_ADIPOSE_MALE",
"UCLA BHF2 Adipose Male mlratio"
],
+ [
+ "197",
+ "UCLA_BHF2_ADIPOSE_FEMALE",
+ "UCLA BHF2 Adipose Female mlratio"
+ ],
[
"165",
"UCLA_BHF2_ADIPOSE_0605",
@@ -1762,16 +1781,16 @@
]
],
"Brain mRNA": [
- [
- "199",
- "UCLA_BHF2_BRAIN_FEMALE",
- "UCLA BHF2 Brain Female mlratio"
- ],
[
"198",
"UCLA_BHF2_BRAIN_MALE",
"UCLA BHF2 Brain Male mlratio"
],
+ [
+ "199",
+ "UCLA_BHF2_BRAIN_FEMALE",
+ "UCLA BHF2 Brain Female mlratio"
+ ],
[
"166",
"UCLA_BHF2_BRAIN_0605",
@@ -1786,16 +1805,16 @@
]
],
"Liver mRNA": [
- [
- "201",
- "UCLA_BHF2_LIVER_FEMALE",
- "UCLA BHF2 Liver Female mlratio"
- ],
[
"200",
"UCLA_BHF2_LIVER_MALE",
"UCLA BHF2 Liver Male mlratio"
],
+ [
+ "201",
+ "UCLA_BHF2_LIVER_FEMALE",
+ "UCLA BHF2 Liver Female mlratio"
+ ],
[
"167",
"UCLA_BHF2_LIVER_0605",
@@ -1999,11 +2018,6 @@
"BR_U_1105_P",
"UTHSC Brain mRNA U74Av2 (Nov05) PDNN"
],
- [
- "81",
- "BR_U_0805_P",
- "UTHSC Brain mRNA U74Av2 (Aug05) PDNN"
- ],
[
"80",
"BR_U_0805_M",
@@ -2014,6 +2028,11 @@
"BR_U_0805_R",
"UTHSC Brain mRNA U74Av2 (Aug05) RMA"
],
+ [
+ "81",
+ "BR_U_0805_P",
+ "UTHSC Brain mRNA U74Av2 (Aug05) PDNN"
+ ],
[
"42",
"CB_M_0204_P",
@@ -2142,6 +2161,13 @@
"BXD Genotypes"
]
],
+ "Heart mRNA": [
+ [
+ "819",
+ "UCLA_BXD_Aor_Jan16",
+ "UCLA BXD Aorta Affy M430 2.0 (Jan16) RMA"
+ ]
+ ],
"Hematopoietic Cells mRNA": [
[
"149",
@@ -2217,6 +2243,26 @@
"UMUTAffyExon_0209_RMA",
"UMUTAffy Hippocampus Exon (Feb09) RMA"
],
+ [
+ "814",
+ "UTHSC_ILM_BXD_hipp_NOSb_0217",
+ "UTHSC BXD Hippocampus ILM v6.1 NOS Balanced (Feb17) RankInv"
+ ],
+ [
+ "815",
+ "UTHSC_ILM_BXD_hipp_NOEb_0217",
+ "UTHSC BXD Hippocampus ILM v6.1 NOE Balanced (Feb17) RankInv"
+ ],
+ [
+ "816",
+ "UTHSC_ILM_BXD_hipp_RSSb_0217",
+ "UTHSC BXD Hippocampus ILM v6.1 RSS Balanced (Feb17) RankInv"
+ ],
+ [
+ "817",
+ "UTHSC_ILM_BXD_hipp_RSEb_0217",
+ "UTHSC BXD Hippocampus ILM v6.1 RSE Balanced (Feb17) RankInv"
+ ],
[
"780",
"UTHSC_ILM_BXD_hipp_NOEb_0216",
@@ -2390,15 +2436,25 @@
]
],
"Liver Proteome": [
+ [
+ "540",
+ "EPFLETHZBXDprotCD0514",
+ "EPFL/ETHZ BXD Liver, Chow Diet (Jun16) Top100 SWATH"
+ ],
+ [
+ "541",
+ "EPFLETHZBXDprotHFD0514",
+ "EPFL/ETHZ BXD Liver, High Fat Diet (Jun16) Top100 SWATH"
+ ],
[
"704",
"EPFLETHZBXDprotCD_LS1114",
- "EPFL/ETHZ BXD Liver, Chow Diet (Oct14) Light SWATH"
+ "EPFL/ETHZ BXD Liver, Chow Diet (Oct14) Top10 SWATH"
],
[
"705",
"EPFLETHZBXDprotHF_LS1114",
- "EPFL/ETHZ BXD Liver, High Fat Diet (Oct14) Light SWATH"
+ "EPFL/ETHZ BXD Liver, High Fat Diet Diet (Oct14) Top10 SWATH"
],
[
"703",
@@ -2414,19 +2470,14 @@
"489",
"EPFLBXDprotHFDRPN0214",
"EPFL/LISP BXD Liver, Soluble Proteins HFD (Feb14) SRM"
- ],
- [
- "540",
- "EPFLETHZBXDprotCD0514",
- "EPFL/ETHZ BXD Liver, Soluble Proteins CD (Jun14) SWATH"
- ],
- [
- "541",
- "EPFLETHZBXDprotHFD0514",
- "EPFL/ETHZ BXD Liver, Soluble Proteins HFD (Jun14) SWATH"
]
],
"Liver mRNA": [
+ [
+ "818",
+ "UCLA_BXD_Liv_Jan16",
+ "UCLA BXD Liver Affy M430 2.0 (Jan16) RMA"
+ ],
[
"430",
"EPFLMouseLiverRMA0413",
@@ -2442,6 +2493,11 @@
"EPFLMouseLiverCDRMA0413",
"EPFL/LISP BXD CD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA"
],
+ [
+ "433",
+ "EPFLMouseLiverBothExRMA0413",
+ "EPFL/LISP BXD CD+HFD Liver Affy Mouse Gene 1.0 ST (Apr13) RMA Exon Level"
+ ],
[
"700",
"UTHSC-VGX_MmBXDHepatocytesRMA1014",
@@ -2466,6 +2522,51 @@
"702",
"SUH_Liv_RMAEx_0611",
"SUH BXD Liver CCl4-treated Affy Mouse Gene 1.0 ST Exon Level (Jun11) RMA"
+ ],
+ [
+ "256",
+ "GenEx_BXD_liverEt_M5_0912",
+ "GenEx BXD EtOH Liver Affy M430 2.0 (Sep12) MAS5 Both Sexes"
+ ],
+ [
+ "257",
+ "GenEx_BXD_liverEt_M5M_0912",
+ "GenEx BXD EtOH Liver Affy M430 2.0 (Sep12) MAS5 Males"
+ ],
+ [
+ "258",
+ "GenEx_BXD_liverEt_M5F_0912",
+ "GenEx BXD EtOH Liver Affy M430 2.0 (Sep12) MAS5 Females"
+ ],
+ [
+ "307",
+ "GenEx_BXD_liverEt_RMA_0211",
+ "GenEx BXD EtOH Liver Affy M430 2.0 (Feb11) RMA Both Sexes"
+ ],
+ [
+ "308",
+ "GenEx_BXD_liverEt_RMA_M_0211",
+ "GenEx BXD EtOH Liver Affy M430 2.0 (Feb11) RMA Males"
+ ],
+ [
+ "309",
+ "GenEx_BXD_liverEt_RMA_F_0211",
+ "GenEx BXD EtOH Liver Affy M430 2.0 (Feb11) RMA Females"
+ ],
+ [
+ "310",
+ "GenEx_BXD_liverSal_RMA_0211",
+ "GenEx BXD Sal Liver Affy M430 2.0 (Feb11) RMA Both Sexes"
+ ],
+ [
+ "311",
+ "GenEx_BXD_liverSal_RMA_M_0211",
+ "GenEx BXD Sal Liver Affy M430 2.0 (Feb11) RMA Males"
+ ],
+ [
+ "312",
+ "GenEx_BXD_liverSal_RMA_F_0211",
+ "GenEx BXD Sal Liver Affy M430 2.0 (Feb11) RMA Females"
]
],
"Lung mRNA": [
@@ -2545,15 +2646,15 @@
"HQFNeoc_0208_RankInv",
"HQF BXD Neocortex ILM6v1.1 (Feb08) RankInv"
],
- [
- "275",
- "DevNeocortex_ILM6.2P14RInv_1110",
- "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov10) RankInv"
- ],
[
"274",
"DevNeocortex_ILM6.2P3RInv_1110",
"BIDMC/UTHSC Dev Neocortex P3 ILMv6.2 (Nov10) RankInv"
+ ],
+ [
+ "275",
+ "DevNeocortex_ILM6.2P14RInv_1110",
+ "BIDMC/UTHSC Dev Neocortex P14 ILMv6.2 (Nov10) RankInv"
]
],
"Nucleus Accumbens mRNA": [
@@ -2760,11 +2861,6 @@
]
],
"Ventral Tegmental Area mRNA": [
- [
- "230",
- "VCUEtvsSal_0609_R",
- "VCU BXD VTA Et vs Sal M430 2.0 (Jun09) RMA"
- ],
[
"229",
"VCUEtOH_0609_R",
@@ -2774,6 +2870,11 @@
"228",
"VCUSal_0609_R",
"VCU BXD VTA Sal M430 2.0 (Jun09) RMA"
+ ],
+ [
+ "230",
+ "VCUEtvsSal_0609_R",
+ "VCU BXD VTA Et vs Sal M430 2.0 (Jun09) RMA"
]
]
},
@@ -2920,6 +3021,27 @@
]
]
},
+ "CIE-RMA": {
+ "Midbrain mRNA": [
+ [
+ "830",
+ "INIA_UTHSC_Mid_AffyMTA1_Apr17",
+ "INIA-UTHSC Midbrain CIE Affy MTA 1.0 GeneLevel (Apr17) RMA"
+ ],
+ [
+ "834",
+ "INIA_UTHSC_Mid_AffyMTA1_Ex_May17",
+ "INIA-UTHSC Midbrain CIE Affy MTA 1.0 Exon Level (Apr17) RMA"
+ ]
+ ],
+ "Phenotypes": [
+ [
+ "None",
+ "CIE-RMAPublish",
+ "CIE-RMA Published Phenotypes"
+ ]
+ ]
+ },
"CMS": {
"Phenotypes": [
[
@@ -3021,6 +3143,13 @@
"CXB Genotypes"
]
],
+ "Heart mRNA": [
+ [
+ "821",
+ "UCLA_CXB_Aor_Jan16",
+ "UCLA CXB Aorta Affy M430 2.0 (Jan16) RMA"
+ ]
+ ],
"Hippocampus mRNA": [
[
"100",
@@ -3033,6 +3162,13 @@
"Hippocampus Consortium M430v2 CXB (Dec05) PDNN"
]
],
+ "Liver mRNA": [
+ [
+ "823",
+ "UCLA_CXB_Liv_Jan16",
+ "UCLA CXB Liver Affy M430 2.0 (Jan16) RMA"
+ ]
+ ],
"Phenotypes": [
[
"628",
@@ -3048,6 +3184,7 @@
]
]
},
+ "EMSR": {},
"HS": {
"Hippocampus mRNA": [
[
@@ -3544,6 +3681,10 @@
"HSB",
"Brain, Development: Normal Gene Expression (Yale/Sestan)"
],
+ [
+ "Islets-Gerling",
+ "Pancreatic: Islets (UTHSC/Gerling)"
+ ],
[
"TIGEM-Retina-RNA-Seq",
"Retina: Normal Adult Gene Expression, RNA-Seq (TIGEM)"
@@ -3616,7 +3757,11 @@
],
[
"CIE-INIA",
- "Chronic Intermittent Ethanol"
+ "Chronic Intermittent Ethanol Phase 1"
+ ],
+ [
+ "CIE-RMA",
+ "Chronic Intermittent Ethanol Phase 2"
],
[
"CMS",
@@ -3630,6 +3775,10 @@
"CXB",
"CXB"
],
+ [
+ "EMSR",
+ "Ethanol-Medicated Stress Reduction"
+ ],
[
"HS",
"Heterogeneous Stock"
@@ -4414,6 +4563,12 @@
"Ventrolateral Prefrontal Cortex mRNA"
]
],
+ "Islets-Gerling": [
+ [
+ "Phenotypes",
+ "Phenotypes"
+ ]
+ ],
"TIGEM-Retina-RNA-Seq": [
[
"Phenotypes",
@@ -4629,6 +4784,10 @@
"Gastrointestinal mRNA",
"Gastrointestinal mRNA"
],
+ [
+ "Heart mRNA",
+ "Heart mRNA"
+ ],
[
"Hematopoietic Cells mRNA",
"Hematopoietic Cells mRNA"
@@ -4780,6 +4939,16 @@
"LCM Brain Regions mRNA"
]
],
+ "CIE-RMA": [
+ [
+ "Phenotypes",
+ "Phenotypes"
+ ],
+ [
+ "Midbrain mRNA",
+ "Midbrain mRNA"
+ ]
+ ],
"CMS": [
[
"Phenotypes",
@@ -4821,15 +4990,24 @@
"Genotypes",
"Genotypes"
],
+ [
+ "Heart mRNA",
+ "Heart mRNA"
+ ],
[
"Hippocampus mRNA",
"Hippocampus mRNA"
],
+ [
+ "Liver mRNA",
+ "Liver mRNA"
+ ],
[
"Spleen mRNA",
"Spleen mRNA"
]
],
+ "EMSR": [],
"HS": [
[
"Phenotypes",
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 39f4a686..24a7cbca 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -71,6 +71,8 @@ import werkzeug
import utility.logger
logger = utility.logger.getLogger(__name__ )
+
+
@app.before_request
def connect_db():
db = getattr(g, '_database', None)
@@ -120,6 +122,7 @@ def handle_bad_request(e):
@app.route("/")
def index_page():
logger.info("Sending index_page")
+ logger.error(request.url)
params = request.args
if 'import_collections' in params:
import_collections = params['import_collections']
@@ -137,6 +140,7 @@ def index_page():
def tmp_page(img_path):
logger.info("In tmp_page")
logger.info("img_path:", img_path)
+ logger.error(request.url)
initial_start_vars = request.form
logger.info("initial_start_vars:", initial_start_vars)
imgfile = open(GENERATED_IMAGE_DIR + img_path, 'rb')
@@ -170,6 +174,7 @@ def bd_files(filename):
@app.route("/search", methods=('GET',))
def search_page():
logger.info("in search_page")
+ logger.error(request.url)
if 'info_database' in request.args:
logger.info("Going to sharing_info_page")
template_vars = sharing_info_page()
@@ -208,6 +213,7 @@ def search_page():
@app.route("/gsearch", methods=('GET',))
def gsearchact():
+ logger.error(request.url)
result = gsearch.GSearch(request.args).__dict__
type = request.args['type']
if type == "gene":
@@ -218,6 +224,7 @@ def gsearchact():
@app.route("/gsearch_updating", methods=('POST',))
def gsearch_updating():
logger.info("REQUEST ARGS:", request.values)
+ logger.error(request.url)
result = update_search_results.GSearch(request.args).__dict__
return result['results']
# type = request.args['type']
@@ -228,26 +235,31 @@ def gsearch_updating():
@app.route("/docedit")
def docedit():
+ logger.error(request.url)
doc = docs.Docs(request.args['entry'])
return render_template("docedit.html", **doc.__dict__)
@app.route('/generated/
0
- +/- 1
+
+ +/- 1
@@ -82,20 +83,6 @@
-
-
-
-
-
-
-
-
-
--
cgit v1.2.3
From 6c3edf38ecc6549bc2cdf3893067d64a0a8e0ba3 Mon Sep 17 00:00:00 2001
From: zsloan
Date: Wed, 31 May 2017 16:01:21 +0000
Subject: Added various tool options to correlation results page and improved
table appearance for mRNA assay data sets (still need to improve it for
others)
Fixed minor logic issue in trait.py
---
wqflask/base/trait.py | 2 +
wqflask/wqflask/templates/correlation_page.html | 152 +++++++++++++++++++++---
2 files changed, 137 insertions(+), 17 deletions(-)
(limited to 'wqflask')
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index e22a51e4..33a4efe9 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -206,6 +206,8 @@ class GeneralTrait(object):
formatted = self.description
if self.probe_target_description:
formatted += "; " + self.probe_target_description
+ else:
+ formatted = "Not available"
elif self.dataset.type == 'Publish':
if self.confidential:
formatted = self.pre_publication_description
diff --git a/wqflask/wqflask/templates/correlation_page.html b/wqflask/wqflask/templates/correlation_page.html
index f5fe2120..fbf373f6 100644
--- a/wqflask/wqflask/templates/correlation_page.html
+++ b/wqflask/wqflask/templates/correlation_page.html
@@ -21,6 +21,35 @@
and analysis page.
-
-
-
-
-
@@ -99,7 +129,7 @@ | |||||||
---|---|---|---|---|---|---|---|
+ | {{ loop.index }} | {{ trait.location_repr }} | +{{ trait.location_repr }} | {{ '%0.3f' % trait.mean|float }} | {% if trait.LRS_score_repr != "N/A" %}{{ '%0.1f' % trait.LRS_score_repr|float }}{% else %}N/A{% endif %} | {{ trait.LRS_location_repr }} | @@ -167,8 +197,6 @@ - - -- cgit v1.2.3 From be458ca49557b93d2e5b8a0407d42f0a2fe9673f Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 9 Jun 2017 17:19:36 +0000 Subject: - Changed the way the genofile is set so different genofiles can be selected for mapping - Now shows error page for Correlation Matrix if traits aren't all from the same group (later need to make it check for shared samples, since different groups may contain some of the same samples - Mapping results page now displays the genofile in the information section - Only show Interval Analyst if species is mouse or rat (previously it would show a blank table for other species) - Network Graph now only shows links in a node's info if the relevant information (for example geneid) exists, and the label changes depending on the type of data set - Other minor changes to the appearance of the Network Graph menu (less white space, plus clickable descriptions for a couple options) - Improved Correlations Results page to shorten Description and Authors cell content for Phenotype traits (to keep table width manageable) - Changed the glossary links for LRS and Additive Effect columns for Gene Global Search - Improved appearance for Phenotype Global Search results - Temporarily removed Mapping options/features that don't work from the trait page --- wqflask/base/data_set.py | 7 +- .../wqflask/correlation_matrix/show_corr_matrix.py | 163 +++++++++++---------- .../wqflask/marker_regression/marker_regression.py | 11 +- .../marker_regression/marker_regression_gn1.py | 2 + wqflask/wqflask/network_graph/network_graph.py | 22 ++- wqflask/wqflask/static/new/css/network_graph.css | 1 - .../wqflask/static/new/javascript/network_graph.js | 16 +- wqflask/wqflask/templates/correlation_matrix.html | 16 +- wqflask/wqflask/templates/correlation_page.html | 13 +- wqflask/wqflask/templates/empty_collection.html | 15 -- wqflask/wqflask/templates/gsearch_gene.html | 12 +- wqflask/wqflask/templates/gsearch_pheno.html | 76 +++++----- .../wqflask/templates/marker_regression_gn1.html | 13 +- wqflask/wqflask/templates/network_graph.html | 23 ++- .../templates/show_trait_mapping_tools.html | 26 +--- 15 files changed, 213 insertions(+), 203 deletions(-) delete mode 100644 wqflask/wqflask/templates/empty_collection.html (limited to 'wqflask') diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 4959457a..dbdbb51c 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -169,7 +169,7 @@ def mescape(*items): class Markers(object): """Todo: Build in cacheing so it saves us reading the same file more than once""" def __init__(self, name): - json_data_fh = open(locate(name + '.json','genotype/json')) + json_data_fh = open(locate(name + ".json",'genotype/json')) try: markers = json.load(json_data_fh) except: @@ -334,7 +334,10 @@ class DatasetGroup(object): else: marker_class = Markers - self.markers = marker_class(self.name) + if self.genofile: + self.markers = marker_class(self.genofile[:-5]) + else: + self.markers = marker_class(self.name) def get_f1_parent_strains(self): try: diff --git a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py index 95a5f6a6..b34beb7b 100644 --- a/wqflask/wqflask/correlation_matrix/show_corr_matrix.py +++ b/wqflask/wqflask/correlation_matrix/show_corr_matrix.py @@ -72,7 +72,14 @@ class CorrelationMatrix(object): self.all_sample_list = [] self.traits = [] + self.insufficient_shared_samples = False + this_group = self.trait_list[0][1].group.name #ZS: Getting initial group name before verifying all traits are in the same group in the following loop for trait_db in self.trait_list: + if trait_db[1].group.name != this_group: + self.insufficient_shared_samples = True + break + else: + this_group = trait_db[1].group.name this_trait = trait_db[0] self.traits.append(this_trait) this_sample_data = this_trait.data @@ -81,100 +88,102 @@ class CorrelationMatrix(object): if sample not in self.all_sample_list: self.all_sample_list.append(sample) - self.sample_data = [] - for trait_db in self.trait_list: - this_trait = trait_db[0] - this_sample_data = this_trait.data - - this_trait_vals = [] - for sample in self.all_sample_list: - if sample in this_sample_data: - this_trait_vals.append(this_sample_data[sample].value) - else: - this_trait_vals.append('') - self.sample_data.append(this_trait_vals) + if self.insufficient_shared_samples: + pass + else: + self.sample_data = [] + for trait_db in self.trait_list: + this_trait = trait_db[0] + this_sample_data = this_trait.data - if len(this_trait_vals) < len(self.trait_list): #Shouldn't do PCA if there are more traits than observations/samples - return False + this_trait_vals = [] + for sample in self.all_sample_list: + if sample in this_sample_data: + this_trait_vals.append(this_sample_data[sample].value) + else: + this_trait_vals.append('') + self.sample_data.append(this_trait_vals) - self.lowest_overlap = 8 #ZS: Variable set to the lowest overlapping samples in order to notify user, or 8, whichever is lower (since 8 is when we want to display warning) + if len(this_trait_vals) < len(self.trait_list): #Shouldn't do PCA if there are more traits than observations/samples + return False - self.corr_results = [] - self.pca_corr_results = [] - self.trait_data_array = [] - for trait_db in self.trait_list: - this_trait = trait_db[0] - this_db = trait_db[1] + self.lowest_overlap = 8 #ZS: Variable set to the lowest overlapping samples in order to notify user, or 8, whichever is lower (since 8 is when we want to display warning) - this_db_samples = this_db.group.all_samples_ordered() - this_sample_data = this_trait.data + self.corr_results = [] + self.pca_corr_results = [] + self.trait_data_array = [] + for trait_db in self.trait_list: + this_trait = trait_db[0] + this_db = trait_db[1] - this_trait_vals = [] - for index, sample in enumerate(this_db_samples): - if (sample in this_sample_data): - sample_value = this_sample_data[sample].value - this_trait_vals.append(sample_value) - self.trait_data_array.append(this_trait_vals) - - corr_result_row = [] - pca_corr_result_row = [] - is_spearman = False #ZS: To determine if it's above or below the diagonal - for target in self.trait_list: - target_trait = target[0] - target_db = target[1] - target_samples = target_db.group.all_samples_ordered() - target_sample_data = target_trait.data + this_db_samples = this_db.group.all_samples_ordered() + this_sample_data = this_trait.data this_trait_vals = [] - target_vals = [] - for index, sample in enumerate(target_samples): - if (sample in this_sample_data) and (sample in target_sample_data): + for index, sample in enumerate(this_db_samples): + if (sample in this_sample_data): sample_value = this_sample_data[sample].value - target_sample_value = target_sample_data[sample].value this_trait_vals.append(sample_value) - target_vals.append(target_sample_value) - - this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values(this_trait_vals, target_vals) - - if num_overlap < self.lowest_overlap: - self.lowest_overlap = num_overlap - if num_overlap == 0: - corr_result_row.append([target_trait, 0, num_overlap]) - pca_corr_result_row.append(0) - else: - pearson_r, pearson_p = scipy.stats.pearsonr(this_trait_vals, target_vals) - if is_spearman == False: - sample_r, sample_p = pearson_r, pearson_p - if sample_r == 1: - is_spearman = True + self.trait_data_array.append(this_trait_vals) + + corr_result_row = [] + pca_corr_result_row = [] + is_spearman = False #ZS: To determine if it's above or below the diagonal + for target in self.trait_list: + target_trait = target[0] + target_db = target[1] + target_samples = target_db.group.all_samples_ordered() + target_sample_data = target_trait.data + + this_trait_vals = [] + target_vals = [] + for index, sample in enumerate(target_samples): + if (sample in this_sample_data) and (sample in target_sample_data): + sample_value = this_sample_data[sample].value + target_sample_value = target_sample_data[sample].value + this_trait_vals.append(sample_value) + target_vals.append(target_sample_value) + + this_trait_vals, target_vals, num_overlap = corr_result_helpers.normalize_values(this_trait_vals, target_vals) + + if num_overlap < self.lowest_overlap: + self.lowest_overlap = num_overlap + if num_overlap == 0: + corr_result_row.append([target_trait, 0, num_overlap]) + pca_corr_result_row.append(0) else: - sample_r, sample_p = scipy.stats.spearmanr(this_trait_vals, target_vals) - - corr_result_row.append([target_trait, sample_r, num_overlap]) - pca_corr_result_row.append(pearson_r) + pearson_r, pearson_p = scipy.stats.pearsonr(this_trait_vals, target_vals) + if is_spearman == False: + sample_r, sample_p = pearson_r, pearson_p + if sample_r == 1: + is_spearman = True + else: + sample_r, sample_p = scipy.stats.spearmanr(this_trait_vals, target_vals) - self.corr_results.append(corr_result_row) - self.pca_corr_results.append(pca_corr_result_row) + corr_result_row.append([target_trait, sample_r, num_overlap]) + pca_corr_result_row.append(pearson_r) - corr_result_eigen = la.eigenvectors(numarray.array(self.pca_corr_results)) - corr_eigen_value, corr_eigen_vectors = sortEigenVectors(corr_result_eigen) + self.corr_results.append(corr_result_row) + self.pca_corr_results.append(pca_corr_result_row) - groups = [] - for sample in self.all_sample_list: - groups.append(1) + corr_result_eigen = la.eigenvectors(numarray.array(self.pca_corr_results)) + corr_eigen_value, corr_eigen_vectors = sortEigenVectors(corr_result_eigen) - pca = self.calculate_pca(range(len(self.traits)), corr_eigen_value, corr_eigen_vectors) + groups = [] + for sample in self.all_sample_list: + groups.append(1) - self.loadings_array = self.process_loadings() + pca = self.calculate_pca(range(len(self.traits)), corr_eigen_value, corr_eigen_vectors) - self.js_data = dict(traits = [trait.name for trait in self.traits], - groups = groups, - cols = range(len(self.traits)), - rows = range(len(self.traits)), - samples = self.all_sample_list, - sample_data = self.sample_data,) - # corr_results = [result[1] for result in result_row for result_row in self.corr_results]) + self.loadings_array = self.process_loadings() + self.js_data = dict(traits = [trait.name for trait in self.traits], + groups = groups, + cols = range(len(self.traits)), + rows = range(len(self.traits)), + samples = self.all_sample_list, + sample_data = self.sample_data,) + # corr_results = [result[1] for result in result_row for result_row in self.corr_results]) def get_trait_db_obs(self, trait_db_list): diff --git a/wqflask/wqflask/marker_regression/marker_regression.py b/wqflask/wqflask/marker_regression/marker_regression.py index 8882c515..60424468 100644 --- a/wqflask/wqflask/marker_regression/marker_regression.py +++ b/wqflask/wqflask/marker_regression/marker_regression.py @@ -148,6 +148,10 @@ class MarkerRegression(object): self.showGenes = "ON" self.viewLegend = "ON" + if 'genofile' in start_vars: + if start_vars['genofile'] != "": + self.genofile_string = start_vars['genofile'] + self.dataset.group.genofile = self.genofile_string.split(":")[0] self.dataset.group.get_markers() if self.mapping_method == "gemma": self.score_type = "-log(p)" @@ -162,11 +166,10 @@ class MarkerRegression(object): self.mapping_scale = "morgan" self.control_marker = start_vars['control_marker'] self.do_control = start_vars['do_control'] - self.dataset.group.genofile = start_vars['genofile'] self.method = start_vars['mapmethod_rqtl_geno'] self.model = start_vars['mapmodel_rqtl_geno'] - if start_vars['pair_scan'] == "true": - self.pair_scan = True + #if start_vars['pair_scan'] == "true": + # self.pair_scan = True if self.permCheck and self.num_perm > 0: self.perm_output, self.suggestive, self.significant, results = rqtl_mapping.run_rqtl_geno(self.vals, self.dataset, self.method, self.model, self.permCheck, self.num_perm, self.do_control, self.control_marker, self.manhattan_plot, self.pair_scan) else: @@ -198,7 +201,6 @@ class MarkerRegression(object): self.control_marker = start_vars['control_marker'] self.do_control = start_vars['do_control'] - self.dataset.group.genofile = start_vars['genofile'] logger.info("Running qtlreaper") results, self.json_data, self.perm_output, self.suggestive, self.significant, self.bootstrap_results = qtlreaper_mapping.gen_reaper_results(self.this_trait, self.dataset, @@ -217,7 +219,6 @@ class MarkerRegression(object): #results = self.run_plink() elif self.mapping_method == "pylmm": logger.debug("RUNNING PYLMM") - self.dataset.group.genofile = start_vars['genofile'] if self.num_perm > 0: self.run_permutations(str(temp_uuid)) results = self.gen_data(str(temp_uuid)) diff --git a/wqflask/wqflask/marker_regression/marker_regression_gn1.py b/wqflask/wqflask/marker_regression/marker_regression_gn1.py index 82a44796..d99ac074 100644 --- a/wqflask/wqflask/marker_regression/marker_regression_gn1.py +++ b/wqflask/wqflask/marker_regression/marker_regression_gn1.py @@ -171,6 +171,8 @@ class MarkerRegression(object): self.dataset = start_vars['dataset'] self.this_trait = start_vars['this_trait'] self.species = start_vars['species'] + if 'genofile_string' in start_vars: + self.genofile_string = start_vars['genofile_string'] #Needing for form submission when doing single chr mapping or remapping after changing options self.samples = start_vars['samples'] diff --git a/wqflask/wqflask/network_graph/network_graph.py b/wqflask/wqflask/network_graph/network_graph.py index cebe5c03..4ce6c48d 100644 --- a/wqflask/wqflask/network_graph/network_graph.py +++ b/wqflask/wqflask/network_graph/network_graph.py @@ -181,12 +181,21 @@ class NetworkGraph(object): self.edges_list.append(edge_dict) - node_dict = { 'data' : {'id' : str(this_trait.name) + ":" + str(this_trait.dataset.name), - 'label' : this_trait.name, - 'symbol' : this_trait.symbol, - 'geneid' : this_trait.geneid, - 'omim' : this_trait.omim, - 'max_corr' : max_corr } } + if trait_db[1].type == "ProbeSet": + node_dict = { 'data' : {'id' : str(this_trait.name) + ":" + str(this_trait.dataset.name), + 'label' : this_trait.symbol, + 'symbol' : this_trait.symbol, + 'geneid' : this_trait.geneid, + 'omim' : this_trait.omim, + 'max_corr' : max_corr } } + elif trait_db[1].type == "Publish": + node_dict = { 'data' : {'id' : str(this_trait.name) + ":" + str(this_trait.dataset.name), + 'label' : this_trait.name, + 'max_corr' : max_corr } } + else: + node_dict = { 'data' : {'id' : str(this_trait.name) + ":" + str(this_trait.dataset.name), + 'label' : this_trait.name, + 'max_corr' : max_corr } } self.nodes_list.append(node_dict) #self.network_data['dataSchema'] = {'nodes' : [{'name' : "label" , 'type' : "string"}], @@ -211,7 +220,6 @@ class NetworkGraph(object): # corr_results = [result[1] for result in result_row for result_row in self.corr_results]) def get_trait_db_obs(self, trait_db_list): - self.trait_list = [] for i, trait_db in enumerate(trait_db_list): if i == (len(trait_db_list) - 1): diff --git a/wqflask/wqflask/static/new/css/network_graph.css b/wqflask/wqflask/static/new/css/network_graph.css index 1cba546a..1a0bafeb 100644 --- a/wqflask/wqflask/static/new/css/network_graph.css +++ b/wqflask/wqflask/static/new/css/network_graph.css @@ -14,7 +14,6 @@ position: relative; float: left; width: 18.5em; - padding: 1em 1em 1em 1em; background: #fff url('/static/new/images/a1.gif') top right repeat-y; } diff --git a/wqflask/wqflask/static/new/javascript/network_graph.js b/wqflask/wqflask/static/new/javascript/network_graph.js index d1afd47c..731acf1a 100644 --- a/wqflask/wqflask/static/new/javascript/network_graph.js +++ b/wqflask/wqflask/static/new/javascript/network_graph.js @@ -12,7 +12,7 @@ window.onload=function() { selector: 'node', style: { 'background-color': '#666', - 'label': 'data(symbol)', + 'label': 'data(label )', 'font-size': 10 } }, @@ -81,10 +81,18 @@ window.onload=function() { function create_qtips(cy){ cy.nodes().qtip({ content: function(){ + qtip_content = '' gn_link = ''+''+this.data().id +''+'