GMOD / jbrowse-components

Source code for JBrowse 2, a modern React-based genome browser
https://jbrowse.org/jb2
Apache License 2.0
205 stars 61 forks source link

Fix log scale for some types of signal tracks #4495

Closed cmdcolin closed 2 months ago

cmdcolin commented 2 months ago

When we apply the log scale, we change the minimum value to 1 in some cases

This helps avoid performing log(0) which is undefined (or...-Infinity in javascript)

The current check applies well to "count data" but less well for "fractional data"

I found that there are ENCODE bigwigs return fractional values between 0-maxval so there are things like 0.02 and 34.8 and 24.5 etc.

The 0.02 causes the log scale to go negative though, in a way that is not super informative. Therefore, we try to make the logscale again snap to 1 with this PR

The caveat is that if the min and max are just between 0-1 then we do not perform this operation, because in that case, the values might be raw p-values, and then just not transforming it gives someone something similar to -log(p), a common unit for graphing, but just without the negative.