Skip to content

Commit

Permalink
Merge pull request #1153 from dondi/maika-1144
Browse files Browse the repository at this point in the history
#1144 Disable node coloring when uploading file with no expression
  • Loading branch information
dondi authored Dec 4, 2024
2 parents ad23102 + d071741 commit 347fca8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
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,

Check failure on line 11 in web-client/public/js/graph.js

View workflow job for this annotation

GitHub Actions / build (20.x)

'ENDS_IN_EXPRESSION_REGEXP' is defined but never used
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
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

0 comments on commit 347fca8

Please sign in to comment.