GMOD / jbrowse

JBrowse 1, a full-featured genome browser built with JavaScript and HTML5. For JBrowse 2, see https://github.com/GMOD/jbrowse-components.
http://jbrowse.org
Other
464 stars 199 forks source link

Using autoscale local, but having pos_color and neg_color relative to global mean #1530

Open Jungal10 opened 4 years ago

Jungal10 commented 4 years ago

I am using Jbrowse version 1.16.9 to create my Genome Browser.

I have multiple XYplots in which I am using autoscale:local. This is an important feature or for me, as I have some extreme values along with the genome and it is useful that the scale is adjustable for the window. My issue is that it results in having the pos_color and neg_color relative to the local mean and not to the global mean, as I intend to. Especially in regions where the global mean is not visible, it can lead to misinterpretations since I am adding selection and population genetics statistics on it.

Screen Shot 2020-07-15 at 09 05 12

Is there any workaround where I can use autoscale local for the scale, but maintaining the color relative to the global mean?

Thank you

cmdcolin commented 4 years ago

One option might be to set the bicolor_pivot in the config to the number to flip on, you would have to manually calculate it for the data upfront (and that would be across all chromosomes, but technically in bigwig the global is also)

Jungal10 commented 4 years ago

That one can be used to adjust the value for a certain region, but then again it will be a problem when looking for values that deviate from the pivot. Chromosome-wide there will be regions that deviate strongly from the mean. For example, if you are looking for signals of selection, as the tracks I am intending to apply, those sites are especially interesting. So, in those regions, the local mean is far from the global mean, but as the pivot is applied locally, it will look like regions in blue like in the image are above the mean, but this is not the reality. At the same time, if the scale is global, the values are too small for being observable.

This why I needed the ruler to be adjusted locally, but the pos_color and neg_color to be relative to the global mean.

Screen Shot 2020-07-15 at 15 47 51

cmdcolin commented 4 years ago

I think having "autoscale": "local" should adjust the ruler locally, but then having "bicolor_pivot": 6000 would mean that the colors are always pivoted relative to 6000

Is that not what is the proper behavior?

Jungal10 commented 4 years ago

Now I understand what you mean. Yes, that will solve the color issue. I was overthinking, trying to have all at once.

But I still have one issue. The local mean line will be lost with this procedure since the "origin" is now defined with the bicolor_pivot:6000.

Any way of having the best of both worlds?

Thank you

cmdcolin commented 4 years ago

I changed our sample data config "volvox_microarray" to have bicolor_pivot=200 and noFill=true

localhost_jbrowse__data=sample_data%2Fjson%2Fvolvox loc=ctgA%3A22804 36717 tracks=volvox_microarray_bw_xyplot highlight=

It seemed to keep the mean line. What is the origin that is lost?__

Jungal10 commented 4 years ago

If you have autoscale : local and you define the bicolor_pivot : mean you will have:

Now, having defined bicolor_pivot : 200, you will have:

So, you do not have your origin line representing the local mean, since you are using it as the pivot to separate neg and pos color. I am asking if there is any way of adding a local mean line to the track beside the defined settings.