Skip to content

Commit d7f00de

Browse files
committed
Include unregulated in fold-change color scheme
1 parent f3f600c commit d7f00de

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed

demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
.ptmInputList = ${StoryFixtures.ptmGraphWithDetailsFixture.ptmInputList}
2626
.fullProteomeInputList = ${StoryFixtures.proteinExpressionFixture.fullProteomeInputList}
2727
.hue= ${'potency'}
28-
.applicationMode = ${'editing'}
28+
.applicationMode = ${'viewing'}
2929
.perturbedNodes = ${{up: ['Protein B', 'Protein D'], down:['Protein A', 'Protein C']}}
3030
>
3131
</biowc-pathwaygraph>

src/BiowcPathwaygraph.ts

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,31 +2334,23 @@ export class BiowcPathwaygraph extends LitElement {
23342334
this.allDowngoingLessThan0 ||
23352335
(!this.anyDowngoingPTMs && !this.allUpgoingGreaterThan1);
23362336
const interpolationCenter = isLogFoldChange ? 0 : 1;
2337-
2338-
switch ((<PTMNodeD3>node).regulation) {
2339-
case 'up':
2340-
return d3v6.interpolate(
2341-
unregulatedColor,
2342-
upregulatedColor
2343-
)(
2344-
(BiowcPathwaygraph._getNodeFoldChange(node) -
2345-
interpolationCenter) /
2346-
(this.maxPosFoldChange! - interpolationCenter)
2347-
);
2348-
case 'down':
2349-
return d3v6.interpolate(
2350-
unregulatedColor,
2351-
downregulatedColor
2352-
)(
2353-
(BiowcPathwaygraph._getNodeFoldChange(node) -
2354-
interpolationCenter) /
2355-
(this.maxNegFoldChange! - interpolationCenter)
2356-
);
2357-
case 'not':
2358-
return 'var(--unregulated-color)';
2359-
default:
2360-
return '';
2337+
const nodeFoldChange = BiowcPathwaygraph._getNodeFoldChange(node);
2338+
if (nodeFoldChange > interpolationCenter) {
2339+
return d3v6.interpolate(
2340+
unregulatedColor,
2341+
upregulatedColor
2342+
)(
2343+
(BiowcPathwaygraph._getNodeFoldChange(node) - interpolationCenter) /
2344+
(this.maxPosFoldChange! - interpolationCenter)
2345+
);
23612346
}
2347+
return d3v6.interpolate(
2348+
unregulatedColor,
2349+
downregulatedColor
2350+
)(
2351+
(BiowcPathwaygraph._getNodeFoldChange(node) - interpolationCenter) /
2352+
(this.maxNegFoldChange! - interpolationCenter)
2353+
);
23622354
}
23632355
case 'potency': {
23642356
return d3v6.interpolateRgbBasis(this.potencyColorScale)(

test/fixtures/StoryFixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ export default {
280280
details: {
281281
Sequence: 'GILGVIVT(ph)LK',
282282
Site: { text: 'Y512' },
283-
'Fold Change': 0.9,
283+
'Fold Change': 0.7,
284284
'p Value': 0.0003,
285285
'-log(EC50)': 6,
286286
MyUmbrellaTerm: ' ',

0 commit comments

Comments
 (0)