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

ItemRgb not working for me #1615

Closed srobb1 closed 3 years ago

srobb1 commented 3 years ago

I have a bed file with rgb values in the 9th column. I would like to use these values to color my features. I see in the documentation that I should be able to add "ItemRgb": true to my config. I have done this but the colors do not change. Is there something I am missing?

Thank you, Sofia

Bed file line:

chr81   50142   51060   chr77_unloc.5   12760   +       50142   51060   255,253,153

Config:

{
  "maxFeatureSizeForUnderlyingRefSeq": 250000,
  "subfeatureDetailLevel": 2,
  "maxFeatureScreenDensity": 0.5,
  "enableCollapsedMouseover": false,
  "disableCollapsedClick": false,
  "maxFeatureGlyphExpansion": 500,
  "maxHeight": 600,
  "histograms": {
    "description": "feature density",
    "min": 0,
    "height": 100,
    "color": "goldenrod",
    "clip_marker_color": "red"
  },
  "style": {
    "_defaultHistScale": 4,
    "_defaultLabelScale": 30,
    "_defaultDescriptionScale": 120,
    "showLabels": true,
    "showTooltips": true,
    "label": "name,id",
    "description": "note, description",
    "className": "feature"
  },
  "displayMode": "normal",
  "events": {},
  "menuTemplate": [
    {
      "label": "View details",
      "title": "{type} {name}",
      "action": "contentDialog",
      "iconClass": "dijitIconTask"
    },
    {
      "iconClass": "dijitIconConnector"
    },
    {
      "iconClass": "dijitIconFilter"
    }
  ],
  "compress": 0,
  "key": "chr81msk_net",
  "label": "chr81msk_net.bed",
  "storeClass": "JBrowse/Store/SeqFeature/NCList",
  "ItemRgb": true,
  "trackType": "CanvasFeatures",
  "type": "JBrowse/View/Track/CanvasFeatures",
  "urlTemplate": "tracks/chr81msk_net.bed/{refseq}/trackData.json",
  "baseUrl": "https://simrbase.stowers.org/jbrowse/data/kPetMar1_v1/",
  "index": 26,
  "metadata": {}
}
cmdcolin commented 3 years ago

I think itemRgb is not by default enabled for tracks loaded with flatfile-to-json

It was a feature added for bigbed and for BED tabix tracks

It also is a setting that is available for only this glyph type: "glyph":"JBrowse/View/FeatureGlyph/UCSC/BED"

And then finally, it is a typo in the docs. It is itemRgb (lower case) instead of ItemRgb, but its enabled by default on that glyph type

cmdcolin commented 3 years ago

tldr: consider using BEDTabix storeClass + JBrowse/View/FeatureGlyph/UCSC/BED glyph type to try to get itemRgb to work, or use a custom color callback if continuing to use flatfile-to-json

srobb1 commented 3 years ago

itemRgb is listed in the canvas feature list of options. So just because it is in this tables doesn't mean I can use it with flatfile-to-json. Good to know. I was thinking if I can't get it to work this way, I know i can convert to GFF and use a callback with 9th column attributes. I am not sure how to use callbacks with bed files (not sure how to get data in a specific bed column).

I will look into using "glyph":"JBrowse/View/FeatureGlyph/UCSC/BED".

Thanks Colin.

Sofia

srobb1 commented 3 years ago

I GOT IT!!! THANK YOU Screen Shot 2021-10-19 at 5 21 42 PM

      {
         "compress" : 0,
         "key" : "chr81msk_net",
         "label" : "chr81msk_net.bed",
         "storeClass" : "JBrowse/Store/SeqFeature/BEDTabix",
         "ItemRgb" : true,
         "style" : {
            "className" : "feature"
         },
         "trackType" : "CanvasFeatures",
         "type" : "CanvasFeatures",
         "urlTemplate" : "files/chr81/chr81msk_net.bed.gz"
      }
cmdcolin commented 3 years ago

excellent :) it should definitely be easier to do stuff like this, as having those colors is really important. we still need to port similar functionality to jbrowse 2 so will keep in mind

cmdcolin commented 3 years ago

maybe can close for now