File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 11
2+ ** v0.2.9**
3+ - New method for log value-scaling
4+
25** v0.2.5**
36- Add a ` selectRows ` option to enable filtering and aggregating bars
47
Original file line number Diff line number Diff line change @@ -104,10 +104,20 @@ const StackedBarTrack = (HGC, ...args) => {
104104 const visibleAndFetched = this . visibleAndFetchedTiles ( ) ;
105105
106106 for ( let i = 0 ; i < visibleAndFetched . length ; i ++ ) {
107- this . updateTile ( visibleAndFetched [ i ] ) ;
107+ const tile = visibleAndFetched [ i ] ;
108+ tile . matrix = null ;
109+
110+ this . updateTile ( tile ) ;
108111 }
109112
113+ for ( let i = 0 ; i < visibleAndFetched . length ; i ++ ) {
114+ const tile = visibleAndFetched [ i ] ;
115+
116+ this . renderTile ( tile ) ;
117+ }
118+
110119 this . rescaleTiles ( ) ;
120+
111121 this . draw ( ) ;
112122 }
113123
@@ -327,6 +337,22 @@ const StackedBarTrack = (HGC, ...args) => {
327337 matrix [ j ] = singleBar ;
328338 }
329339 }
340+
341+ if ( this . options . valueScaling === 'log' ) {
342+ const pseudocount = this . options . pseudocount == undefined ? 1 : this . options . pseudocount ;
343+
344+ for ( let j = 0 ; j < shapeY ; j ++ ) {
345+ const matrixMod = matrix [ j ] . map ( x => x + pseudocount )
346+ const total = matrixMod . reduce ( ( x , y ) => x + y , 0 )
347+
348+ const logs = matrixMod . map ( x => Math . log ( x ) ) ;
349+ const logsTotal = logs . reduce ( ( x , y ) => x + y , 0 )
350+ const totalLog = Math . log ( total ) ;
351+ const proportions = logs . map ( x => ( x / logsTotal ) * totalLog )
352+ matrix [ j ] = proportions ;
353+ }
354+ }
355+
330356 return matrix ;
331357 }
332358
You can’t perform that action at this time.
0 commit comments