From 3df1af938ebfa3741333da0afb2e2b86fbd33a29 Mon Sep 17 00:00:00 2001 From: yichaoS Date: Thu, 4 Jun 2015 11:12:21 -0400 Subject: [PATCH 1/5] fixed the lock gene bug --- .../js/src/plots-tab/proxy/plotsData.js | 1 + .../plots-tab/view/components/profileSpec.js | 24 ++++++++++++------- .../webapp/js/src/plots-tab/view/plotsbox.js | 1 + .../webapp/js/src/plots-tab/view/sidebar.js | 16 +++++-------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/portal/src/main/webapp/js/src/plots-tab/proxy/plotsData.js b/portal/src/main/webapp/js/src/plots-tab/proxy/plotsData.js index 4b93c3880fe..bb690735b1b 100644 --- a/portal/src/main/webapp/js/src/plots-tab/proxy/plotsData.js +++ b/portal/src/main/webapp/js/src/plots-tab/proxy/plotsData.js @@ -54,6 +54,7 @@ var plotsData = (function() { case_set_id: window.PortalGlobals.getCaseSetId(), case_ids_key: window.PortalGlobals.getCaseIdsKey() }; + $.post("getProfileData.json", paramsGetProfileData, inner_profile_callback_func, "json"); } else if ($("input:radio[name='" + ids.sidebar[axis].data_type + "']:checked").val() === vals.data_type.clin) { diff --git a/portal/src/main/webapp/js/src/plots-tab/view/components/profileSpec.js b/portal/src/main/webapp/js/src/plots-tab/view/components/profileSpec.js index 8c3dcf75250..26269739851 100644 --- a/portal/src/main/webapp/js/src/plots-tab/view/components/profileSpec.js +++ b/portal/src/main/webapp/js/src/plots-tab/view/components/profileSpec.js @@ -9,14 +9,23 @@ var profileSpec = (function() { }); $("#" + ids.sidebar[axis].spec_div).append(""); - $("#" + ids.sidebar[axis].gene).change(function() { - regenerate_plots(axis); - }); - if (axis === "y") { - $("#" + ids.sidebar.y.spec_div).append("
"); + $("#" + ids.sidebar.y.spec_div).append("
"); } + + $("#" + ids.sidebar[axis].gene).change(function() { + if (axis === "y") { + regenerate_plots("y"); + } else if (axis === "x") { + if(document.getElementById(ids.sidebar.y.lock_gene).checked) { + regenerate_plots("xy"); + } else { + regenerate_plots("x"); + } + } + }); + } function appendProfileTypeList(axis) { @@ -84,7 +93,7 @@ var profileSpec = (function() { function updateProfileNameList(axis) { $("#" + ids.sidebar[axis].profile_name).empty(); append(); - + function append() { $.each(metaData.getGeneticProfilesMeta($("#" + ids.sidebar[axis].gene).val()), function(index, obj) { if (obj.type === $("#" + ids.sidebar[axis].profile_type).val()) { @@ -158,7 +167,6 @@ var profileSpec = (function() { $("#" + ids.sidebar.x.gene).change(function() { if(document.getElementById(ids.sidebar.y.lock_gene).checked) { $("#" + ids.sidebar.y.gene).prop("selectedIndex", $("#" + ids.sidebar.x.gene).prop("selectedIndex")); - //regenerate_plots("y"); } }); } diff --git a/portal/src/main/webapp/js/src/plots-tab/view/plotsbox.js b/portal/src/main/webapp/js/src/plots-tab/view/plotsbox.js index a76f57717c5..832e68b5c2e 100644 --- a/portal/src/main/webapp/js/src/plots-tab/view/plotsbox.js +++ b/portal/src/main/webapp/js/src/plots-tab/view/plotsbox.js @@ -2,6 +2,7 @@ var plotsbox = (function() { //scatterPlots.init(div, data, if_apply_box_plots, box_plots_axis, if_calculate_co_exp); var render = function(data) { + if (genetic_vs_genetic()) { if(isSameGene()) { if(is_profile_discretized("x") && !is_profile_discretized("y")) { //copy number profile is gistic diff --git a/portal/src/main/webapp/js/src/plots-tab/view/sidebar.js b/portal/src/main/webapp/js/src/plots-tab/view/sidebar.js index cc7d0ec8c55..109063c206e 100644 --- a/portal/src/main/webapp/js/src/plots-tab/view/sidebar.js +++ b/portal/src/main/webapp/js/src/plots-tab/view/sidebar.js @@ -16,8 +16,6 @@ var sidebar = (function() { //reset the default value of x: default is always x copy num, y mrna document.getElementById(ids.sidebar.x.profile_type).selectedIndex = "1"; profileSpec.updateProfileNameList("x"); - //regenerate_plots("x"); - //regenerate_plots("y"); } //only have clincal data } else if ((metaData.getGeneticProfilesMeta(window.PortalGlobals.getGeneList()[0]).length === 0 || @@ -55,7 +53,6 @@ var sidebar = (function() { if (_type_arr.length > 1) { document.getElementById(ids.sidebar.x.profile_type).selectedIndex = "1"; profileSpec.updateProfileNameList("x"); - //regenerate_plots("x"); } } @@ -67,27 +64,29 @@ var sidebar = (function() { $("#" + ids.sidebar.x.data_type).change(function() { if ($("input:radio[name='" + ids.sidebar.x.data_type + "']:checked").val() === vals.data_type.genetic) { profileSpec.init("x"); - optSpec.init(); } else if ($("input:radio[name='" + ids.sidebar.x.data_type + "']:checked").val() === vals.data_type.clin) { clinSpec.init("x"); } profileSpec.appendLockGene(); + optSpec.init(); regenerate_plots("x"); }); $("#" + ids.sidebar.y.data_type).change(function() { if ($("input:radio[name='" + ids.sidebar.y.data_type + "']:checked").val() === vals.data_type.genetic) { profileSpec.init("y"); - optSpec.init(); - profileSpec.appendLockGene(); } else if ($("input:radio[name='" + ids.sidebar.y.data_type + "']:checked").val() === vals.data_type.clin) { clinSpec.init("y"); } + optSpec.init(); regenerate_plots("y"); }); + + //listener on view change button $("#" + ids.sidebar.util.view_switch).change(function() { mutation_copy_no_view_switch(); }); - + + //listener on axis swap button $("#plots-tab-swap-btn").click(function() { //preserve the previous selection var _x_opts = {}, _y_opts = {}; @@ -112,7 +111,6 @@ var sidebar = (function() { _y_opts.clin_attr_index = document.getElementById(ids.sidebar.y.clin_attr).selectedIndex; } - //swap if (_y_opts.data_type === vals.data_type.genetic) { $("input:radio[name='" + ids.sidebar.x.data_type + "'][value='" + vals.data_type.genetic + "']").attr('checked', 'checked'); @@ -146,10 +144,8 @@ var sidebar = (function() { $("#" + ids.sidebar.y.clin_attr).chosen().change(); $("#" + ids.sidebar.y.clin_attr).trigger("liszt:updated"); } - //update plots regenerate_plots("xy"); - }); }; From c3f310153440ea1de4d5253de32ba8f421131f99 Mon Sep 17 00:00:00 2001 From: Ino de Bruijn Date: Mon, 8 Jun 2015 16:42:41 -0400 Subject: [PATCH 2/5] Add cancer type to sample record to patient view Add cancer type to sample record in patient view. Show detailed cancer type between parentheses instead of appending it with a comma. --- .../tumormap/patient_view/patient_view.jsp | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp b/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp index 62222976cb3..29400036f9c 100644 --- a/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp +++ b/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp @@ -915,19 +915,9 @@ function outputClinicalData() { if (n>1) { sample_recs += " "; } - sample_recs += ""+caseId+" " - - var sampleData = {}; - if (Object.keys(clinicalDataMap).length > 0) { - var info_keys = ["SAMPLE_TYPE", "METASTATIC_SITE", "PRIMARY_SITE"]; - for (var j=0; j < info_keys.length; j++) { - if (info_keys[j] in clinicalDataMap[caseId]) { - sampleData[info_keys[j]] = clinicalDataMap[caseId][info_keys[j]]; - } - } - } + sample_recs += ""+caseId+" "; var info = []; - info = info.concat(formatStateInfo(sampleData)); + info = info.concat(formatDiseaseInfo(clinicalDataMap[caseId])); sample_recs += info.join(", "); sample_recs += ", "; @@ -1075,7 +1065,7 @@ function outputClinicalData() { loc = guessClinicalData(clinicalData,["TUMOR_SITE","METASTATIC_SITE"]); } else { if (isPatientView) { - loc = patientInfo["PRIMARY_SITE"]; + loc = patientInfo["PRIMARY_SITE"] || guessClinicalData(clinicalData, ["TUMOR_SITE","PRIMARY_SITE"]); } else { loc = guessClinicalData(clinicalData,["TUMOR_SITE","PRIMARY_SITE"]); } @@ -1122,14 +1112,13 @@ function outputClinicalData() { var typeOfCancer = guessClinicalData(clinicalData,["TYPE_OF_CANCER", "CANCER_TYPE"]); if (typeOfCancer!==null) { + var detailedCancerType = guessClinicalData(clinicalData,["DETAILED_CANCER_TYPE","CANCER_TYPE_DETAILED"]); + if (detailedCancerType!==null) { + typeOfCancer += " ("+detailedCancerType+")"; + } diseaseInfo.push(typeOfCancer); } - var detailedCancerType = guessClinicalData(clinicalData,["DETAILED_CANCER_TYPE","CANCER_TYPE_DETAILED"]); - if (detailedCancerType!==null) { - diseaseInfo.push(detailedCancerType); - } - var knowMolecularClassifier = guessClinicalData(clinicalData,["KNOWN_MOLECULAR_CLASSIFIER"]); if (knowMolecularClassifier!==null) { diseaseInfo.push(knowMolecularClassifier); From 37063452bccb26ebf845dd81647a5b8307ddb56f Mon Sep 17 00:00:00 2001 From: Ino de Bruijn Date: Mon, 8 Jun 2015 17:16:54 -0400 Subject: [PATCH 3/5] Add sample record line in case of a single sample In the patient view only multiple samples would be displayed, not single ones. This adds the sample record in case there is only a single sample for the patient. --- .../webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp b/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp index 29400036f9c..b8475556805 100644 --- a/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp +++ b/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp @@ -943,7 +943,7 @@ function outputClinicalData() { is_expanded = false; } }); - } else if (n > 1) { + } else if (n > 0) { $("#clinical_div").append(svg_corner + head_recs.replace(/, <\/div>$/, "")); } if (Object.keys(patientInfo).length > 0) { From 3b6ab477e16c9375fa590b058bb3ca6d8c46bb0c Mon Sep 17 00:00:00 2001 From: Ino de Bruijn Date: Mon, 8 Jun 2015 19:13:33 -0400 Subject: [PATCH 4/5] Only show cancer type on primary samples --- .../jsp/tumormap/patient_view/patient_view.jsp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp b/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp index b8475556805..a2cdfb25e0d 100644 --- a/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp +++ b/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp @@ -1110,13 +1110,16 @@ function outputClinicalData() { function formatDiseaseInfo(clinicalData) { var diseaseInfo = []; - var typeOfCancer = guessClinicalData(clinicalData,["TYPE_OF_CANCER", "CANCER_TYPE"]); - if (typeOfCancer!==null) { - var detailedCancerType = guessClinicalData(clinicalData,["DETAILED_CANCER_TYPE","CANCER_TYPE_DETAILED"]); - if (detailedCancerType!==null) { - typeOfCancer += " ("+detailedCancerType+")"; + var caseType = guessClinicalData(clinicalData, ["TUMOR_TYPE","SAMPLE_TYPE"]); + if (caseType != null && normalizedCaseType(caseType.toLowerCase())==="primary") { + var typeOfCancer = guessClinicalData(clinicalData,["TYPE_OF_CANCER", "CANCER_TYPE"]); + if (typeOfCancer!==null) { + var detailedCancerType = guessClinicalData(clinicalData,["DETAILED_CANCER_TYPE","CANCER_TYPE_DETAILED"]); + if (detailedCancerType!==null) { + typeOfCancer += " ("+detailedCancerType+")"; + } + diseaseInfo.push(typeOfCancer); } - diseaseInfo.push(typeOfCancer); } var knowMolecularClassifier = guessClinicalData(clinicalData,["KNOWN_MOLECULAR_CLASSIFIER"]); From 66f5860bd33864384caee57ce49b98adf69cd221 Mon Sep 17 00:00:00 2001 From: Ino de Bruijn Date: Wed, 10 Jun 2015 19:21:12 -0400 Subject: [PATCH 5/5] Add patient info CANCER_TYPE* if in all samples If all samples have the same CANCER_TYPE or CANCER_TYPE_DETAILED, add them to the patient info at the top of the page instead of showing them per sample. This removes the code of only showing CANCER_TYPE and CANCER_TYPE_DETAILED if the sample is primary such that attributes are still displayed if there are only metastases for a patient and no primary. --- .../tumormap/patient_view/patient_view.jsp | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp b/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp index ec67fba10a1..0c63f8ef948 100644 --- a/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp +++ b/portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp @@ -887,9 +887,17 @@ function outputClinicalData() { initNav(); if (isPatientView) { - // patient info - //var row = "Patient"; - //$("#clinical_table").append(row); + // Add cancer attributes to patientInfo if they are the same for all samples + var isOneType = function(group, map) { + return Object.keys(group).length === 1 && + group[Object.keys(group)[0]].length === Object.keys(map).length; + } + _.map(["CANCER_TYPE", "CANCER_TYPE_DETAILED"], function(c) { + var group = _.groupBy(clinicalDataMap, c); + if (isOneType(group, clinicalDataMap)) { + patientInfo[c] = Object.keys(group)[0]; + } + }); row = ""+patientId+" "; var info = []; @@ -916,7 +924,7 @@ function outputClinicalData() { } sample_recs += ""+caseId+" "; var info = []; - info = info.concat(formatDiseaseInfo(clinicalDataMap[caseId])); + info = info.concat(formatDiseaseInfo(_.omit(clinicalDataMap[caseId], Object.keys(patientInfo)))); sample_recs += info.join(", "); sample_recs += ", "; @@ -1114,16 +1122,13 @@ function outputClinicalData() { function formatDiseaseInfo(clinicalData) { var diseaseInfo = []; - var caseType = guessClinicalData(clinicalData, ["TUMOR_TYPE","SAMPLE_TYPE"]); - if (caseType != null && normalizedCaseType(caseType.toLowerCase())==="primary") { - var typeOfCancer = guessClinicalData(clinicalData,["TYPE_OF_CANCER", "CANCER_TYPE"]); - if (typeOfCancer!==null) { - var detailedCancerType = guessClinicalData(clinicalData,["DETAILED_CANCER_TYPE","CANCER_TYPE_DETAILED"]); - if (detailedCancerType!==null) { - typeOfCancer += " ("+detailedCancerType+")"; - } - diseaseInfo.push(typeOfCancer); + var typeOfCancer = guessClinicalData(clinicalData,["TYPE_OF_CANCER", "CANCER_TYPE"]); + if (typeOfCancer!==null) { + var detailedCancerType = guessClinicalData(clinicalData,["DETAILED_CANCER_TYPE","CANCER_TYPE_DETAILED"]); + if (detailedCancerType!==null) { + typeOfCancer += " ("+detailedCancerType+")"; } + diseaseInfo.push(typeOfCancer); } var knowMolecularClassifier = guessClinicalData(clinicalData,["KNOWN_MOLECULAR_CLASSIFIER"]);