jbrowse icon indicating copy to clipboard operation
jbrowse copied to clipboard

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

Open Jungal10 opened this issue 3 years ago • 6 comments

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

Jungal10 avatar Jul 15 '20 07:07 Jungal10

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)

cmdcolin avatar Jul 15 '20 13:07 cmdcolin

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

Jungal10 avatar Jul 15 '20 13:07 Jungal10

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?

cmdcolin avatar Jul 15 '20 14:07 cmdcolin

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

Jungal10 avatar Jul 15 '20 14:07 Jungal10

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?__

cmdcolin avatar Jul 15 '20 15:07 cmdcolin

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

  • global mean line (yellow)
  • pos and neg_color relative to the local mean
  • origin line representing the local mean (black line on my example above)

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

  • global mean (yellow)
  • pos and neg_color relative to 200
  • origin_line (black line) = 200

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.

Jungal10 avatar Jul 15 '20 17:07 Jungal10