[Gmod-ajax] Scale factor problem in track rendering

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Gmod-ajax] Scale factor problem in track rendering

Keiran Raine
Hi,

I'm having some issues with a track rendering issue and I'm hoping theres a function I can call that will solve the problem.

Basically if I 'reload' a page where it makes sense to show 'base level' information I test to see if 'scale' is >= 1 fi it is I render the base level display.

The problem I'm seeing is that if I reload a screen with scale=20 I get something like this first image:


Then hitting 'small' plus takes me to the next integer:


The same happens if I start with a scale of 2, a reload gives 1.508...

Is there anyway to solve this?  I suspect is is due to how I handle the retrieval of the reference base.


Thanks for any help in advance,

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:+44 (0)1223 834244 Ext: 7703
Office: H104


-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.

------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: Scale factor problem in track rendering

Colin
Is the problem the fact that you don't get exactly the same scale values when you refresh? I wouldn't suspect your code for that. Probably related to something like this issue https://github.com/GMOD/jbrowse/issues/577 

Is that scale thing for some reason causing other problems?

-Colin

On Tue, Aug 30, 2016 at 7:55 AM, Keiran Raine <[hidden email]> wrote:
Hi,

I'm having some issues with a track rendering issue and I'm hoping theres a function I can call that will solve the problem.

Basically if I 'reload' a page where it makes sense to show 'base level' information I test to see if 'scale' is >= 1 fi it is I render the base level display.

The problem I'm seeing is that if I reload a screen with scale=20 I get something like this first image:


Then hitting 'small' plus takes me to the next integer:


The same happens if I start with a scale of 2, a reload gives 1.508...

Is there anyway to solve this?  I suspect is is due to how I handle the retrieval of the reference base.


Thanks for any help in advance,

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:<a href="tel:%2B44%20%280%291223%20834244%20Ext%3A%207703" value="+441223834244" target="_blank">+44 (0)1223 834244 Ext: 7703
Office: H104


-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.

------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax



------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: Scale factor problem in track rendering

Keiran Raine
Hi Colin,

It's more than just on refresh, happens if you drag select a region too.  Is it possible to trigger a browser level 'move' from within a function?  I'd then be able to attempt to intercept the bad scale and calculate a new similar region for redraw. 

Thanks

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:+44 (0)1223 834244 Ext: 7703
Office: H104

On 30 Aug 2016, at 15:19, Colin <[hidden email]> wrote:

Is the problem the fact that you don't get exactly the same scale values when you refresh? I wouldn't suspect your code for that. Probably related to something like this issue https://github.com/GMOD/jbrowse/issues/577 

Is that scale thing for some reason causing other problems?

-Colin

On Tue, Aug 30, 2016 at 7:55 AM, Keiran Raine <[hidden email]> wrote:
Hi,

I'm having some issues with a track rendering issue and I'm hoping theres a function I can call that will solve the problem.

Basically if I 'reload' a page where it makes sense to show 'base level' information I test to see if 'scale' is >= 1 fi it is I render the base level display.

The problem I'm seeing is that if I reload a screen with scale=20 I get something like this first image:

<Screen Shot 2016-08-30 at 13.43.11.png>

Then hitting 'small' plus takes me to the next integer:

<Screen Shot 2016-08-30 at 13.43.25.png>

The same happens if I start with a scale of 2, a reload gives 1.508...

Is there anyway to solve this?  I suspect is is due to how I handle the retrieval of the reference base.


Thanks for any help in advance,

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:<a href="tel:%2B44%20%280%291223%20834244%20Ext%3A%207703" value="+441223834244" target="_blank" class="">+44 (0)1223 834244 Ext: 7703
Office: H104


-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.

------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax




-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.

------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: Scale factor problem in track rendering

Colin
Sorry but I might try and steer away from this discussion about the "scale". I think that there might be a "scale agnostic" way to deal with this so I feel like this is sort of an XY problem http://mywiki.wooledge.org/XyProblem

What I would recommend from looking at your code is that you don't have to "infer" the reference base from the "pixels" returned for the bigwig class.

