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

Left click behavior do not work #784

Closed verne91 closed 8 years ago

verne91 commented 8 years ago

Hi,

When I configure the gff track, the "onClick" option do not work.

"onClick": { "action": "newWindow", "url": "function(track,feature,div) { return 'http://www.ncbi.nlm.nih.gov/gquery/?term='+this.feature.get('name'); }", "label": "Search for gene in database" }

When I click on gene, it seems that this.feature.get('name') returns nothing.

Thank you for your help!

cmdcolin commented 8 years ago

Do the genes themselves not have a "Name" field in your gff? You could just try this.feature.get('id') too

verne91 commented 8 years ago

@cmdcolin My gff file don't have a "Name" field, but have a "ID" field.

chr01 irgsp1_rep gene 2983 10815 . + . ID=Os01g0100100

However, After I tried this.feature.get('ID'), it still seems the click do not work. And the config file of this track missed "url" within "onClick".

"onClick": { "action": "newWindow", "label": "Search for gene in database" },

verne91 commented 8 years ago

When I change the "ID" to "id", it works. Thank you!

cmdcolin commented 8 years ago

Good to hear.

Here is some "documentation" about the feature.get functions in case that helps! http://gmod.org/wiki/JBrowse_FAQ#How_do_I_access_data_about_my_features_in_my_callback_or_plugin