dasmoth / dalliance

Interactive web-based genome browser.
http://www.biodalliance.org/
BSD 2-Clause "Simplified" License
226 stars 68 forks source link

bed file stylesheet for coloring exons between thickStart to thickEnd a different color than other exons #217

Closed max-l closed 7 years ago

max-l commented 7 years ago

I'm strugging to understand the stylesheet language, I'm trying to write a stylesheet that does this :

  1. exons that are between thickStart are thinkEnd are red boxes
  2. exons that are not are colored white
  3. introns have a flat line

For the following bed file : 1 31005964 31007022 IP_061670.1 500 - 31005964 31006031 255,0,0 2 67,29 0,1029

the first segment [0,67] would be red, and the second segment starting at 1029 would be a white box

I've been trying to understand this doc : http://biodas.open-bio.org/documents/spec-1.6.html but what is mostly not clear is how the bed file is interpreted, I see that there are types (like translation, transcript, ytr, etc...), how does it assign types to segments of bed tracks.

max-l commented 7 years ago

Ok, this stylesheet does what I want :

 [{type: 'transcript',
    style: {
      glyph: 'BOX',
      HEIGHT: 10,
      FGCOLOR: 'black',
      BGCOLOR: 'white',
      BUMP: 'yes',
      LABEL: 'yes'
    }
  },
  {type: 'translation'
    style: {
      glyph: 'BOX',
      HEIGHT: 10,
      FGCOLOR: 'black',
      BGCOLOR: 'red'
 }}]

However it does not work with the following bed segment :

1   8861359 8868018 IP_058472.1 500 -   8861359 8868018 255,0,0 8   70,59,109,202,198,223,134,31    0,1527,1875,2531,3925,4919,5757,6628

there are 8 exons (blocks), and Dalliance assignes bloks 2 and 8 as transcripts (white) and the rest as translations (red)

dasmoth commented 7 years ago

Thanks, fixed. It looks like there were a few cases this could potentially happen, but were generally being masked by the way we normally end using gene tracks with transcripts collapsed together. Fixed now in master.

Relatedly: while your stylesheet generally looks good, because the "translation" features are meant to be rendered on top of the "transcript" features, you need to add a ZINDEX property to both of these. Exact values don't matter, but important to give translations a ZINDEX which is numerically greater than transcripts (for what it's worth, the default stylesheet has transcript ZINDEX=10 and translation ZINDEX=20.