eweitz / ideogram

Chromosome visualization for the web
https://eweitz.github.io/ideogram
Other
294 stars 71 forks source link

rangeSet does not support sex chromosomes #338

Open mflevine opened 1 year ago

mflevine commented 1 year ago

I am trying to add coloring and annotation to CNVs using rangeSet but the coloring does not appear on sex chromosomes.

image
eweitz commented 1 year ago

Hi there, and thanks for using Ideogram! Could you provide data and configuration for a minimal reproducible example?

mflevine commented 1 year ago

Thanks for the speedy response! It is a great library.

Here is an example. Loss of 22q and Yp, should be dark blue, but only 22 is rendered.

  var config = {
    organism: 'human',
    assembly: "GRCh37",
    chrHeight: 300,
    chrMargin: 2,
    annotationHeight: 0.1,
    annotations: [{"chr":"22","start":14500000,"stop":51304566,"color":"rgba(0, 0, 0, 0)","name":"0+0"},{"chr":"Y","start":1,"stop":11604552,"color":"rgba(0, 0, 0, 0)","name":"0+0"}],
    rangeSet: [{"chr":"22","start":14500000,"stop":51304566,"color":"#000F4A","name":"0+0"},{"chr":"Y","start":1,"stop":11604552,"color":"#000F4A","name":"0+0"}],
    annotationsLayout: 'overlay',
    orientation: 'horizontal',
    rotatable: false,
  };

  var ideogram = new Ideogram(config);
zorgster commented 1 year ago

I am also having trouble with annotations on GRCh37. When I press F12 (dev tools) in Edge, there is an error in the console which remains even when I remove annotations on the sex chromosomes:

Uncaught (in promise) Error: Base pair out of range. bp: 0; length of chrX: 155270560 at throwBpToPxError (coordinate-converters.js:13:9) at Ideogram2.convertBpToPx (coordinate-converters.js:64:3) at addAnnotsForChr (process.js:147:26) at addAnnots (process.js:203:9) at Ideogram2.processAnnotData (process.js:251:29) at processAnnots (finish-init.js:38:24) at Ideogram2.finishInit (finish-init.js:111:7) at Ideogram2.writeContainer (write-container.js:113:8) at init.js:234:10

zorgster commented 1 year ago

I've resolved my issue - the annotation I was using had one annot starting with 0, not 1.