[Gmod-ajax] Feature Sequence

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

Re: Feature Sequence

Colin
Hey Travis,
Sorry for the delay. Any updates?

This snippet seems to be used in some places to get the sequence


browser.getStore('refseqs', function(refSeqStore) {
    refSeqStore.getReferenceSequence({ref: 'ctgA', start: 1, end: 1000}, function(seq) {
         alert(seq)
    })
})


Similar example in the code that Vivek linked



Hope that helps!


-Colin

On Tue, Dec 15, 2015 at 9:29 AM, Saari, Travis <[hidden email]> wrote:

I’m beginning work on the plugin, but attempting to configure a track as described below does not work, and I’m getting the error ‘Uncaught ReferenceError: getFeatureSequence is not defined.’

 

How can I get trackList.json to recognize my function? Are there any other alternative ways to accomplish a right-click customized function?

 

The console is reporting that my plugin has started, and within it I’ve just created a simple function getFeatureSequence that returns ‘FooBarBaz’ for testing.

 

 

From: Krishnakumar, Vivek [mailto:[hidden email]]
Sent: Wednesday, December 09, 2015 10:12 AM


To: Saari, Travis <[hidden email]>
Cc: [hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

HI Travis,

 

Depending on how you want your users to be able to invoke this functionality, you could do something like the following.

 

Once your code is in the plugin, you can configure a particular track with the following menuTemplate entry which has a callback to your method (I’m assuming your method is called GetFeatureSequence() in the example below):

 

    "menuTemplate" : [

        {

           "content" : "function(track,feature,div){ return GetFeatureSequence(track, feature, div); }",

           "iconClass" : "dijitIconDatabase",

           "action" : "contentDialog",

           "label" : “Feature Sequence"

        }  

    ],

 

Your method could construct a display which will be placed into the contentDialog popup box (similar to the “View Details” popup we see right now).

 

Does this make sense?

 

Thank you.

Vivek

 

On Dec 9, 2015, at 10:55 AM, Saari, Travis <[hidden email]> wrote:

 

Thanks Vivek,

 

If I were to implement this as a plugin (which I agree would be a good idea in the long-run), do you have an example of how I could add this functionality to a specific track’s right-click menu? This is the reason why I decided to go with the functions.conf route in the first place; it was easy for me to figure out.

 

Best,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" value="+12185295178" target="_blank">218. 529.5178

 

 

 

From: Krishnakumar, Vivek [[hidden email]] 
Sent: Wednesday, December 09, 2015 8:56 AM
To: Saari, Travis <[hidden email]>
Cc: [hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis, 

 

If the functionality you are developing is elaborate (I’m assuming it is), you might be better off integrating it into JBrowse via its plugin framework instead of writing methods and including them within functions.conf. It will be more portable and usable globally.

 

You can see the current catalog of plugins available here: https://github.com/GMOD/jbrowse/tree/master/plugins

 

And, you can follow the documentation here: http://gmod.org/wiki/JBrowse_Configuration_Guide#Writing_JBrowse_Plugins, which describes how to write JBrowse plugins.

 

When developing this as a plugin, you should be able to easily mixin JBrowse/Util into the scope of your plugin (like so: https://github.com/GMOD/jbrowse/blob/2130b4593c60a2d827be897bc9d3e4301dd3cc5d/src/JBrowse/View/Track/_FeatureDetailMixin.js#L10) and then call it as Util.revcom().

 

If however you want to go the functions.conf route, you would have to implement your own reverse complementation method.

 

Hope this helps!

 

Thank you.

Vivek

 

On Dec 9, 2015, at 9:46 AM, Saari, Travis <[hidden email]> wrote:

 

Thanks Vivek and Eric for your help so far. My function is almost complete!

 

The last hurdle for me is the reverse complementation. I’m not sure how to use the revcom function defined in Util.js from within my function I’ve defined in functions.conf. If I try to use Util.revcom(seq); as in _FeatureDetailMixin.js, I get ReferenceError: Util is not defined … etc.  

 

Is there a way to ‘include’ Util.js to use revcom() within my functions.conf? Any other solutions?

 

Thanks,

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" value="+12185295178" target="_blank">218. 529.5178

 

 

 

 

From: Krishnakumar, Vivek [[hidden email]] 
Sent: Friday, December 04, 2015 11:30 AM
To: Saari, Travis <
[hidden email]>
Cc: Eric Yao <
[hidden email]>; [hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis, 

 

I think the section of code (highlighted in the link below) from _FeatureDetailMixin.js should be able to explain how you can get access to the refSeqs store containing the reference sequence, following which you should be able to extract snippets and even perform reverse complementation.

 

 

Hope this helps!

 

Thank you.

Vivek

 

On Dec 4, 2015, at 11:43 AM, Saari, Travis <[hidden email]> wrote:

 

I’ve constructed part of a function in my functions.conf, and have been able to create the region string, but cannot successfully use getReferenceSequence no matter what I try. I’ve attached the copied console log with errors if that helps. Below I also have what I’ve done so far and what I aim to achieve.

 

Here’s what I’ve got so far:

 

getSeq = function(track,feature,div) {

                var subfeatures = feature.get(‘subfeatures’);

                if (subfeatures && subfeatures.length)  {

                                subfeatures.forEach(function(feature) {

                                                var regionString = ‘ref:’+feature.get(‘seq_id’)+’,start:’+feature.get(‘start’)+’,end:’+feature.get(‘end’);

                                                console.log(regionString);

                                                track.store.getReferenceSequence(regionString,

function(seq){ console.log(seq);},

function(){}

);

                                }

                }

                return ‘Foo’;

  }

 

In my trackList.json file, I just have

“content” : “{getSeq}”,

 

Which obviously just puts Foo in the dialog box for now. The console is correctly displaying the region strings that were created (I hope that I’m correct in assuming that the first argument for getReferenceSequence is a string in this form). I’m not sure how to use the getReferenceSequence function to do what I want.

 

This is basically what I’m aiming to do:

 

subfeatures.forEach(function(feature) {

                //get reference sequence for current feature

                //Util.revcom if feature.strand == -1

                //hopefully we have a string of residues now

                //maybe push to an array?

}

//assemble sequence strings in appropriate order depending on feature strand and feature type

//return completed string for display in dialog box

 

I should be able to figure out everything except for using the getReferenceSequence function, and perhaps the revcom function.

 

Thanks for assistance,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" value="+12185295178" target="_blank">218. 529.5178

 

 

               

 

From: Saari, Travis 
Sent: Wednesday, December 02, 2015 12:41 PM
To: 'Eric Yao' <
[hidden email]>
Cc: 
[hidden email]
Subject: RE: [Gmod-ajax] Feature Sequence

 

Changing the type to HTMLFeatures did not seem to make a difference.

 

I’ve attached a snippet of my gff3 file which  I loaded in using the flatfile-to-json perl script. I’ve also attached an archive of the directory data/tracks/{Example}/JNCD01007648.1, which was generated by the perl script. 

 

Let me know what you think!

 

 

Thanks,

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" value="+12185295178" target="_blank">218. 529.5178

 

 

 

From: Eric Yao [[hidden email]] 
Sent: Tuesday, December 01, 2015 5:53 PM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hmm...

Not sure what's going on there.

Can you try it with "type": "JBrowse/View/Track/HTMLFeatures" ?

Otherwise, can you share your dataset with me so I can take a closer look?

 

 

On Tue, Dec 1, 2015 at 8:55 AM, Saari, Travis <[hidden email]> wrote:

Thanks for the help, Eric.

 

I was able to get the label to work with ‘id’, but not with ‘name’ or ‘Name’. Interesting. Also, the content dialog with the given line only displays “seq data =” and nothing else. Is this what you’re talking about when you’re saying that I’d have to take steps to handle the sequence data, or is this something just not working?

 

Testing a little further, “content” : “function(track,feature,div) { return feature.get(‘start’);}” comes up  as undefined. Same with ‘end’. ‘seq_id’ is successfully displayed, however.

 

Thanks,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

From: Eric Yao [mailto:[hidden email]] 
Sent: Tuesday, December 01, 2015 1:57 AM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email]

Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis, 

 

I think your function for label needs to be something like: 

 "label": "function(track,feature,div) { return feature.get('name'); }"

 

You should also be able to get the feature sequence with: 

 

"content": "function(track,feature,div) { track.store.getReferenceSequence({ref:feature.get('seq_id'),start:feature.get('start'),end:feature.get('end')},function(seq) { alert('seq data='+seq); },function(){});}"

 

It is a call back that receives the sequence data, so you'd have to take steps to handle it with this method.

(there might be an easier way -- not sure what it is)

 

Eric

 

On Mon, Nov 30, 2015 at 12:48 PM, Saari, Travis <[hidden email]> wrote:

I’m having trouble with calling functions from within trackList.json, even when using example functions from the volvox example. It seems that I’m not able to access the feature’s attributes, perhaps due to the use of the NClist store class.

 

I’ve copied the functions.conf file from the volvox example into my data directory, and included it in trackList.json. I can successfully call {randomNumberTitle}, but cannot successfully use {nameViaCallback}, since feature.get(‘Name’) seems to be undefined. I’m able to access any attributes that I’ve loaded into the GFF file by using curly brackets ( e.g. ‘This displays the Entrezgene_ID: {entrezgene_id}’ ). I can also do the following “label” : “function() { return ‘FooBar’ }”, but I cannot do “label” : “function(feature) { return feature.get(‘Name’) }”

 

Am I correct in assuming it’s the store class? I have not been able to change it to SeqFeature without breaking the track completely, so I’d like a suggestion on how to go about this. I’m currently using:

 

“type” : “FeatureTrack”,

“storeClass” : “JBrowse/Store/SeqFeature/NCList”,

“urlTemplate” : “tracks/example_track/{refseq}/trackData.json”,

… etc. etc.

 

Thanks,

 

Travis

 

From: Saari, Travis [mailto:[hidden email]] 
Sent: Monday, November 23, 2015 2:42 PM
To: Ian Holmes <
[hidden email]>
Cc: 
[hidden email]; [hidden email]


Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Ian,

 

Thanks for the reply. I just now saw that you posted a comment on the github page. I see what you mean about not being able to highlight a feature. I think a right-click option would suffice. If I right-click on a parent feature with several children, all of the information is within the ‘View Details’ dialog, but in separate text boxes. If I could concatenate the sequences of a given type and put them into a single container I think we’d be in business.

 

Any hints on how to start?

 

Thanks for the help,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

From: Ian Holmes [[hidden email]] 
Sent: Monday, November 23, 2015 1:59 PM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email]; [hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis,
The JBrowse/Store/SeqFeature object has a getReferenceSequence method that returns the reference sequence for a given feature. This is used by JBrowse/View/Track/_FeatureDetailMixin to implement the "Region sequence" field in the feature default window that you get by right-clicking on a feature (in an HTMLFeatures or CanvasFeatures track) and selecting "View details". Since JBrowse does not currently have a way of selecting a feature per se (just highlighting a region of sequence), I'm not sure exactly how you want this feature to look in JBrowse, but it should be possible. I suspect someone in the community may even have done it but I'm not sure.
Cheers,
Ian

 

On Mon, Nov 23, 2015 at 11:55 AM, Saari, Travis <[hidden email]> wrote:

Hi all,

 

I posted the following issue to the github page: https://github.com/GMOD/jbrowse/issues/659 and was instructed by Nathan to send an e-mail to you all to see if something like this was possible.

 

My goal is to have an export function for the sequence of a feature, for instance a predicted gene. In In Apollo, the annotation tracks have this functionality. I would like to do the same thing for non-annotation tracks, and preferably within JBrowse itself as I do not have an Apollo instance running on a server yet.

 

Thanks,

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax

 


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax

 

 

<getSeq_console.log>------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140_______________________________________________
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



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

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

Re: Feature Sequence

Saari, Travis

Hi Colin,

 

Thanks for the response. I’ve got something that works for me in functions.conf right now, but I’d like to implement the feature as a plugin so that it’d be useful to others (and also possibly to extend the functionality while keeping it tidy).

 

My problem is that I’m unsure how to add the function to the right-click menus of certain tracks if I have the functions defined in a plugin (rather than functions.conf). Any ideas?

 

Best,

 

Travis

 

 

From: Colin [mailto:[hidden email]]
Sent: Friday, December 18, 2015 8:27 AM
To: Saari, Travis <[hidden email]>
Cc: Krishnakumar, Vivek <[hidden email]>; [hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hey Travis,

Sorry for the delay. Any updates?

 

This snippet seems to be used in some places to get the sequence

 

 

browser.getStore('refseqs', function(refSeqStore) {

    refSeqStore.getReferenceSequence({ref: 'ctgA', start: 1, end: 1000}, function(seq) {

         alert(seq)

    })

})

 

Similar example in the code that Vivek linked

 

 

Hope that helps!

 

 

-Colin

 

On Tue, Dec 15, 2015 at 9:29 AM, Saari, Travis <[hidden email]> wrote:

I’m beginning work on the plugin, but attempting to configure a track as described below does not work, and I’m getting the error ‘Uncaught ReferenceError: getFeatureSequence is not defined.’

 

How can I get trackList.json to recognize my function? Are there any other alternative ways to accomplish a right-click customized function?

 

The console is reporting that my plugin has started, and within it I’ve just created a simple function getFeatureSequence that returns ‘FooBarBaz’ for testing.

 

 

From: Krishnakumar, Vivek [mailto:[hidden email]]
Sent: Wednesday, December 09, 2015 10:12 AM


To: Saari, Travis <[hidden email]>
Cc: [hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

HI Travis,

 

Depending on how you want your users to be able to invoke this functionality, you could do something like the following.

 

Once your code is in the plugin, you can configure a particular track with the following menuTemplate entry which has a callback to your method (I’m assuming your method is called GetFeatureSequence() in the example below):

 

    "menuTemplate" : [

        {

           "content" : "function(track,feature,div){ return GetFeatureSequence(track, feature, div); }",

           "iconClass" : "dijitIconDatabase",

           "action" : "contentDialog",

           "label" : “Feature Sequence"

        }  

    ],

 

Your method could construct a display which will be placed into the contentDialog popup box (similar to the “View Details” popup we see right now).

 

Does this make sense?

 

Thank you.

Vivek

 

On Dec 9, 2015, at 10:55 AM, Saari, Travis <[hidden email]> wrote:

 

Thanks Vivek,

 

If I were to implement this as a plugin (which I agree would be a good idea in the long-run), do you have an example of how I could add this functionality to a specific track’s right-click menu? This is the reason why I decided to go with the functions.conf route in the first place; it was easy for me to figure out.

 

Best,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

 

 

From: Krishnakumar, Vivek [[hidden email]
Sent: Wednesday, December 09, 2015 8:56 AM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis, 

 

If the functionality you are developing is elaborate (I’m assuming it is), you might be better off integrating it into JBrowse via its plugin framework instead of writing methods and including them within functions.conf. It will be more portable and usable globally.

 

You can see the current catalog of plugins available here: https://github.com/GMOD/jbrowse/tree/master/plugins

 

And, you can follow the documentation here: http://gmod.org/wiki/JBrowse_Configuration_Guide#Writing_JBrowse_Plugins, which describes how to write JBrowse plugins.

 

When developing this as a plugin, you should be able to easily mixin JBrowse/Util into the scope of your plugin (like so: https://github.com/GMOD/jbrowse/blob/2130b4593c60a2d827be897bc9d3e4301dd3cc5d/src/JBrowse/View/Track/_FeatureDetailMixin.js#L10) and then call it as Util.revcom().

 

If however you want to go the functions.conf route, you would have to implement your own reverse complementation method.

 

Hope this helps!

 

Thank you.

Vivek

 

On Dec 9, 2015, at 9:46 AM, Saari, Travis <[hidden email]> wrote:

 

Thanks Vivek and Eric for your help so far. My function is almost complete!

 

The last hurdle for me is the reverse complementation. I’m not sure how to use the revcom function defined in Util.js from within my function I’ve defined in functions.conf. If I try to use Util.revcom(seq); as in _FeatureDetailMixin.js, I get ReferenceError: Util is not defined … etc.  

 

Is there a way to ‘include’ Util.js to use revcom() within my functions.conf? Any other solutions?

 

Thanks,

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

 

 

 

From: Krishnakumar, Vivek [[hidden email]
Sent: Friday, December 04, 2015 11:30 AM
To: Saari, Travis <
[hidden email]>
Cc: Eric Yao <
[hidden email]>; [hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis, 

 

I think the section of code (highlighted in the link below) from _FeatureDetailMixin.js should be able to explain how you can get access to the refSeqs store containing the reference sequence, following which you should be able to extract snippets and even perform reverse complementation.

 

 

Hope this helps!

 

Thank you.

Vivek

 

On Dec 4, 2015, at 11:43 AM, Saari, Travis <[hidden email]> wrote:

 

I’ve constructed part of a function in my functions.conf, and have been able to create the region string, but cannot successfully use getReferenceSequence no matter what I try. I’ve attached the copied console log with errors if that helps. Below I also have what I’ve done so far and what I aim to achieve.

 

Here’s what I’ve got so far:

 

getSeq = function(track,feature,div) {

                var subfeatures = feature.get(‘subfeatures’);

                if (subfeatures && subfeatures.length)  {

                                subfeatures.forEach(function(feature) {

                                                var regionString = ‘ref:’+feature.get(‘seq_id’)+’,start:’+feature.get(‘start’)+’,end:’+feature.get(‘end’);

                                                console.log(regionString);

                                                track.store.getReferenceSequence(regionString,

function(seq){ console.log(seq);},

function(){}

);

                                }

                }

                return ‘Foo’;

  }

 

In my trackList.json file, I just have

“content” : “{getSeq}”,

 

Which obviously just puts Foo in the dialog box for now. The console is correctly displaying the region strings that were created (I hope that I’m correct in assuming that the first argument for getReferenceSequence is a string in this form). I’m not sure how to use the getReferenceSequence function to do what I want.

 

This is basically what I’m aiming to do:

 

subfeatures.forEach(function(feature) {

                //get reference sequence for current feature

                //Util.revcom if feature.strand == -1

                //hopefully we have a string of residues now

                //maybe push to an array?

}

//assemble sequence strings in appropriate order depending on feature strand and feature type

//return completed string for display in dialog box

 

I should be able to figure out everything except for using the getReferenceSequence function, and perhaps the revcom function.

 

Thanks for assistance,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

 

               

 

From: Saari, Travis 
Sent: Wednesday, December 02, 2015 12:41 PM
To: 'Eric Yao' <
[hidden email]>
Cc: 
[hidden email]
Subject: RE: [Gmod-ajax] Feature Sequence

 

Changing the type to HTMLFeatures did not seem to make a difference.

 

I’ve attached a snippet of my gff3 file which  I loaded in using the flatfile-to-json perl script. I’ve also attached an archive of the directory data/tracks/{Example}/JNCD01007648.1, which was generated by the perl script. 

 

Let me know what you think!

 

 

Thanks,

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

 

 

From: Eric Yao [[hidden email]
Sent: Tuesday, December 01, 2015 5:53 PM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hmm...

Not sure what's going on there.

Can you try it with "type": "JBrowse/View/Track/HTMLFeatures" ?

Otherwise, can you share your dataset with me so I can take a closer look?

 

 

On Tue, Dec 1, 2015 at 8:55 AM, Saari, Travis <[hidden email]> wrote:

Thanks for the help, Eric.

 

I was able to get the label to work with ‘id’, but not with ‘name’ or ‘Name’. Interesting. Also, the content dialog with the given line only displays “seq data =” and nothing else. Is this what you’re talking about when you’re saying that I’d have to take steps to handle the sequence data, or is this something just not working?

 

Testing a little further, “content” : “function(track,feature,div) { return feature.get(‘start’);}” comes up  as undefined. Same with ‘end’. ‘seq_id’ is successfully displayed, however.

 

Thanks,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

From: Eric Yao [mailto:[hidden email]
Sent: Tuesday, December 01, 2015 1:57 AM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email]

Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis, 

 

I think your function for label needs to be something like: 

 "label": "function(track,feature,div) { return feature.get('name'); }"

 

You should also be able to get the feature sequence with: 

 

"content": "function(track,feature,div) { track.store.getReferenceSequence({ref:feature.get('seq_id'),start:feature.get('start'),end:feature.get('end')},function(seq) { alert('seq data='+seq); },function(){});}"

 

It is a call back that receives the sequence data, so you'd have to take steps to handle it with this method.

(there might be an easier way -- not sure what it is)

 

Eric

 

On Mon, Nov 30, 2015 at 12:48 PM, Saari, Travis <[hidden email]> wrote:

I’m having trouble with calling functions from within trackList.json, even when using example functions from the volvox example. It seems that I’m not able to access the feature’s attributes, perhaps due to the use of the NClist store class.

 

I’ve copied the functions.conf file from the volvox example into my data directory, and included it in trackList.json. I can successfully call {randomNumberTitle}, but cannot successfully use {nameViaCallback}, since feature.get(‘Name’) seems to be undefined. I’m able to access any attributes that I’ve loaded into the GFF file by using curly brackets ( e.g. ‘This displays the Entrezgene_ID: {entrezgene_id}’ ). I can also do the following “label” : “function() { return ‘FooBar’ }”, but I cannot do “label” : “function(feature) { return feature.get(‘Name’) }”

 

Am I correct in assuming it’s the store class? I have not been able to change it to SeqFeature without breaking the track completely, so I’d like a suggestion on how to go about this. I’m currently using:

 

“type” : “FeatureTrack”,

“storeClass” : “JBrowse/Store/SeqFeature/NCList”,

“urlTemplate” : “tracks/example_track/{refseq}/trackData.json”,

… etc. etc.

 

Thanks,

 

Travis

 

From: Saari, Travis [mailto:[hidden email]
Sent: Monday, November 23, 2015 2:42 PM
To: Ian Holmes <
[hidden email]>
Cc: 
[hidden email][hidden email]


Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Ian,

 

Thanks for the reply. I just now saw that you posted a comment on the github page. I see what you mean about not being able to highlight a feature. I think a right-click option would suffice. If I right-click on a parent feature with several children, all of the information is within the ‘View Details’ dialog, but in separate text boxes. If I could concatenate the sequences of a given type and put them into a single container I think we’d be in business.

 

Any hints on how to start?

 

Thanks for the help,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

From: Ian Holmes [[hidden email]
Sent: Monday, November 23, 2015 1:59 PM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email][hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis,
The JBrowse/Store/SeqFeature object has a getReferenceSequence method that returns the reference sequence for a given feature. This is used by JBrowse/View/Track/_FeatureDetailMixin to implement the "Region sequence" field in the feature default window that you get by right-clicking on a feature (in an HTMLFeatures or CanvasFeatures track) and selecting "View details". Since JBrowse does not currently have a way of selecting a feature per se (just highlighting a region of sequence), I'm not sure exactly how you want this feature to look in JBrowse, but it should be possible. I suspect someone in the community may even have done it but I'm not sure.
Cheers,
Ian

 

On Mon, Nov 23, 2015 at 11:55 AM, Saari, Travis <[hidden email]> wrote:

Hi all,

 

I posted the following issue to the github page: https://github.com/GMOD/jbrowse/issues/659 and was instructed by Nathan to send an e-mail to you all to see if something like this was possible.

 

My goal is to have an export function for the sequence of a feature, for instance a predicted gene. In In Apollo, the annotation tracks have this functionality. I would like to do the same thing for non-annotation tracks, and preferably within JBrowse itself as I do not have an Apollo instance running on a server yet.

 

Thanks,

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax

 


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax

 

 

<getSeq_console.log>------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140_______________________________________________
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

 


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

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

Re: Feature Sequence

Colin
Oh I see. I had confused the getReferenceSequence with your plugin's function getFeatureSequence :)

I suppose maybe a fancy right click function could be like this. It uses the "this.track" and "this.feature" inside the callback in sort of fancy ways, and it's untested, but might work

            {
               "iconClass" : "dijitIconDatabase",
               "action" : "function() { this.track.browser.getPlugin('YourPlugin', dojo.hitch(this, function(yourplugin) { alert(yourplugin.getFeatureSequence(this.feature)) }); }",
               "label" : "Popup with content snippet from string (feature {name})"
            }


-Colin

On Fri, Dec 18, 2015 at 10:22 AM, Saari, Travis <[hidden email]> wrote:

Hi Colin,

 

Thanks for the response. I’ve got something that works for me in functions.conf right now, but I’d like to implement the feature as a plugin so that it’d be useful to others (and also possibly to extend the functionality while keeping it tidy).

 

My problem is that I’m unsure how to add the function to the right-click menus of certain tracks if I have the functions defined in a plugin (rather than functions.conf). Any ideas?

 

Best,

 

Travis

 

 

From: Colin [mailto:[hidden email]]
Sent: Friday, December 18, 2015 8:27 AM
To: Saari, Travis <[hidden email]>
Cc: Krishnakumar, Vivek <[hidden email]>; [hidden email]


Subject: Re: [Gmod-ajax] Feature Sequence

 

Hey Travis,

Sorry for the delay. Any updates?

 

This snippet seems to be used in some places to get the sequence

 

 

browser.getStore('refseqs', function(refSeqStore) {

    refSeqStore.getReferenceSequence({ref: 'ctgA', start: 1, end: 1000}, function(seq) {

         alert(seq)

    })

})

 

Similar example in the code that Vivek linked

 

 

Hope that helps!

 

 

-Colin

 

On Tue, Dec 15, 2015 at 9:29 AM, Saari, Travis <[hidden email]> wrote:

I’m beginning work on the plugin, but attempting to configure a track as described below does not work, and I’m getting the error ‘Uncaught ReferenceError: getFeatureSequence is not defined.’

 

How can I get trackList.json to recognize my function? Are there any other alternative ways to accomplish a right-click customized function?

 

The console is reporting that my plugin has started, and within it I’ve just created a simple function getFeatureSequence that returns ‘FooBarBaz’ for testing.

 

 

From: Krishnakumar, Vivek [mailto:[hidden email]]
Sent: Wednesday, December 09, 2015 10:12 AM


To: Saari, Travis <[hidden email]>
Cc: [hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

HI Travis,

 

Depending on how you want your users to be able to invoke this functionality, you could do something like the following.

 

Once your code is in the plugin, you can configure a particular track with the following menuTemplate entry which has a callback to your method (I’m assuming your method is called GetFeatureSequence() in the example below):

 

    "menuTemplate" : [

        {

           "content" : "function(track,feature,div){ return GetFeatureSequence(track, feature, div); }",

           "iconClass" : "dijitIconDatabase",

           "action" : "contentDialog",

           "label" : “Feature Sequence"

        }  

    ],

 

Your method could construct a display which will be placed into the contentDialog popup box (similar to the “View Details” popup we see right now).

 

Does this make sense?

 

Thank you.

Vivek

 

On Dec 9, 2015, at 10:55 AM, Saari, Travis <[hidden email]> wrote:

 

Thanks Vivek,

 

If I were to implement this as a plugin (which I agree would be a good idea in the long-run), do you have an example of how I could add this functionality to a specific track’s right-click menu? This is the reason why I decided to go with the functions.conf route in the first place; it was easy for me to figure out.

 

Best,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

 

 

From: Krishnakumar, Vivek [[hidden email]
Sent: Wednesday, December 09, 2015 8:56 AM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis, 

 

If the functionality you are developing is elaborate (I’m assuming it is), you might be better off integrating it into JBrowse via its plugin framework instead of writing methods and including them within functions.conf. It will be more portable and usable globally.

 

You can see the current catalog of plugins available here: https://github.com/GMOD/jbrowse/tree/master/plugins

 

And, you can follow the documentation here: http://gmod.org/wiki/JBrowse_Configuration_Guide#Writing_JBrowse_Plugins, which describes how to write JBrowse plugins.

 

When developing this as a plugin, you should be able to easily mixin JBrowse/Util into the scope of your plugin (like so: https://github.com/GMOD/jbrowse/blob/2130b4593c60a2d827be897bc9d3e4301dd3cc5d/src/JBrowse/View/Track/_FeatureDetailMixin.js#L10) and then call it as Util.revcom().

 

If however you want to go the functions.conf route, you would have to implement your own reverse complementation method.

 

Hope this helps!

 

Thank you.

Vivek

 

On Dec 9, 2015, at 9:46 AM, Saari, Travis <[hidden email]> wrote:

 

Thanks Vivek and Eric for your help so far. My function is almost complete!

 

The last hurdle for me is the reverse complementation. I’m not sure how to use the revcom function defined in Util.js from within my function I’ve defined in functions.conf. If I try to use Util.revcom(seq); as in _FeatureDetailMixin.js, I get ReferenceError: Util is not defined … etc.  

 

Is there a way to ‘include’ Util.js to use revcom() within my functions.conf? Any other solutions?

 

Thanks,

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

 

 

 

From: Krishnakumar, Vivek [[hidden email]
Sent: Friday, December 04, 2015 11:30 AM
To: Saari, Travis <
[hidden email]>
Cc: Eric Yao <
[hidden email]>; [hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis, 

 

I think the section of code (highlighted in the link below) from _FeatureDetailMixin.js should be able to explain how you can get access to the refSeqs store containing the reference sequence, following which you should be able to extract snippets and even perform reverse complementation.

 

 

Hope this helps!

 

Thank you.

Vivek

 

On Dec 4, 2015, at 11:43 AM, Saari, Travis <[hidden email]> wrote:

 

I’ve constructed part of a function in my functions.conf, and have been able to create the region string, but cannot successfully use getReferenceSequence no matter what I try. I’ve attached the copied console log with errors if that helps. Below I also have what I’ve done so far and what I aim to achieve.

 

Here’s what I’ve got so far:

 

getSeq = function(track,feature,div) {

                var subfeatures = feature.get(‘subfeatures’);

                if (subfeatures && subfeatures.length)  {

                                subfeatures.forEach(function(feature) {

                                                var regionString = ‘ref:’+feature.get(‘seq_id’)+’,start:’+feature.get(‘start’)+’,end:’+feature.get(‘end’);

                                                console.log(regionString);

                                                track.store.getReferenceSequence(regionString,

function(seq){ console.log(seq);},

function(){}

);

                                }

                }

                return ‘Foo’;

  }

 

In my trackList.json file, I just have

“content” : “{getSeq}”,

 

Which obviously just puts Foo in the dialog box for now. The console is correctly displaying the region strings that were created (I hope that I’m correct in assuming that the first argument for getReferenceSequence is a string in this form). I’m not sure how to use the getReferenceSequence function to do what I want.

 

This is basically what I’m aiming to do:

 

subfeatures.forEach(function(feature) {

                //get reference sequence for current feature

                //Util.revcom if feature.strand == -1

                //hopefully we have a string of residues now

                //maybe push to an array?

}

//assemble sequence strings in appropriate order depending on feature strand and feature type

//return completed string for display in dialog box

 

I should be able to figure out everything except for using the getReferenceSequence function, and perhaps the revcom function.

 

Thanks for assistance,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

 

               

 

From: Saari, Travis 
Sent: Wednesday, December 02, 2015 12:41 PM
To: 'Eric Yao' <
[hidden email]>
Cc: 
[hidden email]
Subject: RE: [Gmod-ajax] Feature Sequence

 

Changing the type to HTMLFeatures did not seem to make a difference.

 

I’ve attached a snippet of my gff3 file which  I loaded in using the flatfile-to-json perl script. I’ve also attached an archive of the directory data/tracks/{Example}/JNCD01007648.1, which was generated by the perl script. 

 

Let me know what you think!

 

 

Thanks,

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

 

 

From: Eric Yao [[hidden email]
Sent: Tuesday, December 01, 2015 5:53 PM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hmm...

Not sure what's going on there.

Can you try it with "type": "JBrowse/View/Track/HTMLFeatures" ?

Otherwise, can you share your dataset with me so I can take a closer look?

 

 

On Tue, Dec 1, 2015 at 8:55 AM, Saari, Travis <[hidden email]> wrote:

Thanks for the help, Eric.

 

I was able to get the label to work with ‘id’, but not with ‘name’ or ‘Name’. Interesting. Also, the content dialog with the given line only displays “seq data =” and nothing else. Is this what you’re talking about when you’re saying that I’d have to take steps to handle the sequence data, or is this something just not working?

 

Testing a little further, “content” : “function(track,feature,div) { return feature.get(‘start’);}” comes up  as undefined. Same with ‘end’. ‘seq_id’ is successfully displayed, however.

 

Thanks,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

From: Eric Yao [mailto:[hidden email]
Sent: Tuesday, December 01, 2015 1:57 AM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email]

Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis, 

 

I think your function for label needs to be something like: 

 "label": "function(track,feature,div) { return feature.get('name'); }"

 

You should also be able to get the feature sequence with: 

 

"content": "function(track,feature,div) { track.store.getReferenceSequence({ref:feature.get('seq_id'),start:feature.get('start'),end:feature.get('end')},function(seq) { alert('seq data='+seq); },function(){});}"

 

It is a call back that receives the sequence data, so you'd have to take steps to handle it with this method.

(there might be an easier way -- not sure what it is)

 

Eric

 

On Mon, Nov 30, 2015 at 12:48 PM, Saari, Travis <[hidden email]> wrote:

I’m having trouble with calling functions from within trackList.json, even when using example functions from the volvox example. It seems that I’m not able to access the feature’s attributes, perhaps due to the use of the NClist store class.

 

I’ve copied the functions.conf file from the volvox example into my data directory, and included it in trackList.json. I can successfully call {randomNumberTitle}, but cannot successfully use {nameViaCallback}, since feature.get(‘Name’) seems to be undefined. I’m able to access any attributes that I’ve loaded into the GFF file by using curly brackets ( e.g. ‘This displays the Entrezgene_ID: {entrezgene_id}’ ). I can also do the following “label” : “function() { return ‘FooBar’ }”, but I cannot do “label” : “function(feature) { return feature.get(‘Name’) }”

 

Am I correct in assuming it’s the store class? I have not been able to change it to SeqFeature without breaking the track completely, so I’d like a suggestion on how to go about this. I’m currently using:

 

“type” : “FeatureTrack”,

“storeClass” : “JBrowse/Store/SeqFeature/NCList”,

“urlTemplate” : “tracks/example_track/{refseq}/trackData.json”,

… etc. etc.

 

Thanks,

 

Travis

 

From: Saari, Travis [mailto:[hidden email]
Sent: Monday, November 23, 2015 2:42 PM
To: Ian Holmes <
[hidden email]>
Cc: 
[hidden email][hidden email]


Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Ian,

 

Thanks for the reply. I just now saw that you posted a comment on the github page. I see what you mean about not being able to highlight a feature. I think a right-click option would suffice. If I right-click on a parent feature with several children, all of the information is within the ‘View Details’ dialog, but in separate text boxes. If I could concatenate the sequences of a given type and put them into a single container I think we’d be in business.

 

Any hints on how to start?

 

Thanks for the help,

 

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 

From: Ian Holmes [[hidden email]
Sent: Monday, November 23, 2015 1:59 PM
To: Saari, Travis <
[hidden email]>
Cc: 
[hidden email][hidden email]
Subject: Re: [Gmod-ajax] Feature Sequence

 

Hi Travis,
The JBrowse/Store/SeqFeature object has a getReferenceSequence method that returns the reference sequence for a given feature. This is used by JBrowse/View/Track/_FeatureDetailMixin to implement the "Region sequence" field in the feature default window that you get by right-clicking on a feature (in an HTMLFeatures or CanvasFeatures track) and selecting "View details". Since JBrowse does not currently have a way of selecting a feature per se (just highlighting a region of sequence), I'm not sure exactly how you want this feature to look in JBrowse, but it should be possible. I suspect someone in the community may even have done it but I'm not sure.
Cheers,
Ian

 

On Mon, Nov 23, 2015 at 11:55 AM, Saari, Travis <[hidden email]> wrote:

Hi all,

 

I posted the following issue to the github page: https://github.com/GMOD/jbrowse/issues/659 and was instructed by Nathan to send an e-mail to you all to see if something like this was possible.

 

My goal is to have an export function for the sequence of a feature, for instance a predicted gene. In In Apollo, the annotation tracks have this functionality. I would like to do the same thing for non-annotation tracks, and preferably within JBrowse itself as I do not have an Apollo instance running on a server yet.

 

Thanks,

 

Travis Saari

Student Services Contractor at

US-EPA

Mid-Continent Ecology Division

<a href="tel:218.%20529.5178" target="_blank">218. 529.5178

 


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax

 


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax

 

 

<getSeq_console.log>------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140_______________________________________________
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

 



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

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