For example your have if(i % scale === 0) refBase = refBases[bIdx++]; which to me is the problematic thing. That seems unnecessary and you can instead get the exact base of the bigwig values by inspecting that "pixel" value and replace line 120 with something involving p.feat.get('start') because each "pixel" in that loop has a lightweight feature attached to it to get this coordinate

-Colin

On Tue, Aug 30, 2016 at 9:37 AM, Keiran Raine <[hidden email]> wrote:
Hi Colin,

It's more than just on refresh, happens if you drag select a region too.  Is it possible to trigger a browser level 'move' from within a function?  I'd then be able to attempt to intercept the bad scale and calculate a new similar region for redraw. 

Thanks

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:<a href="tel:%2B44%20%280%291223%20834244%20Ext%3A%207703" value="+441223834244" target="_blank">+44 (0)1223 834244 Ext: 7703
Office: H104

On 30 Aug 2016, at 15:19, Colin <[hidden email]> wrote:

Is the problem the fact that you don't get exactly the same scale values when you refresh? I wouldn't suspect your code for that. Probably related to something like this issue https://github.com/GMOD/jbrowse/issues/577 

Is that scale thing for some reason causing other problems?

-Colin

On Tue, Aug 30, 2016 at 7:55 AM, Keiran Raine <[hidden email]> wrote:
Hi,

I'm having some issues with a track rendering issue and I'm hoping theres a function I can call that will solve the problem.

Basically if I 'reload' a page where it makes sense to show 'base level' information I test to see if 'scale' is >= 1 fi it is I render the base level display.

The problem I'm seeing is that if I reload a screen with scale=20 I get something like this first image:

<Screen Shot 2016-08-30 at 13.43.11.png>

Then hitting 'small' plus takes me to the next integer:

<Screen Shot 2016-08-30 at 13.43.25.png>

The same happens if I start with a scale of 2, a reload gives 1.508...

Is there anyway to solve this?  I suspect is is due to how I handle the retrieval of the reference base.


Thanks for any help in advance,

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:<a href="tel:%2B44%20%280%291223%20834244%20Ext%3A%207703" value="+441223834244" target="_blank">+44 (0)1223 834244 Ext: 7703
Office: H104


-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.

------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax




-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.


------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: Scale factor problem in track rendering

Colin
Note also that when you use getReferenceSequence, the rest of your code following that should be inside the callback because there's no guarantee that refBase will be assigned before the rest of your function executes


-Colin

On Tue, Aug 30, 2016 at 10:10 AM, Colin <[hidden email]> wrote:
Sorry but I might try and steer away from this discussion about the "scale". I think that there might be a "scale agnostic" way to deal with this so I feel like this is sort of an XY problem http://mywiki.wooledge.org/XyProblem

What I would recommend from looking at your code is that you don't have to "infer" the reference base from the "pixels" returned for the bigwig class.

For example your have if(i % scale === 0) refBase = refBases[bIdx++]; which to me is the problematic thing. That seems unnecessary and you can instead get the exact base of the bigwig values by inspecting that "pixel" value and replace line 120 with something involving p.feat.get('start') because each "pixel" in that loop has a lightweight feature attached to it to get this coordinate

-Colin

On Tue, Aug 30, 2016 at 9:37 AM, Keiran Raine <[hidden email]> wrote:
Hi Colin,

It's more than just on refresh, happens if you drag select a region too.  Is it possible to trigger a browser level 'move' from within a function?  I'd then be able to attempt to intercept the bad scale and calculate a new similar region for redraw. 

Thanks

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:<a href="tel:%2B44%20%280%291223%20834244%20Ext%3A%207703" value="+441223834244" target="_blank">+44 (0)1223 834244 Ext: 7703
Office: H104

On 30 Aug 2016, at 15:19, Colin <[hidden email]> wrote:

Is the problem the fact that you don't get exactly the same scale values when you refresh? I wouldn't suspect your code for that. Probably related to something like this issue https://github.com/GMOD/jbrowse/issues/577 

Is that scale thing for some reason causing other problems?

-Colin

On Tue, Aug 30, 2016 at 7:55 AM, Keiran Raine <[hidden email]> wrote:
Hi,

I'm having some issues with a track rendering issue and I'm hoping theres a function I can call that will solve the problem.

