Skip to content

Commit 3e7f777

Browse files
committed
Merge branch 'master' of github.com:cBioPortal/cbioportal
2 parents 11edfaf + 37535e9 commit 3e7f777

File tree

5 files changed

+43
-40
lines changed

5 files changed

+43
-40
lines changed

portal/src/main/webapp/WEB-INF/jsp/tumormap/patient_view/patient_view.jsp

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,17 @@ function outputClinicalData() {
887887
initNav();
888888
889889
if (isPatientView) {
890-
// patient info
891-
//var row = "<tr><td><b>Patient</b></td>";
892-
//$("#clinical_table").append(row);
890+
// Add cancer attributes to patientInfo if they are the same for all samples
891+
var isOneType = function(group, map) {
892+
return Object.keys(group).length === 1 &&
893+
group[Object.keys(group)[0]].length === Object.keys(map).length;
894+
}
895+
_.map(["CANCER_TYPE", "CANCER_TYPE_DETAILED"], function(c) {
896+
var group = _.groupBy(clinicalDataMap, c);
897+
if (isOneType(group, clinicalDataMap)) {
898+
patientInfo[c] = Object.keys(group)[0];
899+
}
900+
});
893901
894902
row = "<span id='more-patient-info'><b><u><a href='"+cbio.util.getLinkToPatientView(cancerStudyId,patientId)+"'>"+patientId+"</a></b></u><a>&nbsp;";
895903
var info = [];
@@ -914,19 +922,9 @@ function outputClinicalData() {
914922
if (n>1) {
915923
sample_recs += "<svg width='12' height='12' class='case-label-header' alt='"+caseId+"'></svg>&nbsp;";
916924
}
917-
sample_recs += "<b><u><a style='color: #1974b8;' href='"+cbio.util.getLinkToSampleView(cancerStudyId,caseId)+"'>"+caseId+"</a></b></u><a>&nbsp;"
918-
919-
var sampleData = {};
920-
if (Object.keys(clinicalDataMap).length > 0) {
921-
var info_keys = ["SAMPLE_TYPE", "METASTATIC_SITE", "PRIMARY_SITE"];
922-
for (var j=0; j < info_keys.length; j++) {
923-
if (info_keys[j] in clinicalDataMap[caseId]) {
924-
sampleData[info_keys[j]] = clinicalDataMap[caseId][info_keys[j]];
925-
}
926-
}
927-
}
925+
sample_recs += "<b><u><a style='color: #1974b8;' href='"+cbio.util.getLinkToSampleView(cancerStudyId,caseId)+"'>"+caseId+"</a></b></u><a>&nbsp;";
928926
var info = [];
929-
info = info.concat(formatStateInfo(sampleData));
927+
info = info.concat(formatDiseaseInfo(_.omit(clinicalDataMap[caseId], Object.keys(patientInfo))));
930928
sample_recs += info.join(",&nbsp;");
931929
sample_recs += "</a><span class='sample-record-delimiter'>, </span></div>";
932930
@@ -952,7 +950,7 @@ function outputClinicalData() {
952950
is_expanded = false;
953951
}
954952
});
955-
} else if (n > 1) {
953+
} else if (n > 0) {
956954
$("#clinical_div").append(svg_corner + head_recs.replace(/, <\/div>$/, "</div>"));
957955
}
958956
if (Object.keys(patientInfo).length > 0) {
@@ -1074,7 +1072,7 @@ function outputClinicalData() {
10741072
loc = guessClinicalData(clinicalData,["TUMOR_SITE","METASTATIC_SITE"]);
10751073
} else {
10761074
if (isPatientView) {
1077-
loc = patientInfo["PRIMARY_SITE"];
1075+
loc = patientInfo["PRIMARY_SITE"] || guessClinicalData(clinicalData, ["TUMOR_SITE","PRIMARY_SITE"]);
10781076
} else {
10791077
loc = guessClinicalData(clinicalData,["TUMOR_SITE","PRIMARY_SITE"]);
10801078
}
@@ -1126,14 +1124,13 @@ function outputClinicalData() {
11261124
11271125
var typeOfCancer = guessClinicalData(clinicalData,["TYPE_OF_CANCER", "CANCER_TYPE"]);
11281126
if (typeOfCancer!==null) {
1127+
var detailedCancerType = guessClinicalData(clinicalData,["DETAILED_CANCER_TYPE","CANCER_TYPE_DETAILED"]);
1128+
if (detailedCancerType!==null) {
1129+
typeOfCancer += " ("+detailedCancerType+")";
1130+
}
11291131
diseaseInfo.push(typeOfCancer);
11301132
}
11311133
1132-
var detailedCancerType = guessClinicalData(clinicalData,["DETAILED_CANCER_TYPE","CANCER_TYPE_DETAILED"]);
1133-
if (detailedCancerType!==null) {
1134-
diseaseInfo.push(detailedCancerType);
1135-
}
1136-
11371134
var knowMolecularClassifier = guessClinicalData(clinicalData,["KNOWN_MOLECULAR_CLASSIFIER"]);
11381135
if (knowMolecularClassifier!==null) {
11391136
diseaseInfo.push(knowMolecularClassifier);

portal/src/main/webapp/js/src/plots-tab/proxy/plotsData.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ var plotsData = (function() {
5454
case_set_id: window.PortalGlobals.getCaseSetId(),
5555
case_ids_key: window.PortalGlobals.getCaseIdsKey()
5656
};
57+
5758
$.post("getProfileData.json", paramsGetProfileData, inner_profile_callback_func, "json");
5859

5960
} else if ($("input:radio[name='" + ids.sidebar[axis].data_type + "']:checked").val() === vals.data_type.clin) {

portal/src/main/webapp/js/src/plots-tab/view/components/profileSpec.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,23 @@ var profileSpec = (function() {
99
});
1010
$("#" + ids.sidebar[axis].spec_div).append("</select>");
1111

12-
$("#" + ids.sidebar[axis].gene).change(function() {
13-
regenerate_plots(axis);
14-
});
15-
1612
if (axis === "y") {
17-
$("#" + ids.sidebar.y.spec_div).append("<div id='" +
18-
ids.sidebar.y.lock_gene + "-div' style='display:inline;'></div>");
13+
$("#" + ids.sidebar.y.spec_div).append("<div id='" +
14+
ids.sidebar.y.lock_gene + "-div' style='display:inline;'></div>");
1915
}
16+
17+
$("#" + ids.sidebar[axis].gene).change(function() {
18+
if (axis === "y") {
19+
regenerate_plots("y");
20+
} else if (axis === "x") {
21+
if(document.getElementById(ids.sidebar.y.lock_gene).checked) {
22+
regenerate_plots("xy");
23+
} else {
24+
regenerate_plots("x");
25+
}
26+
}
27+
});
28+
2029
}
2130

2231
function appendProfileTypeList(axis) {
@@ -84,7 +93,7 @@ var profileSpec = (function() {
8493
function updateProfileNameList(axis) {
8594
$("#" + ids.sidebar[axis].profile_name).empty();
8695
append();
87-
96+
8897
function append() {
8998
$.each(metaData.getGeneticProfilesMeta($("#" + ids.sidebar[axis].gene).val()), function(index, obj) {
9099
if (obj.type === $("#" + ids.sidebar[axis].profile_type).val()) {
@@ -158,7 +167,6 @@ var profileSpec = (function() {
158167
$("#" + ids.sidebar.x.gene).change(function() {
159168
if(document.getElementById(ids.sidebar.y.lock_gene).checked) {
160169
$("#" + ids.sidebar.y.gene).prop("selectedIndex", $("#" + ids.sidebar.x.gene).prop("selectedIndex"));
161-
//regenerate_plots("y");
162170
}
163171
});
164172
}

portal/src/main/webapp/js/src/plots-tab/view/plotsbox.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var plotsbox = (function() {
22

33
//scatterPlots.init(div, data, if_apply_box_plots, box_plots_axis, if_calculate_co_exp);
44
var render = function(data) {
5+
56
if (genetic_vs_genetic()) {
67
if(isSameGene()) {
78
if(is_profile_discretized("x") && !is_profile_discretized("y")) { //copy number profile is gistic

portal/src/main/webapp/js/src/plots-tab/view/sidebar.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ var sidebar = (function() {
1616
//reset the default value of x: default is always x copy num, y mrna
1717
document.getElementById(ids.sidebar.x.profile_type).selectedIndex = "1";
1818
profileSpec.updateProfileNameList("x");
19-
//regenerate_plots("x");
20-
//regenerate_plots("y");
2119
}
2220
//only have clincal data
2321
} else if ((metaData.getGeneticProfilesMeta(window.PortalGlobals.getGeneList()[0]).length === 0 ||
@@ -55,7 +53,6 @@ var sidebar = (function() {
5553
if (_type_arr.length > 1) {
5654
document.getElementById(ids.sidebar.x.profile_type).selectedIndex = "1";
5755
profileSpec.updateProfileNameList("x");
58-
//regenerate_plots("x");
5956
}
6057
}
6158

@@ -67,27 +64,29 @@ var sidebar = (function() {
6764
$("#" + ids.sidebar.x.data_type).change(function() {
6865
if ($("input:radio[name='" + ids.sidebar.x.data_type + "']:checked").val() === vals.data_type.genetic) {
6966
profileSpec.init("x");
70-
optSpec.init();
7167
} else if ($("input:radio[name='" + ids.sidebar.x.data_type + "']:checked").val() === vals.data_type.clin) {
7268
clinSpec.init("x");
7369
}
7470
profileSpec.appendLockGene();
71+
optSpec.init();
7572
regenerate_plots("x");
7673
});
7774
$("#" + ids.sidebar.y.data_type).change(function() {
7875
if ($("input:radio[name='" + ids.sidebar.y.data_type + "']:checked").val() === vals.data_type.genetic) {
7976
profileSpec.init("y");
80-
optSpec.init();
81-
profileSpec.appendLockGene();
8277
} else if ($("input:radio[name='" + ids.sidebar.y.data_type + "']:checked").val() === vals.data_type.clin) {
8378
clinSpec.init("y");
8479
}
80+
optSpec.init();
8581
regenerate_plots("y");
8682
});
83+
84+
//listener on view change button
8785
$("#" + ids.sidebar.util.view_switch).change(function() {
8886
mutation_copy_no_view_switch();
8987
});
90-
88+
89+
//listener on axis swap button
9190
$("#plots-tab-swap-btn").click(function() {
9291
//preserve the previous selection
9392
var _x_opts = {}, _y_opts = {};
@@ -112,7 +111,6 @@ var sidebar = (function() {
112111
_y_opts.clin_attr_index = document.getElementById(ids.sidebar.y.clin_attr).selectedIndex;
113112

114113
}
115-
116114
//swap
117115
if (_y_opts.data_type === vals.data_type.genetic) {
118116
$("input:radio[name='" + ids.sidebar.x.data_type + "'][value='" + vals.data_type.genetic + "']").attr('checked', 'checked');
@@ -146,10 +144,8 @@ var sidebar = (function() {
146144
$("#" + ids.sidebar.y.clin_attr).chosen().change();
147145
$("#" + ids.sidebar.y.clin_attr).trigger("liszt:updated");
148146
}
149-
150147
//update plots
151148
regenerate_plots("xy");
152-
153149
});
154150

155151
};

0 commit comments

Comments
 (0)