Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1144 Disable node coloring when uploading file with no expression #1153

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions web-client/public/js/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
modifyLinkDistanceParameter,
valueValidator,
adjustGeneNameForExpression,
hasExpressionData,
} from "./update-app";
import {
ENDS_IN_EXPRESSION_REGEXP,
Expand Down Expand Up @@ -1234,15 +1235,6 @@ export var drawGraph = function (workbook) {
}
};

const hasExpressionData = sheets => {
for (var property in sheets) {
if (property.match(ENDS_IN_EXPRESSION_REGEXP)) {
return true;
}
}
return false;
};

if (!$.isEmptyObject(workbook.expression) && hasExpressionData(workbook.expression) &&
grnState.nodeColoring.topDataset !== undefined) {
updaters.renderNodeColoring();
Expand Down
4 changes: 2 additions & 2 deletions web-client/public/js/setup-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const setupHandlers = grnState => {

const explicitlySetStyle = element => {
const cssStyleDeclarationComputed = window.getComputedStyle(element);
const computedStyleObj = {};
const computedStyleObj = {};


for (let i = 0; i < cssStyleDeclarationComputed.length; i++) {
Expand All @@ -134,7 +134,7 @@ export const setupHandlers = grnState => {
}

if (computedStyleObj) {
Object.assign(element.style, computedStyleObj)
Object.assign(element.style, computedStyleObj);
}
};

Expand Down
17 changes: 7 additions & 10 deletions web-client/public/js/update-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ const toggleLayout = (on, off) => {
}
};

export const hasExpressionData = (sheets) => {
return Object.keys(sheets).some(property => property.match(ENDS_IN_EXPRESSION_REGEXP));
};

const updatetoForceGraph = () => {};

const updatetoGridLayout = () => {};
Expand Down Expand Up @@ -552,7 +556,9 @@ const updateModeViews = () =>{
};

const checkWorkbookModeSettings = () => {
if (grnState.mode === NETWORK_PPI_MODE) {
const hasExpression = hasExpressionData(grnState.workbook.expression);

if (grnState.mode === NETWORK_PPI_MODE || !hasExpression) {
grnState.nodeColoring.nodeColoringEnabled = false;
grnState.nodeColoring.showMenu = true;
grnState.colorOptimal = false;
Expand Down Expand Up @@ -598,15 +604,6 @@ const shortenExpressionSheetName = (name) => {
(name.slice(0, MAX_NUM_CHARACTERS_DROPDOWN) + "...") : name;
};

const hasExpressionData = (sheets) => {
for (var property in sheets) {
if (property.match(ENDS_IN_EXPRESSION_REGEXP)) {
return true;
}
}
return false;
};

const updateSpeciesMenu = () => {
$(SPECIES_DISPLAY).val(grnState.genePageData.species);
$(SPECIES_BUTTON_CRESS + " span").removeClass("glyphicon-ok");
Expand Down
Loading