eweitz / ideogram

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

API annotations not working on genomes with non "1,2,3" labelled chromosomes #305

Closed NicoNekoru closed 2 years ago

NicoNekoru commented 2 years ago

Ideogram.js is failing to create annotations for organisms who have their annotations on the NCBI listed with "non-numeric chromosomes" (i. e. Ca1, Ca2, ... and G1, G2, ...). Both class initialization with annotations (new Ideogram({organism, annotations})) and the ideogram.drawAnnots method fail to create annotations for such organisms.

Example:

var annotations = [{
    name: 'test',
    chr: '1',
    start: 1,
    stop: 1
}]

var peach = new Ideogram({
    organism: 'peach',
    annotations: annotations,
    container: '.peach',
});

var chickpea = new Ideogram({
    organism: 'chickpea',
    annotations: annotations,
    container: '.chickpea',
});

var soybean = new Ideogram({
    organism: 'soybean',
    annotations: annotations,
    container: '.soybean'
});

Expected output:

Actual output:

NicoNekoru commented 2 years ago

I forgot that chr is the name of the chromosome and not just the index, the solution to this would be to set chr to the actual chromosome you are trying to annotate i. e.

var peach = new Ideogram({
    organism: 'peach',
    annotations: [{
        name: 'test',
        chr: 'G1',
        start: 1,
        stop: 1
    }],
    container: '.peach',
});

var chickpea = new Ideogram({
    organism: 'chickpea',
        annotations: [{
        name: 'test',
        chr: 'Ca1',
        start: 1,
        stop: 1
    }],
    container: '.chickpea',
});