Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cBioPortal/cbioportal
Browse files Browse the repository at this point in the history
  • Loading branch information
n1zea144 committed Jun 11, 2015
2 parents 11edfaf + 37535e9 commit 3e7f777
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,17 @@ function outputClinicalData() {
initNav();
if (isPatientView) {
// patient info
//var row = "<tr><td><b>Patient</b></td>";
//$("#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 = "<span id='more-patient-info'><b><u><a href='"+cbio.util.getLinkToPatientView(cancerStudyId,patientId)+"'>"+patientId+"</a></b></u><a>&nbsp;";
var info = [];
Expand All @@ -914,19 +922,9 @@ function outputClinicalData() {
if (n>1) {
sample_recs += "<svg width='12' height='12' class='case-label-header' alt='"+caseId+"'></svg>&nbsp;";
}
sample_recs += "<b><u><a style='color: #1974b8;' href='"+cbio.util.getLinkToSampleView(cancerStudyId,caseId)+"'>"+caseId+"</a></b></u><a>&nbsp;"
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 += "<b><u><a style='color: #1974b8;' href='"+cbio.util.getLinkToSampleView(cancerStudyId,caseId)+"'>"+caseId+"</a></b></u><a>&nbsp;";
var info = [];
info = info.concat(formatStateInfo(sampleData));
info = info.concat(formatDiseaseInfo(_.omit(clinicalDataMap[caseId], Object.keys(patientInfo))));
sample_recs += info.join(",&nbsp;");
sample_recs += "</a><span class='sample-record-delimiter'>, </span></div>";
Expand All @@ -952,7 +950,7 @@ function outputClinicalData() {
is_expanded = false;
}
});
} else if (n > 1) {
} else if (n > 0) {
$("#clinical_div").append(svg_corner + head_recs.replace(/, <\/div>$/, "</div>"));
}
if (Object.keys(patientInfo).length > 0) {
Expand Down Expand Up @@ -1074,7 +1072,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"]);
}
Expand Down Expand Up @@ -1126,14 +1124,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);
Expand Down
1 change: 1 addition & 0 deletions portal/src/main/webapp/js/src/plots-tab/proxy/plotsData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,23 @@ var profileSpec = (function() {
});
$("#" + ids.sidebar[axis].spec_div).append("</select>");

$("#" + ids.sidebar[axis].gene).change(function() {
regenerate_plots(axis);
});

if (axis === "y") {
$("#" + ids.sidebar.y.spec_div).append("<div id='" +
ids.sidebar.y.lock_gene + "-div' style='display:inline;'></div>");
$("#" + ids.sidebar.y.spec_div).append("<div id='" +
ids.sidebar.y.lock_gene + "-div' style='display:inline;'></div>");
}

$("#" + 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) {
Expand Down Expand Up @@ -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()) {
Expand Down Expand Up @@ -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");
}
});
}
Expand Down
1 change: 1 addition & 0 deletions portal/src/main/webapp/js/src/plots-tab/view/plotsbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 6 additions & 10 deletions portal/src/main/webapp/js/src/plots-tab/view/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down Expand Up @@ -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");
}
}

Expand All @@ -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 = {};
Expand All @@ -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');
Expand Down Expand Up @@ -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");

});

};
Expand Down

0 comments on commit 3e7f777

Please sign in to comment.