From: Mitch S. <mit...@be...> - 2010-10-18 11:14:02
|
The current plan for this is to allow the user to specify a javascript function that gets called when features get put on screen, and can change the CSS style of a feature based on the feature data (which could include the ID, or whatever other information is in the JSON. I've been experimenting with this lately; for example, in ucsc-to-json.pl there's a bit of perl that specifies a javascript callback, but it will be possible to specify that on the command line for flatfile-to-json.pl or in a config file for biodb-to-json.pl: ========== my $color = sprintf("#%02x%02x%02x", $track->{colorR}, $track->{colorG}, $track->{colorB}); if ($subfeatures) { $style{subfeatureHeaders} = \@subfeatHeaders; $style{class} = "generic_parent"; $style{clientConfig}->{featureCallback} = <<ENDJS; function(feat, fields, div) { if (fields.type) { div.className = "basic"; switch (feat[fields.type]) { case "CDS": case "thick": div.style.height = "10px"; div.style.marginTop = "-3px"; break; case "UTR": case "thin": div.style.height = "6px"; div.style.marginTop = "-1px"; break; } div.style.backgroundColor = "$color"; } } ENDJS } ========== Currently, the callback gets the feature data, the "fields" object that specifies what's in the feature data, and the actual HTML element that will represent the feature. That's not necessarily the final interface, but it's what I'm currently experimenting with. This option should make it into the next release in December, but for now it's just work-in-progress. On the plus side, if you have opinions about how it should work, now's your chance to weigh in :) Mitch On 10/08/2010 04:09 AM, James Casbon wrote: > I'd like to see this as well. My preference would be to assign > colours based on the read group annotations in the BAM file. > > On 8 October 2010 11:52, James Morris<jm...@sa...> wrote: >> Hello, >> >> I am using Jbrowse to view some RNAseq data just on my local machine. >> >> Is it possible to colour the reads in a single track differently based on information I have in the id. >> >> I have 256 different classes (based on a 4bp sequence) so simply creating separate tracks for each class would not work as there would be too many tracks to view at once. >> >> If I could colour the reads I think it will be easy to visualise the distribution of the different classes at points where the reads pileup. >> >> Any help on this would be great. >> >> Thanks, >> >> James >> >> -- >> The Wellcome Trust Sanger Institute is operated by Genome Research >> Limited, a charity registered in England with number 1021457 and a >> company registered in England with number 2742969, whose registered >> office is 215 Euston Road, London, NW1 2BE. >> >> ------------------------------------------------------------------------------ >> Beautiful is writing same markup. Internet Explorer 9 supports >> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3. >> Spend less time writing and rewriting code and more time creating great >> experiences on the web. Be a part of the beta today. >> http://p.sf.net/sfu/beautyoftheweb >> _______________________________________________ >> Gmod-ajax mailing list >> Gmo...@li... >> https://lists.sourceforge.net/lists/listinfo/gmod-ajax >> > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today. > http://p.sf.net/sfu/beautyoftheweb > _______________________________________________ > Gmod-ajax mailing list > Gmo...@li... > https://lists.sourceforge.net/lists/listinfo/gmod-ajax |