@@ -451,12 +451,14 @@ export class BrowseService {
451451 const graph = new Graph ( ) ;
452452
453453 // Find max node degree for normalization
454- const maxNodeDegree = Math . max ( ...nodes . map ( node => node . node_degree ) ) ;
454+ const maxNodeDegree = Math . max ( ...nodes . map ( ( node ) => node . node_degree ) ) ;
455455
456456 // Find max mscor for normalization
457- const maxMscor = Math . max ( ...interactions . map ( interaction =>
458- 'gene1' in interaction ? interaction . mscor : interaction . mscor
459- ) ) ;
457+ const maxMscor = Math . max (
458+ ...interactions . map ( ( interaction ) =>
459+ 'gene1' in interaction ? interaction . mscor : interaction . mscor
460+ )
461+ ) ;
460462
461463 nodes . forEach ( ( node ) => {
462464 const gene = BrowseService . getNodeGeneName ( node ) ;
@@ -465,7 +467,7 @@ export class BrowseService {
465467 ) ;
466468
467469 // Calculate normalized node size based on degree (range: 5-20)
468- const normalizedSize = 5 + ( 15 * ( node . node_degree / maxNodeDegree ) ) ;
470+ const normalizedSize = 5 + 15 * ( node . node_degree / maxNodeDegree ) ;
469471
470472 graph . addNode ( BrowseService . getNodeID ( node ) , {
471473 label : BrowseService . getNodeFullName ( node ) ,
@@ -484,14 +486,55 @@ export class BrowseService {
484486 }
485487
486488 // Calculate normalized edge size based on mscor (range: 1-5)
487- const mscor = 'gene1' in interaction ? interaction . mscor : interaction . mscor ;
488- const normalizedSize = 1 + ( 6 * ( mscor / maxMscor ) ) ;
489+ const mscor =
490+ 'gene1' in interaction ? interaction . mscor : interaction . mscor ;
491+ const normalizedSize = 1 + 6 * ( mscor / maxMscor ) ;
489492
490493 graph . addEdge ( ids [ 0 ] , ids [ 1 ] , {
491- size : normalizedSize
494+ size : normalizedSize ,
492495 } ) ;
493496 } ) ;
494497
495498 return graph ;
496499 }
500+
501+ setAllNodesState ( state : boolean ) {
502+ this . _nodeStates$ . update ( ( entityStates ) => {
503+ return Object . fromEntries (
504+ Object . keys ( entityStates ) . map ( ( key ) => [
505+ key ,
506+ {
507+ ...entityStates [ key ] ,
508+ [ State . Active ] : state ,
509+ } ,
510+ ] )
511+ ) ;
512+ } ) ;
513+ }
514+
515+ allNodesSelected$ = computed ( ( ) => {
516+ return Object . values ( this . _nodeStates$ ( ) ) . every (
517+ ( state ) => state [ State . Active ]
518+ ) ;
519+ } ) ;
520+
521+ setAllEdgesState ( state : boolean ) {
522+ this . _edgeStates$ . update ( ( entityStates ) => {
523+ return Object . fromEntries (
524+ Object . keys ( entityStates ) . map ( ( key ) => [
525+ key ,
526+ {
527+ ...entityStates [ key ] ,
528+ [ State . Active ] : state ,
529+ } ,
530+ ] )
531+ ) ;
532+ } ) ;
533+ }
534+
535+ allEdgesSelected$ = computed ( ( ) => {
536+ return Object . values ( this . _edgeStates$ ( ) ) . every (
537+ ( state ) => state [ State . Active ]
538+ ) ;
539+ } ) ;
497540}
0 commit comments