[Gmod-ajax] Using a callback for subParts

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

[Gmod-ajax] Using a callback for subParts

Scott Cain
Hi again,

Do you think this config should work:

      {
         "style" : {
            "className" : "feature",
            "color" : "function(feature) { var method = feature.get('type'); if (method.match(/pseudogene/i) || method.match(/ncrna/i) || method.match(/exon/i)  ) {return 'gray';} var strand = feature.get('strand'); if( strand && strand < 0 ) {return 'violet';} else {return 'turquoise';} }"
         },
         "key" : "Curated Genes",
         "storeClass" : "JBrowse/Store/SeqFeature/NCList",
         "trackType" : "CanvasFeatures",
         "urlTemplate" : "tracks/gene_from_gff/{refseq}/trackData.json",
         "compress" : 0,
         "label" : "Curated Genes",
         "category" : "Genes",

         "transcriptType" : "function(f) {var biotype = f.get('biotype'); if (biotype == 'pseudogene') {return 'pseudogenic_transcript';} return 'mRNA';  } ",

         "subParts" : "function(f) {var biotype = f.get('biotype'); if (biotype == 'pseudogene') {return 'exon';} else {return 'CDS,UTR,five_prime_UTR,three_prime_UTR';}  } ",

         "type" : "CanvasFeatures"
      },

In particular, I'm interested in the subParts callback; if I replace it with "exon" it works (though I loose utr coloring for mRNAs) but if I leave it as a callback the track fails to render.  I don't see anything particularly useful in the js console, but I'm not particularly adept at reading yet :-)

If you'd like to see an example, see this region:


Thanks,
Scott



--
------------------------------------------------------------------------
Scott Cain, Ph. D.                                   scott at scottcain dot net
GMOD Coordinator (http://gmod.org/)                     216-392-3087
Ontario Institute for Cancer Research

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax
Reply | Threaded
Open this post in threaded view
|

Re: Using a callback for subParts

Colin
The JBrowse configuration guide says "the glyph variable, and all of the style variables, support customization callbacks."
Perhaps with the glyph callback, you could create a ProcessedTranscripts glyph in some cases (with default subParts) and some custom type of PseudoTranscript glyph in other case (with exon subParts).

-Colin


On Thu, Jun 26, 2014 at 3:35 PM, Scott Cain <[hidden email]> wrote:
Hi again,

Do you think this config should work:

      {
         "style" : {
            "className" : "feature",
            "color" : "function(feature) { var method = feature.get('type'); if (method.match(/pseudogene/i) || method.match(/ncrna/i) || method.match(/exon/i)  ) {return 'gray';} var strand = feature.get('strand'); if( strand && strand < 0 ) {return 'violet';} else {return 'turquoise';} }"
         },
         "key" : "Curated Genes",
         "storeClass" : "JBrowse/Store/SeqFeature/NCList",
         "trackType" : "CanvasFeatures",
         "urlTemplate" : "tracks/gene_from_gff/{refseq}/trackData.json",
         "compress" : 0,
         "label" : "Curated Genes",
         "category" : "Genes",

         "transcriptType" : "function(f) {var biotype = f.get('biotype'); if (biotype == 'pseudogene') {return 'pseudogenic_transcript';} return 'mRNA';  } ",

         "subParts" : "function(f) {var biotype = f.get('biotype'); if (biotype == 'pseudogene') {return 'exon';} else {return 'CDS,UTR,five_prime_UTR,three_prime_UTR';}  } ",

         "type" : "CanvasFeatures"
      },

In particular, I'm interested in the subParts callback; if I replace it with "exon" it works (though I loose utr coloring for mRNAs) but if I leave it as a callback the track fails to render.  I don't see anything particularly useful in the js console, but I'm not particularly adept at reading yet :-)

If you'd like to see an example, see this region:


Thanks,
Scott



--
------------------------------------------------------------------------
Scott Cain, Ph. D.                                   scott at scottcain dot net
GMOD Coordinator (http://gmod.org/)                     <a href="tel:216-392-3087" value="+12163923087" target="_blank">216-392-3087
Ontario Institute for Cancer Research

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax



------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Gmod-ajax mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-ajax