[Gmod-ajax] Zoom to Feature Function

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

[Gmod-ajax] Zoom to Feature Function

Paul Hale

I have a track that has features of widely varying size and I was wondering if there was a good way to go about implementing some sort of “Zoom to Feature” ability from within a right click menu.  I’ve managed to rig up an option that hyperlinks to whatever specific location that feature is at but it at the expense of reloading the entire page which is annoying.  It would be nice if I could take advantage of the rubber band zooming/un-zooming and accomplish this without reloading the whole browser window but I couldn’t find out if this was an option or not.

 

Thanks,

Paul Hale

Bioinformatics Analyst I

The Jackson Laboratory

 

The information in this email, including attachments, may be confidential and is intended solely for the addressee(s). If you believe you received this email by mistake, please notify the sender by return email as soon as possible.


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: Zoom to Feature Function

Robert Buels-2
This would probably be a useful feature for a lot of people.

The right approach would probably be to modify the default menuTemplate,
which is around line 157 or src/JBrowse/View/Track/CanvasFeatures.js, to
add a new menu item  to do this for the feature that was just
right-clicked.  You'd probably want something like (and this is not tested):

{ label: 'Zoom to this feature',
   action: function( track, feature ) {
        track.genomeView.setLocation( track.refSeq.name, feature.get('start'),
feature.get('end') );
   }
}

Would you be willing to try this out and submit a pull request with it
if it works?


Robert Buels
Lead Developer
JBrowse - http://jbrowse.org

On 02/06/2014 11:49 AM, Paul Hale wrote:

> I have a track that has features of widely varying size and I was
> wondering if there was a good way to go about implementing some sort of
> “Zoom to Feature” ability from within a right click menu.  I’ve managed
> to rig up an option that hyperlinks to whatever specific location that
> feature is at but it at the expense of reloading the entire page which
> is annoying.  It would be nice if I could take advantage of the rubber
> band zooming/un-zooming and accomplish this without reloading the whole
> browser window but I couldn’t find out if this was an option or not.
>
> Thanks,
>
> Paul Hale
>
> Bioinformatics Analyst I
>
> The Jackson Laboratory
>
> The information in this email, including attachments, may be
> confidential and is intended solely for the addressee(s). If you believe
> you received this email by mistake, please notify the sender by return
> email as soon as possible.
>
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Gmod-ajax mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gmod-ajax
>

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: Zoom to Feature Function

Paul Hale
Rob,

I feel like its close.  I have the following code...

{
                "label" : "Zoom to feature {name}",
                "action" : "function(track,feature){this.track.genomeView.setLocation(this.track.refSeq.name,this.feature.get('start'),this.feature.get('end'));}",
                "iconClass" : "dijitIconConnector"
 }
Which finds the refSeq, start and end fine.  It also can find the setLocation() function however upon trying to set it to anything, even hard coded values that I know are valid, I get a "RangeError: invalid array length" from dojo.js.  It does refresh the page but it removes all tracks and the genomic location and just goes blank.

Paul

-----Original Message-----
From: Robert Buels [mailto:[hidden email]]
Sent: Thursday, February 06, 2014 12:08 PM
To: Paul Hale; [hidden email]
Subject: Re: [Gmod-ajax] Zoom to Feature Function

This would probably be a useful feature for a lot of people.

The right approach would probably be to modify the default menuTemplate, which is around line 157 or src/JBrowse/View/Track/CanvasFeatures.js, to add a new menu item  to do this for the feature that was just right-clicked.  You'd probably want something like (and this is not tested):

{ label: 'Zoom to this feature',
   action: function( track, feature ) {
        track.genomeView.setLocation( track.refSeq.name, feature.get('start'),
feature.get('end') );
   }
}

Would you be willing to try this out and submit a pull request with it if it works?


Robert Buels
Lead Developer
JBrowse - http://jbrowse.org

On 02/06/2014 11:49 AM, Paul Hale wrote:

> I have a track that has features of widely varying size and I was
> wondering if there was a good way to go about implementing some sort of
> "Zoom to Feature" ability from within a right click menu.  I've managed
> to rig up an option that hyperlinks to whatever specific location that
> feature is at but it at the expense of reloading the entire page which
> is annoying.  It would be nice if I could take advantage of the rubber
> band zooming/un-zooming and accomplish this without reloading the whole
> browser window but I couldn't find out if this was an option or not.
>
> Thanks,
>
> Paul Hale
>
> Bioinformatics Analyst I
>
> The Jackson Laboratory
>
> The information in this email, including attachments, may be
> confidential and is intended solely for the addressee(s). If you believe
> you received this email by mistake, please notify the sender by return
> email as soon as possible.
>
>
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Gmod-ajax mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gmod-ajax
>

