[Gmod-ajax] Fwd: Dynamic coloring in JBRowse

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

[Gmod-ajax] Fwd: Dynamic coloring in JBRowse

sinclaircooper

---------- Forwarded message ----------
From: Sinclair Cooper <[hidden email]>
Date: Wed, Jun 29, 2016 at 3:53 PM
Subject: Dynamic coloring in JBRowse
To: Robert Buels <[hidden email]>


Hi All, 


I was wondering if you can help me. 


(I've left an example track loaded).

It's working great for now however I'd like to add a little extra functionality, if you click on each of the reads as they appear in the browser just now it rather nicely brings up a load of information about each of the alignments. You will see that there is a score associated with each alignment.

What I'd like to do is to be able to colour each bar in a track individually to reflect its score. For example the range of possible scores is 85-100 (%) can I colour any alignments which fall below 90% grey (or make them more transparent)?


I'm a bit of a JavaScript newbie, so any pointers would be much appreciated.


Cheers
Sinclair Cooper 


p.s. I hope I have described the problem in enough detail! 


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: Fwd: Dynamic coloring in JBRowse

Saari, Travis

Sinclair,

 

Not on the dev team, but I can probably help you.

 

It looks like you’re using an older version of JBrowse with an HTMLfeatures track (which are now falling out of favor and being replaced by CanvasFeatures tracks), which makes this a bit more tricky in my opinion. You’ll have to use the modify hooks mentioned in the JBrowse configuration guide. Try the following in your trackList.json:

 

“key” : “This is your track”

“hooks” : {

   “modify” : “function(track, feature, div) { if (feature.get(‘similarity’) < 90) {div.style.backgroundColor = ‘grey’;}}”

},

“type” : “FeatureTrack”,

 

 

Try this out and see if it works.

 

Best,

 

Travis

 

From: Sinclair Cooper [mailto:[hidden email]]
Sent: Thursday, June 30, 2016 7:29 AM
To: [hidden email]
Subject: [Gmod-ajax] Fwd: Dynamic coloring in JBRowse

 

 

---------- Forwarded message ----------
From: Sinclair Cooper <[hidden email]>
Date: Wed, Jun 29, 2016 at 3:53 PM
Subject: Dynamic coloring in JBRowse
To: Robert Buels <[hidden email]>

Hi All, 

 

 

I was wondering if you can help me. 

 

 

(I've left an example track loaded).

 

It's working great for now however I'd like to add a little extra functionality, if you click on each of the reads as they appear in the browser just now it rather nicely brings up a load of information about each of the alignments. You will see that there is a score associated with each alignment.

 

What I'd like to do is to be able to colour each bar in a track individually to reflect its score. For example the range of possible scores is 85-100 (%) can I colour any alignments which fall below 90% grey (or make them more transparent)?

 

 

I'm a bit of a JavaScript newbie, so any pointers would be much appreciated.

 

 

Cheers

Sinclair Cooper 

 

 

p.s. I hope I have described the problem in enough detail! 

 


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax