Skip to content

Commit e904f66

Browse files
authored
Updated the CHANGELOG (#48)
1 parent 6dbc68a commit e904f66

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
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

src/scripts/StackedBarTrack.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)