The information in this email, including attachments, may be confidential and is intended solely for the addressee(s). If you believe you received this email by mistake, please notify the sender by return email as soon as possible.

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: Zoom to Feature Function

Robert Buels-2
Nice work!  Thank you!  I was able to take it the rest of the way, and
add about 10 pixels of padding on each side of the feature.  It will
come out in 1.11.3.

In the meantime, here is the working one that you can use in your local
config:


{
   "label" : "function() { \
       return 'Zoom to this '+( this.feature.get('type') || 'feature' );\
   }",
   "action" : "function() { \
       var ref   = this.track.refSeq; \
       var paddingBp = Math.round( \
         10 /*pixels*/ / this.viewInfo.scale /* px/bp */  \
       ); \
       var start = Math.max( \
         ref.start, \
         this.feature.get('start') - paddingBp \
       ); \
       var end = Math.min( \
         ref.end, \
         this.feature.get('end') + paddingBp \
       ); \
       this.track.genomeView.setLocation( ref, start, end ); \
   }",
   "iconClass" : "dijitIconConnector"
}


Robert Buels
Lead Developer
JBrowse - http://jbrowse.org

On 02/06/2014 02:07 PM, Paul Hale wrote:

> Rob,
>
> I feel like its close.  I have the following code...
>
> {
>                  "label" : "Zoom to feature {name}",
>                  "action" : "function(track,feature){this.track.genomeView.setLocation(this.track.refSeq.name,this.feature.get('start'),this.feature.get('end'));}",
>                  "iconClass" : "dijitIconConnector"
>   }
> Which finds the refSeq, start and end fine.  It also can find the setLocation() function however upon trying to set it to anything, even hard coded values that I know are valid, I get a "RangeError: invalid array length" from dojo.js.  It does refresh the page but it removes all tracks and the genomic location and just goes blank.
>
> Paul
>
> -----Original Message-----
> From: Robert Buels [mailto:[hidden email]]
> Sent: Thursday, February 06, 2014 12:08 PM
> To: Paul Hale; [hidden email]
> Subject: Re: [Gmod-ajax] Zoom to Feature Function
>
> This would probably be a useful feature for a lot of people.
>
> The right approach would probably be to modify the default menuTemplate, which is around line 157 or src/JBrowse/View/Track/CanvasFeatures.js, to add a new menu item  to do this for the feature that was just right-clicked.  You'd probably want something like (and this is not tested):
>
> { label: 'Zoom to this feature',
>     action: function( track, feature ) {
> track.genomeView.setLocation( track.refSeq.name, feature.get('start'),
> feature.get('end') );
>     }
> }
>
> Would you be willing to try this out and submit a pull request with it if it works?
>
>
> Robert Buels
> Lead Developer
> JBrowse - http://jbrowse.org
>
> On 02/06/2014 11:49 AM, Paul Hale wrote:
>> I have a track that has features of widely varying size and I was
>> wondering if there was a good way to go about implementing some sort of
>> "Zoom to Feature" ability from within a right click menu.  I've managed
>> to rig up an option that hyperlinks to whatever specific location that
>> feature is at but it at the expense of reloading the entire page which
>> is annoying.  It would be nice if I could take advantage of the rubber
>> band zooming/un-zooming and accomplish this without reloading the whole
>> browser window but I couldn't find out if this was an option or not.
>>
>> Thanks,
>>
>> Paul Hale
>>
>> Bioinformatics Analyst I
>>
>> The Jackson Laboratory
>>
>> The information in this email, including attachments, may be
>> confidential and is intended solely for the addressee(s). If you believe
>> you received this email by mistake, please notify the sender by return
>> email as soon as possible.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Managing the Performance of Cloud-Based Applications
>> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
>> Read the Whitepaper.
>> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
>>
>>
>>
>> _______________________________________________
>> Gmod-ajax mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gmod-ajax
>>
>
> The information in this email, including attachments, may be confidential and is intended solely for the addressee(s). If you believe you received this email by mistake, please notify the sender by return email as soon as possible.
>

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax