Skip to content

Commit

Permalink
#1078 style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ntran18 committed Oct 30, 2024
1 parent 59b77ee commit 1b6dbc2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
13 changes: 7 additions & 6 deletions web-client/public/js/graph.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import Grid from "d3-v4-grid";
import { grnState } from "./grnstate";
import { modifyChargeParameter, modifyLinkDistanceParameter, valueValidator } from "./update-app";
import {
modifyChargeParameter,
modifyLinkDistanceParameter,
valueValidator,
adjustGeneNameForExpression,
} from "./update-app";
import {
ENDS_IN_EXPRESSION_REGEXP,
VIEWPORT_FIT,
Expand All @@ -12,7 +17,6 @@ import {
ZOOM_DISPLAY_MIDDLE,
ZOOM_ADAPTIVE_MAX_SCALE,
NETWORK_GRN_MODE,
NETWORK_PPI_MODE
} from "./constants";

/* globals d3 */
Expand Down Expand Up @@ -1088,10 +1092,7 @@ export var drawGraph = function (workbook) {
.selectAll(".coloring")
.data(function () {
if (grnState.workbook.expression[dataset]) {
var geneName = p.name;
if (grnState.workbook.meta.data.workbookType === NETWORK_PPI_MODE && geneName.endsWith("p")) {
geneName = geneName.slice(0, -1);
}
const geneName = adjustGeneNameForExpression(p);
if (
grnState.workbook.expression[dataset].data[geneName]
) {
Expand Down
14 changes: 9 additions & 5 deletions web-client/public/js/update-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,13 @@ const enableNodeColoringUI = function () {
$(LOG_FOLD_CHANGE_MAX_VALUE_HEADER).removeClass("hidden");
};

const adjustGeneNameForExpression = function(gene) {
return grnState.workbook.meta.data.workbookType === NETWORK_PPI_MODE &&
gene.name.endsWith("p")
? gene.name.slice(0, -1)
: gene.name;
};

const loadExpressionDatabase = function (isTopDataset) {
const dataset = isTopDataset ? grnState.nodeColoring.topDataset : grnState.nodeColoring.bottomDataset;
startLoadingIcon();
Expand All @@ -394,10 +401,7 @@ const loadExpressionDatabase = function (isTopDataset) {
type:"ExpressionData",
dataset,
genes : grnState.workbook.genes.map(gene => {
if (grnState.workbook.meta.data.workbookType === NETWORK_PPI_MODE) {
return gene.name.endsWith("p") ? gene.name.slice(0, -1) : gene.name;
}
return gene.name;
return adjustGeneNameForExpression(gene);
}).join(","),
timepoints: timepointsResponse[dataset]
}).then(function (response) {
Expand Down Expand Up @@ -1004,4 +1008,4 @@ export const updateApp = grnState => {
};


export { stopLoadingIcon, startLoadingIcon};
export { stopLoadingIcon, startLoadingIcon, adjustGeneNameForExpression};

0 comments on commit 1b6dbc2

Please sign in to comment.