Basically if I 'reload' a page where it makes sense to show 'base level' information I test to see if 'scale' is >= 1 fi it is I render the base level display.

The problem I'm seeing is that if I reload a screen with scale=20 I get something like this first image:

<Screen Shot 2016-08-30 at 13.43.11.png>

Then hitting 'small' plus takes me to the next integer:

<Screen Shot 2016-08-30 at 13.43.25.png>

The same happens if I start with a scale of 2, a reload gives 1.508...

Is there anyway to solve this?  I suspect is is due to how I handle the retrieval of the reference base.


Thanks for any help in advance,

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:<a href="tel:%2B44%20%280%291223%20834244%20Ext%3A%207703" value="+441223834244" target="_blank">+44 (0)1223 834244 Ext: 7703
Office: H104


-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.

------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax




-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.



------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: Scale factor problem in track rendering

Keiran Raine
Hi,

Thanks to Colin's pointers I've solved my problem.

Cheers,

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:+44 (0)1223 834244 Ext: 7703
Office: H104

On 30 Aug 2016, at 16:21, Colin <[hidden email]> wrote:

Note also that when you use getReferenceSequence, the rest of your code following that should be inside the callback because there's no guarantee that refBase will be assigned before the rest of your function executes


-Colin

On Tue, Aug 30, 2016 at 10:10 AM, Colin <[hidden email]> wrote:
Sorry but I might try and steer away from this discussion about the "scale". I think that there might be a "scale agnostic" way to deal with this so I feel like this is sort of an XY problem http://mywiki.wooledge.org/XyProblem

What I would recommend from looking at your code is that you don't have to "infer" the reference base from the "pixels" returned for the bigwig class.

For example your have if(i % scale === 0) refBase = refBases[bIdx++]; which to me is the problematic thing. That seems unnecessary and you can instead get the exact base of the bigwig values by inspecting that "pixel" value and replace line 120 with something involving p.feat.get('start') because each "pixel" in that loop has a lightweight feature attached to it to get this coordinate

-Colin

On Tue, Aug 30, 2016 at 9:37 AM, Keiran Raine <[hidden email]> wrote:
Hi Colin,

It's more than just on refresh, happens if you drag select a region too.  Is it possible to trigger a browser level 'move' from within a function?  I'd then be able to attempt to intercept the bad scale and calculate a new similar region for redraw. 

Thanks

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:<a href="tel:%2B44%20%280%291223%20834244%20Ext%3A%207703" value="+441223834244" target="_blank" class="">+44 (0)1223 834244 Ext: 7703
Office: H104

On 30 Aug 2016, at 15:19, Colin <[hidden email]> wrote:

Is the problem the fact that you don't get exactly the same scale values when you refresh? I wouldn't suspect your code for that. Probably related to something like this issue https://github.com/GMOD/jbrowse/issues/577 

Is that scale thing for some reason causing other problems?

-Colin

On Tue, Aug 30, 2016 at 7:55 AM, Keiran Raine <[hidden email]> wrote:
Hi,

I'm having some issues with a track rendering issue and I'm hoping theres a function I can call that will solve the problem.

Basically if I 'reload' a page where it makes sense to show 'base level' information I test to see if 'scale' is >= 1 fi it is I render the base level display.

The problem I'm seeing is that if I reload a screen with scale=20 I get something like this first image:

<Screen Shot 2016-08-30 at 13.43.11.png>

Then hitting 'small' plus takes me to the next integer:

<Screen Shot 2016-08-30 at 13.43.25.png>

The same happens if I start with a scale of 2, a reload gives 1.508...

Is there anyway to solve this?  I suspect is is due to how I handle the retrieval of the reference base.


Thanks for any help in advance,

Keiran Raine
Principal Bioinformatician
Cancer Genome Project
Wellcome Trust Sanger Institute

Tel:<a href="tel:%2B44%20%280%291223%20834244%20Ext%3A%207703" value="+441223834244" target="_blank" class="">+44 (0)1223 834244 Ext: 7703
Office: H104


-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.

------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax




-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.




-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.

------------------------------------------------------------------------------

_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax