Skip to content

Commit

Permalink
Revise based on Kevin's review
Browse files Browse the repository at this point in the history
  • Loading branch information
enemeth19 committed Oct 22, 2024
1 parent e204341 commit 99ea087
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
4 changes: 2 additions & 2 deletions main/js/afterSubmit.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const buildViolinPlot = function(geneQuery, expressionData) {

meme.appendChild(numCohortBarcodes2);

let displayNumberSamplesInCohort2 = function () {
let displayNumberSamplesInCohort = function () {
let existingPara = document.getElementById("numSamplesInCohortText2");
if (existingPara) {
existingPara.remove();
Expand All @@ -222,7 +222,7 @@ const buildViolinPlot = function(geneQuery, expressionData) {
numCohortBarcodes2.appendChild(para);
};

displayNumberSamplesInCohort2()
displayNumberSamplesInCohort()

///////////////////////////////////

Expand Down
33 changes: 16 additions & 17 deletions main/js/fillSelectBoxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
* @returns {undefined}
*/
const fillCancerTypeSelectBox = async function () {
const cancerTypesQuery_1 = await firebrowse.fetchCohorts();
const cancerTypesQuery = cancerTypesQuery_1.reduce((acc, item) => item.cohort !== 'FPPP' ? [...acc, item] : acc, []);
cancerTypesQuery.sort();
const cancerTypesQuery = await firebrowse.fetchCohorts();
const cancerTypesQueryNoFPPP = cancerTypesQuery.reduce((acc, item) => item.cohort !== 'FPPP' ? [...acc, item] : acc, []);
cancerTypesQueryNoFPPP.sort();
let selectBox = document.getElementById("cancerTypeMultipleSelection");
for (let i = 0; i < cancerTypesQuery.length; i++) {
for (let i = 0; i < cancerTypesQueryNoFPPP.length; i++) {
let currentOption = document.createElement("option");
currentOption.value = cancerTypesQuery[i]["cohort"];
currentOption.value = cancerTypesQueryNoFPPP[i]["cohort"];
currentOption.text =
"(" +
cancerTypesQuery[i]["cohort"] +
cancerTypesQueryNoFPPP[i]["cohort"] +
") " +
cancerTypesQuery[i]["description"];
currentOption.id = cancerTypesQuery[i]["cohort"];
cancerTypesQueryNoFPPP[i]["description"];
currentOption.id = cancerTypesQueryNoFPPP[i]["cohort"];
selectBox.appendChild(currentOption);
}
let cancerTypeSelectedOptions = localStorage
Expand Down Expand Up @@ -89,29 +89,29 @@ let displayNumberSamples = async function () {
};
orderedCountQuery = orderThings(formatted_numbersOfSamples, myCohort, 'cohort')
// build label:
let string = "";
let numSamplesLabel = "";
let para;
for (let i = 0; i < orderedCountQuery.length; i++) {
if (string == "") {
string += orderedCountQuery[i].cohort + ": " + orderedCountQuery[i].mrnaseq;
if (numSamplesLabel == "") {
numSamplesLabel += orderedCountQuery[i].cohort + ": " + orderedCountQuery[i].mrnaseq;
para = document.createElement("P");
para.setAttribute(
"style",
'text-align: center; color: #4db6ac; font-family: Georgia, "Times New Roman", Times, serif'
);
para.setAttribute("id", "numSamplesText");
para.innerText = "Number of samples: " + string;
para.innerText = "Number of samples: " + numSamplesLabel;
cancerQuerySelectBox.appendChild(para);
} else {
document.getElementById("numSamplesText").remove();
string += ", " + orderedCountQuery[i].cohort +
numSamplesLabel += ", " + orderedCountQuery[i].cohort +
": " + orderedCountQuery[i].mrnaseq;
para.setAttribute(
"style",
'text-align: center; color: #4db6ac; font-family: Georgia, "Times New Roman", Times, serif'
);
para.setAttribute("id", "numSamplesText");
para.innerText = "Number of samples: " + string;
para.innerText = "Number of samples: " + numSamplesLabel;
cancerQuerySelectBox.appendChild(para);
}
}
Expand Down Expand Up @@ -303,7 +303,6 @@ let fillClinicalSelectBox = async function () {
const unwantedKeys = new Set(['date', 'tcga_participant_barcode', 'tool']);
clinicalKeys[0] = clinicalKeys[0].filter(item => !unwantedKeys.has(item));


let intersectedFeatures;
if(clinicalKeys.length > 1)
for(let i = 0; i < clinicalKeys.length - 1; i++) {
Expand Down Expand Up @@ -335,7 +334,7 @@ let fillClinicalSelectBox = async function () {
let temp = {name: currentFeature, type: "", isSelected: false};

let checkIfClinicalFeatureArrayIsNumeric = async function() {
let continuousFeaturesArr = [
const CONTINUOUS_FEATURES = [
"age_began_smoking_in_years",
"age_at_diagnosis",
"cervix_suv_results",
Expand Down Expand Up @@ -367,7 +366,7 @@ let fillClinicalSelectBox = async function () {
"years_to_birth",
"year_of_tobacco_smoking_onset"
]; // Array of features that should be considered continuous
if(continuousFeaturesArr.includes(currentFeature))
if(CONTINUOUS_FEATURES.includes(currentFeature))
temp.type = "continuous";
else
temp.type = "categorical";
Expand Down
7 changes: 3 additions & 4 deletions main/js/plots/createHeatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ const createHeatmap = async function (expressionData, clinicalAndMutationData, d
existingPara.remove();
}
// build label:
let string = "";
let numSamplesLabel = "";
let para;
string = (d3.map(expressionData, d => d.tcga_participant_barcode).keys()).length
numSamplesLabel = (d3.map(expressionData, d => d.tcga_participant_barcode).keys()).length
para = document.createElement("P");
para.setAttribute(
"style",
'text-align: center; color: #4db6ac; font-family: Georgia, "Times New Roman", Times, serif'
);
para.setAttribute("id", "numSamplesInCohortText");
para.innerText = "Number of samples in cohort: " + string;
para.innerText = "Number of samples in cohort: " + numSamplesLabel;
numCohortBarcodesElement.appendChild(para);
};

Expand All @@ -58,7 +58,6 @@ const createHeatmap = async function (expressionData, clinicalAndMutationData, d
div_optionsPanels.attr("class", "col s3");
div_optionsPanels.style("margin-top", "30px");
div_optionsPanels.style("padding-left", "30px");
// div_optionsPanels.style("margin-left", "20px");
var div_clinSelect = div_optionsPanels.append('div');
div_clinSelect.attr("id", "heatmapPartitionSelector");
div_clinSelect.append('text')
Expand Down
5 changes: 0 additions & 5 deletions main/js/plots/createViolinPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,6 @@ const createViolinPlot = async function(dataInput, violinDiv, curPlot, facetByFi
.call(wrap, x.bandwidth())
.style("font-size", "8px");

// svgObject.append("text")
// .attr("transform", "translate(" + width/2 + ", " + (height + margin.top + 50) + ")")
// .text("Cohort")
// .style("font-size", "12px");

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////// Build the Axis and Color Scales Above ///////////////////////////////////////////////////
Expand Down

0 comments on commit 99ea087

Please sign in to comment.