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
460 stars 199 forks source link

Track where glyph/features appearance can be individually altered according to attribures #318

Closed selewis closed 10 years ago

selewis commented 10 years ago

For example, variants that are known to be associated with particular phenotypes can be hidden or shown, or appear in different colors, based on what that phenotype is. That way you can see the landscape of phenotypes across different variants.

rbuels commented 10 years ago

I think you can already do this by writing JS callbacks in the JBrowse configuration. Is there a particular dataset we can test this on?

selewis commented 10 years ago

Not yet, but there will be by next week. We're adding phenotype attributes to variant file(s). I'll see what we can do with the JS callbacks for this.

What's currently available, or in the works, for multiple related input files driving a single track? I'll be needing this soon, so if not yet on the horizon, let's get it added.

On Aug 15, 2013, at 10:17 AM, Robert Buels notifications@github.com wrote:

I think you can already do this by writing JS callbacks in the JBrowse configuration. Is there a particular dataset we can test this on?

— Reply to this email directly or view it on GitHub.

rbuels commented 10 years ago

On 08/15/2013 04:28 PM, selewis wrote:

What's currently available, or in the works, for multiple related input files driving a single track? I'll be needing this soon, so if not yet on the horizon, let's get it added.

There aren't currently any track types that use multiple input files, except of course for the file+index ones.

Semantic zooming on steroids is on the horizon, (I think I'll just call it polymorphic tracks), which change their configuration based on things like the zoom level, sequence metadata, or what view they are attached to. Those could in theory be used with a BAM file and a corresponding BigWig showing its coverage, for example.

Do you have any specific cases in mind?

nicgirault commented 10 years ago

I got this issue. I currently use a JS callback function to change colors of features: "hooks" : { "modify" : "function( track, feature, div ) { if(feature.get('type') == 'SNV'){div.className = 'SNV';} else if(feature.get('name') == 'CNV'){div.className = 'CNV';} else if(feature.get('type') == 'trysomy'){div.className = 'trisomy';} else if(feature.get('type') == 'insertion'){div.className = 'hourglass hgred';} ......... }" }, where each className correspond to a css class. You can use get('phenotype') in your case.

However, this is working only with track type "JBrowse/View/Track/HTMLFeatures".

I would be interested to know if there is any way to do this with a canvasFeature track?

rbuels commented 10 years ago

Yes. It's just a slightly different configuration. I added some documentation about it to the wiki at: http://gmod.org/wiki/JBrowse_Configuration_Guide#Customizing_CanvasFeatures_tracks_with_callbacks

In your case, the equivalent CanvasFeatures configuration would be something like:

"color": "function(feature) { return {SNV:'red',CNV:'blue',trysomy:'purple',insertion:'red'}[feature.get('type')] || 'black'; }"

Also, if you are displaying data from a VCF file, you might want to use a CanvasVariants track, which is a CanvasFeatures track with an information popup that is better for VCF data.

Does that work for you?

nicgirault commented 10 years ago

It works great (there is just missing quotes around SNV, CNV...)! This new documentation is useful!

I also use VCF file with the HTMLVariants and changed it to CanvasVariants (is there documentation about it?). But I don't notice any difference with the HTMLVariants pop-up. Am I missing something?

I have another related question: I use hyperlinks in pop-ups but up-to-now I have to add the html tag in the gff file that I import (for example in the attribute field of the gff file I would write: "ID=<\a href%3D'http://mylink.org'>feature id<\/a>" although it's a bad way to handle it. I was thinking to develop a plugin but maybe there is a way to do so using a callback function. Would you have a tip? I tried something like "feature.setValue('ID') = <\a href%3D'http://mylink.org'>feature.get('ID')<\/a>" but it was not successful.

rbuels commented 10 years ago

On 11/22/2013 05:13 PM, nic.girault wrote:

I also use VCF file with the HTMLVariants and changed it to CanvasVariants (is there documentation about it?). But I don't notice any difference with the HTMLVariants pop-up. However for both Canvas and

The HTMLVariants and CanvasVariants tracks have the same popup. They are different from the ones in HTMLFeatures and CanvasFeatures.

HTML variants tracks I've got a small bug when I arrive at the end of the popup (when scrolling down with my trackpad): it goes back to the top as a cycle.

What browser and version do you see this on?

I have another related question: I use hyperlinks in pop-ups but up-to-now I have to add the html tag in the gff file that I import (for example in the attribute field of the gff file I would write: "ID=feature id" although it's a bad way to handle it. I was thinking to develop a plugin but maybe there is a way to do so using a callback function. Would you have a tip? I tried something like "feature.setValue('ID') = feature.get('ID')" but it was not successful.

You can't customize the default popup very much, but you can configure the popup to display something different, that you can take from javascript, a url on the same site, or even another site. See http://gmod.org/wiki/JBrowse_Configuration_Guide#Click_Configuration_Options. You can set "onClick" in your track to any of these things.

nicgirault commented 10 years ago

The bug in for JBrowse 1.10.7 with Chrome.

Thanks for the advise

rbuels commented 10 years ago

What version of Chrome? And what operating system?

nicgirault commented 10 years ago

Version 31.0.1650.57 and OSX 10.9

rbuels commented 10 years ago

I think the last little part of this (feature detail popup customization) is covered by #424, so closing this issue.