@@ -270,8 +270,6 @@ export class BiowcPathwaygraph extends LitElement {
270
270
271
271
anyUpgoingPTMs ?: boolean ;
272
272
273
- isLogFoldChange ?: boolean ;
274
-
275
273
isNodeExpandAndCollapseAllowed : boolean = false ;
276
274
277
275
currentTimeoutId ?: NodeJS . Timeout ;
@@ -2383,8 +2381,8 @@ export class BiowcPathwaygraph extends LitElement {
2383
2381
'--unregulated-color-light'
2384
2382
) ;
2385
2383
// Interpolate between up and not or down and not, depending on direction
2386
- // The center of interpolation is 0 for log fold change and 1 for fold change
2387
- const interpolationCenter = this . isLogFoldChange ? 0 : 1 ;
2384
+ // BiowcPathwayGraph expects log Fold Changes, therefore the interpolation center is always 0
2385
+ const interpolationCenter = 0 ;
2388
2386
const nodeFoldChange = BiowcPathwaygraph . _getNodeFoldChange ( node ) ;
2389
2387
if ( nodeFoldChange > interpolationCenter ) {
2390
2388
return d3v6 . interpolate (
@@ -2422,37 +2420,21 @@ export class BiowcPathwaygraph extends LitElement {
2422
2420
case 'foldchange' :
2423
2421
/* eslint-disable no-case-declarations */
2424
2422
2425
- // Determine if fold change is log or not
2426
- // For this, check if PTMs have "Log Fold Change" or "Fold Change" property.
2427
- // If "Fold Change", check if there are any negative values - then it's actually log fold change
2428
- this . isLogFoldChange = this . d3Nodes ?. some (
2429
- node =>
2430
- node . type === 'ptm' &&
2431
- Object . hasOwn ( ( < PTMNodeD3 > node ) . details ! , 'Log Fold Change' )
2432
- ) ;
2433
- if ( ! this . isLogFoldChange ) {
2434
- this . isLogFoldChange = this . d3Nodes
2435
- ?. filter (
2436
- node =>
2437
- node . type === 'ptm' &&
2438
- Object . hasOwn ( ( < PTMNodeD3 > node ) . details ! , 'Fold Change' )
2439
- )
2440
- . some ( node => ( < PTMNodeD3 > node ) . details ! [ 'Fold Change' ] < 0 ) ;
2441
- }
2442
-
2443
- const foldChangeCenter = this . isLogFoldChange ? 0 : 1 ;
2423
+ // Interpolate between up and not or down and not, depending on direction
2424
+ // BiowcPathwayGraph expects log Fold Changes, therefore the interpolation center is always 0
2425
+ const interpolationCenter = 0 ;
2444
2426
this . anyDowngoingPTMs = this . d3Nodes
2445
2427
?. filter ( node => node . type === 'ptm' )
2446
2428
. some (
2447
2429
node =>
2448
- BiowcPathwaygraph . _getNodeFoldChange ( node ) < foldChangeCenter
2430
+ BiowcPathwaygraph . _getNodeFoldChange ( node ) < interpolationCenter
2449
2431
) ;
2450
2432
2451
2433
this . anyUpgoingPTMs = this . d3Nodes
2452
2434
?. filter ( node => node . type === 'ptm' )
2453
2435
. some (
2454
2436
node =>
2455
- BiowcPathwaygraph . _getNodeFoldChange ( node ) > foldChangeCenter
2437
+ BiowcPathwaygraph . _getNodeFoldChange ( node ) > interpolationCenter
2456
2438
) ;
2457
2439
2458
2440
this . maxPosFoldChange = this . d3Nodes
@@ -3239,41 +3221,24 @@ export class BiowcPathwaygraph extends LitElement {
3239
3221
) ( ( d - 0.5 ) / 0.5 ) ;
3240
3222
} ) ;
3241
3223
3242
- // The domain of the x axis depends on whether the fold change is log transformed
3243
- // Log FC goes from -inf to +inf, with 0 in the center
3244
- // Non-log FC goes from 0 to +inf, with 1 in the center
3224
+ // The domain of the x axis goes from -inf to +inf, with 0 in the center
3245
3225
const domain : string [ ] = [ ] ;
3246
- if ( this . isLogFoldChange ) {
3247
- if ( this . anyDowngoingPTMs ) {
3248
- domain . push (
3249
- ...[
3250
- `${ this . maxNegFoldChange ! . toPrecision ( 2 ) } ` ,
3251
- `${ ( this . maxNegFoldChange ! / 2 ) . toPrecision ( 2 ) } ` ,
3252
- ]
3253
- ) ;
3254
- }
3255
- domain . push ( '0' ) ;
3256
- if ( this . anyUpgoingPTMs ) {
3257
- domain . push (
3258
- ...[
3259
- `${ ( this . maxPosFoldChange ! / 2 ) . toPrecision ( 2 ) } ` ,
3260
- `${ this . maxPosFoldChange ! . toPrecision ( 2 ) } ` ,
3261
- ]
3262
- ) ;
3263
- }
3264
- } else {
3265
- if ( this . anyDowngoingPTMs ) {
3266
- domain . push ( ...[ '0' , '0.5' ] ) ;
3267
- }
3268
- domain . push ( '1' ) ;
3269
- if ( this . anyUpgoingPTMs ) {
3270
- domain . push (
3271
- ...[
3272
- `${ ( this . maxPosFoldChange ! / 2 ) . toPrecision ( 2 ) } ` ,
3273
- `${ this . maxPosFoldChange ! . toPrecision ( 2 ) } ` ,
3274
- ]
3275
- ) ;
3276
- }
3226
+ if ( this . anyDowngoingPTMs ) {
3227
+ domain . push (
3228
+ ...[
3229
+ `${ this . maxNegFoldChange ! . toPrecision ( 2 ) } ` ,
3230
+ `${ ( this . maxNegFoldChange ! / 2 ) . toPrecision ( 2 ) } ` ,
3231
+ ]
3232
+ ) ;
3233
+ }
3234
+ domain . push ( '0' ) ;
3235
+ if ( this . anyUpgoingPTMs ) {
3236
+ domain . push (
3237
+ ...[
3238
+ `${ ( this . maxPosFoldChange ! / 2 ) . toPrecision ( 2 ) } ` ,
3239
+ `${ this . maxPosFoldChange ! . toPrecision ( 2 ) } ` ,
3240
+ ]
3241
+ ) ;
3277
3242
}
3278
3243
3279
3244
colorLegendXAxisScale
0 commit comments