Skip to content

Commit

Permalink
Merge pull request #196 from eweitz/dog-centromeres
Browse files Browse the repository at this point in the history
Dog centromeres and Y chromosome; multi-row layout
  • Loading branch information
eweitz committed Apr 14, 2020
2 parents 63a927b + fa26ba4 commit cd77ee0
Show file tree
Hide file tree
Showing 9 changed files with 295 additions and 30 deletions.
84 changes: 84 additions & 0 deletions data/bands/native/canis-lupus-familiaris.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"chrBands": [
"1 p 1 0 1 0 1",
"1 q 1 1 122678785 1 122678785",
"2 p 1 0 1 0 1",
"2 q 1 1 85426708 1 85426708",
"3 p 1 0 1 0 1",
"3 q 1 1 91889043 1 91889043",
"4 p 1 0 1 0 1",
"4 q 1 1 88276631 1 88276631",
"5 p 1 0 1 0 1",
"5 q 1 1 88915250 1 88915250",
"6 p 1 0 1 0 1",
"6 q 1 1 77573801 1 77573801",
"7 p 1 0 1 0 1",
"7 q 1 1 80974532 1 80974532",
"8 p 1 0 1 0 1",
"8 q 1 1 74330416 1 74330416",
"9 p 1 0 1 0 1",
"9 q 1 1 61074082 1 61074082",
"10 p 1 0 1 0 1",
"10 q 1 1 69331447 1 69331447",
"11 p 1 0 1 0 1",
"11 q 1 1 74389097 1 74389097",
"12 p 1 0 1 0 1",
"12 q 1 1 72498081 1 72498081",
"13 p 1 0 1 0 1",
"13 q 1 1 63241923 1 63241923",
"14 p 1 0 1 0 1",
"14 q 1 1 60966679 1 60966679",
"15 p 1 0 1 0 1",
"15 q 1 1 64190966 1 64190966",
"16 p 1 0 1 0 1",
"16 q 1 1 59632846 1 59632846",
"17 p 1 0 1 0 1",
"17 q 1 1 64289059 1 64289059",
"18 p 1 0 1 0 1",
"18 q 1 1 55844845 1 55844845",
"19 p 1 0 1 0 1",
"19 q 1 1 53741614 1 53741614",
"20 p 1 0 1 0 1",
"20 q 1 1 58134056 1 58134056",
"21 p 1 0 1 0 1",
"21 q 1 1 50858623 1 50858623",
"22 p 1 0 1 0 1",
"22 q 1 1 61439934 1 61439934",
"23 p 1 0 1 0 1",
"23 q 1 1 52294480 1 52294480",
"24 p 1 0 1 0 1",
"24 q 1 1 47698779 1 47698779",
"25 p 1 0 1 0 1",
"25 q 1 1 51628933 1 51628933",
"26 p 1 0 1 0 1",
"26 q 1 1 38964690 1 38964690",
"27 p 1 0 1 0 1",
"27 q 1 1 45876710 1 45876710",
"28 p 1 0 1 0 1",
"28 q 1 1 41182112 1 41182112",
"29 p 1 0 1 0 1",
"29 q 1 1 41845238 1 41845238",
"30 p 1 0 1 0 1",
"30 q 1 1 40214260 1 40214260",
"31 p 1 0 1 0 1",
"31 q 1 1 39895921 1 39895921",
"32 p 1 0 1 0 1",
"32 q 1 1 38810281 1 38810281",
"33 p 1 0 1 0 1",
"33 q 1 1 31377067 1 31377067",
"34 p 1 0 1 0 1",
"34 q 1 1 42124431 1 42124431",
"35 p 1 0 1 0 1",
"35 q 1 1 26524999 1 26524999",
"36 p 1 0 1 0 1",
"36 q 1 1 30810995 1 30810995",
"37 p 1 0 1 0 1",
"37 q 1 1 30902991 1 30902991",
"38 p 1 0 1 0 1",
"38 q 1 1 23914537 1 23914537",
"X p 1 0 1 0 50000000",
"X q 1 50000001 123869142 50000001 123869142",
"Y p 1 0 1 0 10000000",
"Y q 1 10000001 20000000 10000001 20000000"
]
}
43 changes: 42 additions & 1 deletion data/bands/native/felis-catus.json
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
{"chrBands": ["A1 p 1 0 3713 0 89880064", "A1 q 1 3714 10000.0 89880064 242100913", "A2 p 1 0 2523 0 61080734", "A2 q 1 2524 7082.655941904689 61080734 171471747", "A3 p 1 0 2142 0 51856977", "A3 q 1 2143 5914.9882264177995 51856977 143202405", "B1 p 1 0 1623 0 39294480", "B1 q 1 1624 8600.25211883443 39294480 208212889", "B2 p 1 0 1246 0 30165856", "B2 q 1 1247 6414.789439476422 30165856 155302638", "B3 p 1 0 1225 0 29663499", "B3 q 1 1226 6185.5119480693575 29663499 149751809", "B4 p 1 0 1851 0 44808485", "B4 q 1 1852 5969.770754230902 44808485 144528695", "C1 p 1 0 4498 0 108907037", "C1 q 1 4499 9202.366865919254 108907037 222790142", "C2 p 1 0 3148 0 76225444", "C2 q 1 3149 6658.097567769189 76225444 161193150", "D1 p 1 0 1371 0 33184684", "D1 q 1 1372 4859.462384596625 33184684 117648028", "D2 p 1 0 860 0 20812855", "D2 q 1 861 3725.16810789557 20812855 90186660", "D3 p 1 0 1313 0 31780724", "D3 q 1 1314 4001.8108481895733 31780724 96884206", "D4 p 1 0 1343 0 32525998", "D4 q 1 1344 3986.835522590532 32525998 96521652", "E1 p 1 0 1068 0 25862966", "E1 q 1 1069 2622.6538435235066 25862966 63494689", "E2 p 1 0 1030 0 24929418", "E2 q 1 1031 2657.5816754561347 24929418 64340295", "E3 p 1 0 753 0 18233305", "E3 q 1 754 1844.2013888646509 18233305 44648284", "F1 p 1 0 41 0 1000001", "F1 q 1 42 2960.0980067349024 1000001 71664243", "F2 p 1 0 41 0 1000001", "F2 q 1 42 3542.012912607232 1000001 85752456", "X p 1 0 2128 0 51521357", "X q 1 2129 5392.669006580739 51521357 130557009"]}
{
"chrBands": [
"A1 p 1 0 3713 0 89880064",
"A1 q 1 3714 10000.0 89880064 242100913",
"A2 p 1 0 2523 0 61080734",
"A2 q 1 2524 7082.655941904689 61080734 171471747",
"A3 p 1 0 2142 0 51856977",
"A3 q 1 2143 5914.9882264177995 51856977 143202405",
"B1 p 1 0 1623 0 39294480",
"B1 q 1 1624 8600.25211883443 39294480 208212889",
"B2 p 1 0 1246 0 30165856",
"B2 q 1 1247 6414.789439476422 30165856 155302638",
"B3 p 1 0 1225 0 29663499",
"B3 q 1 1226 6185.5119480693575 29663499 149751809",
"B4 p 1 0 1851 0 44808485",
"B4 q 1 1852 5969.770754230902 44808485 144528695",
"C1 p 1 0 4498 0 108907037",
"C1 q 1 4499 9202.366865919254 108907037 222790142",
"C2 p 1 0 3148 0 76225444",
"C2 q 1 3149 6658.097567769189 76225444 161193150",
"D1 p 1 0 1371 0 33184684",
"D1 q 1 1372 4859.462384596625 33184684 117648028",
"D2 p 1 0 860 0 20812855",
"D2 q 1 861 3725.16810789557 20812855 90186660",
"D3 p 1 0 1313 0 31780724",
"D3 q 1 1314 4001.8108481895733 31780724 96884206",
"D4 p 1 0 1343 0 32525998",
"D4 q 1 1344 3986.835522590532 32525998 96521652",
"E1 p 1 0 1068 0 25862966",
"E1 q 1 1069 2622.6538435235066 25862966 63494689",
"E2 p 1 0 1030 0 24929418",
"E2 q 1 1031 2657.5816754561347 24929418 64340295",
"E3 p 1 0 753 0 18233305",
"E3 q 1 754 1844.2013888646509 18233305 44648284",
"F1 p 1 0 41 0 1000001",
"F1 q 1 42 2960.0980067349024 1000001 71664243",
"F2 p 1 0 41 0 1000001",
"F2 q 1 42 3542.012912607232 1000001 85752456",
"X p 1 0 2128 0 51521357",
"X q 1 2129 5392.669006580739 51521357 130557009"
]
}
84 changes: 84 additions & 0 deletions dist/data/bands/native/canis-lupus-familiaris.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"chrBands": [
"1 p 1 0 1 0 1",
"1 q 1 1 122678785 1 122678785",
"2 p 1 0 1 0 1",
"2 q 1 1 85426708 1 85426708",
"3 p 1 0 1 0 1",
"3 q 1 1 91889043 1 91889043",
"4 p 1 0 1 0 1",
"4 q 1 1 88276631 1 88276631",
"5 p 1 0 1 0 1",
"5 q 1 1 88915250 1 88915250",
"6 p 1 0 1 0 1",
"6 q 1 1 77573801 1 77573801",
"7 p 1 0 1 0 1",
"7 q 1 1 80974532 1 80974532",
"8 p 1 0 1 0 1",
"8 q 1 1 74330416 1 74330416",
"9 p 1 0 1 0 1",
"9 q 1 1 61074082 1 61074082",
"10 p 1 0 1 0 1",
"10 q 1 1 69331447 1 69331447",
"11 p 1 0 1 0 1",
"11 q 1 1 74389097 1 74389097",
"12 p 1 0 1 0 1",
"12 q 1 1 72498081 1 72498081",
"13 p 1 0 1 0 1",
"13 q 1 1 63241923 1 63241923",
"14 p 1 0 1 0 1",
"14 q 1 1 60966679 1 60966679",
"15 p 1 0 1 0 1",
"15 q 1 1 64190966 1 64190966",
"16 p 1 0 1 0 1",
"16 q 1 1 59632846 1 59632846",
"17 p 1 0 1 0 1",
"17 q 1 1 64289059 1 64289059",
"18 p 1 0 1 0 1",
"18 q 1 1 55844845 1 55844845",
"19 p 1 0 1 0 1",
"19 q 1 1 53741614 1 53741614",
"20 p 1 0 1 0 1",
"20 q 1 1 58134056 1 58134056",
"21 p 1 0 1 0 1",
"21 q 1 1 50858623 1 50858623",
"22 p 1 0 1 0 1",
"22 q 1 1 61439934 1 61439934",
"23 p 1 0 1 0 1",
"23 q 1 1 52294480 1 52294480",
"24 p 1 0 1 0 1",
"24 q 1 1 47698779 1 47698779",
"25 p 1 0 1 0 1",
"25 q 1 1 51628933 1 51628933",
"26 p 1 0 1 0 1",
"26 q 1 1 38964690 1 38964690",
"27 p 1 0 1 0 1",
"27 q 1 1 45876710 1 45876710",
"28 p 1 0 1 0 1",
"28 q 1 1 41182112 1 41182112",
"29 p 1 0 1 0 1",
"29 q 1 1 41845238 1 41845238",
"30 p 1 0 1 0 1",
"30 q 1 1 40214260 1 40214260",
"31 p 1 0 1 0 1",
"31 q 1 1 39895921 1 39895921",
"32 p 1 0 1 0 1",
"32 q 1 1 38810281 1 38810281",
"33 p 1 0 1 0 1",
"33 q 1 1 31377067 1 31377067",
"34 p 1 0 1 0 1",
"34 q 1 1 42124431 1 42124431",
"35 p 1 0 1 0 1",
"35 q 1 1 26524999 1 26524999",
"36 p 1 0 1 0 1",
"36 q 1 1 30810995 1 30810995",
"37 p 1 0 1 0 1",
"37 q 1 1 30902991 1 30902991",
"38 p 1 0 1 0 1",
"38 q 1 1 23914537 1 23914537",
"X p 1 0 1 0 50000000",
"X q 1 50000001 123869142 50000001 123869142",
"Y p 1 0 1 0 10000000",
"Y q 1 10000001 20000000 10000001 20000000"
]
}
6 changes: 3 additions & 3 deletions examples/vanilla/eukaryotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ <h1>Eukaryotes | Ideogram</h1>
<li><label for="pan-troglodytes"><input type="radio" name="org" value="pan-troglodytes" id="pan-troglodytes">Chimpanzee (Pan troglodytes)</label></li>
<li><label for="macaca-mulatta"><input type="radio" name="org" value="macaca-mulatta" id="macaca-mulatta">Macaque (Macaca mulatta)</label></li>
<li><label for="felis-catus"><input type="radio" name="org" value="felis-catus" id="felis-catus">Cat (Felis catus)</label></li>
<!-- <li><label for="canis-lupus-familiaris"><input type="radio" name="org" value="canis-lupus-familiaris" id="canis-lupus-familiaris">Dog (Canis lupus familiaris)</label></li> -->
<li><label for="canis-lupus-familiaris"><input type="radio" name="org" value="canis-lupus-familiaris" id="canis-lupus-familiaris">Dog (Canis lupus familiaris)</label></li>
<!-- <li><label for="gallus-gallus"><input type="radio" name="org" value="gallus-gallus" id="gallus-gallus">Chicken (Gallus gallus)</label></li> -->
<!-- <li><label for="bos-taurus"><input type="radio" name="org" value="bos-taurus" id="bos-taurus">Cow (Bos taurus)</label></li> -->
<li><label for="bos-taurus"><input type="radio" name="org" value="bos-taurus" id="bos-taurus">Cow (Bos taurus)</label></li>
<li><label for="sus-scrofa"><input type="radio" name="org" value="sus-scrofa" id="sus-scrofa">Pig (Sus scrofa)</label></li>
</ul>
</li>
Expand All @@ -88,7 +88,7 @@ <h1>Eukaryotes | Ideogram</h1>
Protozoa
<ul>
<li><label for="plasmodium-falciparum"><input type="radio" name="org" value="plasmodium-falciparum" id="plasmodium-falciparum">Malaria parasite (Plasmodium falciparum)</label></li>
<!-- <li><label for="leishmania-donovani"><input type="radio" name="org" value="leishmania-donovani" id="leishmania-donovani">Leishmania parasite (Leishmania donovani)</label></li> -->
<li><label for="leishmania-donovani"><input type="radio" name="org" value="leishmania-donovani" id="leishmania-donovani">Leishmania parasite (Leishmania donovani)</label></li>
</ul>
</li>
</ul>
Expand Down
12 changes: 6 additions & 6 deletions examples/vanilla/orthologs.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ <h1>Orthologs | Ideogram</h1>
</label>
<div style="font-size: 12px; position: relative; top: -7px;">
Examples:
<a href="?genes=MTOR&org=homo-sapiens&org2=mus-musculus&backend=oma">MTOR</a> |
<a href="?genes=MTOR,BRCA1&org=homo-sapiens&org2=mus-musculus&backend=oma">MTOR, BRCA1</a> |
<a href="?genes=MTOR&org=homo-sapiens&org2=mus-musculus&backend=orthodb">MTOR</a> |
<a href="?genes=MTOR,BRCA1&org=homo-sapiens&org2=mus-musculus&backend=orthodb">MTOR, BRCA1</a> |
<a href="?loci=2:150000000,5:20000000&org=homo-sapiens&org2=mus-musculus">2:150000000, 5:200000000</a>
</div>
<label for="org">
Expand Down Expand Up @@ -80,8 +80,8 @@ <h1>Orthologs | Ideogram</h1>
<label for="backend">
Orthology backend:
<select class="left-select backend-select" id="backend">
<option id="oma" selected>OMA Browser</option>
<option id="orthodb">OrthoDB</option>
<option id="orthodb" selected>OrthoDB</option>
<option id="oma">OMA Browser</option>
</select>
</label>
</div>
Expand Down Expand Up @@ -293,7 +293,7 @@ <h1>Orthologs | Ideogram</h1>
}
urlParams['org'] = 'homo-sapiens';
urlParams['org2'] = 'mus-musculus';
urlParams['backend'] = 'oma';
urlParams['backend'] = 'orthodb';
// urlParams['loci'] = '1:11106531-11262557,4:148448582-148557685';
}

Expand All @@ -304,7 +304,7 @@ <h1>Orthologs | Ideogram</h1>
}

if ('backend' in urlParams === false) {
urlParams['backend'] = 'oma';
urlParams['backend'] = 'orthodb';
}

org1 = urlParams['org'].replace(/-/g, ' ');
Expand Down
7 changes: 7 additions & 0 deletions src/js/init/organism-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ var organismMetadata = {
assemblies: {
default: ''
}
},
9615: {
commonName: 'Dog',
scientificName: 'Canis lupus familiaris',
assemblies: {
default: ''
}
}
};

Expand Down
75 changes: 60 additions & 15 deletions src/js/layouts/small-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ class SmallLayout extends Layout {
left: 36.5,
top: 10
};

var taxid = this._ideo.getTaxid(this._ideo.config.organism);

this.chrs = config.chromosomes[taxid];
var numChrs = this.chrs.length;

// Number of chromosomes per row
this.chrsPerRow = Math.ceil(numChrs / config.rows);
}

// rotateForward(setIndex, chrIndex, chrElement, callback) {
Expand All @@ -37,11 +45,57 @@ class SmallLayout extends Layout {
// .on('end', callback);
// }

/**
* eweitz 2020-04-13:
* This height metric is crude because it is calculated before
* the height ("width") of each chromosome is calculated.
*
* It calculates height by multiplying the max height of all chromosomes
* (specified in the Ideogram configuration object) by the number of rows.
* This ensures the ideogram height doesn't truncate in cases like dog
* (where chrX on the second row is longer than chr1 on the first), but it
* often leaves too much space on the second row, e.g. for human.
*
* Ideally, ideogram height would be cumulative height per row, plus top
* margin. This would require calling getHeight _after_ all chromosomes
* have had their height (technically, chr.width) assigned. See draft new
* getHeight method below this getHeight method.
*/
getHeight() {
var chrHeight = this._config.chrHeight;
return this._config.rows * (chrHeight + this.margin.top * 1.5);
var config = this._config;
var chrHeight = config.chrHeight * 1.25;
return this._config.rows * (chrHeight + this.margin.top);
}

/**
* eweitz 2020-04-13:
* Draft refinement of getHeight. See note in classic version above.
*
* Total height is cumulative height per row, plus top margin
*/
// getHeight() {
// let height = 0;
// const rows = this._config.rows;
// const chrEntries = Object.entries(this.chrs);

// for (let i = 0; i < rows; i++) {
// let rowHeight = 0;
// // Starting and ending indexes of chromosomes of this row
// const startIndex = this.chrsPerRow * i;
// const endIndex = this.chrsPerRow * (i + 1) - 1;

// for (let j = startIndex; j < endIndex; j++) {
// const thisChrHeight = chrEntries[j][1].width;
// if (thisChrHeight > rowHeight) {
// rowHeight = thisChrHeight;
// }
// }
// height += rowHeight + this.margin.top;
// }

// return height;
// }

getWidth() {
return '97%';
}
Expand All @@ -55,20 +109,11 @@ class SmallLayout extends Layout {
}

getChromosomeSetTranslate(setIndex) {
var taxid = this._ideo.getTaxid(this._ideo.config.organism);

// Get first organism chromosomes amount
var numChrs = this._ideo.config.chromosomes[taxid].length;

// Number of chromosomes per row
var chrsPerRow = numChrs / this._config.rows;

var xOffset;
var yOffset;
var xOffset, yOffset;

if (setIndex > chrsPerRow - 1) {
xOffset = this.margin.left + this._config.chrHeight * 1.4;
yOffset = this.getChromosomeSetYTranslate(setIndex - chrsPerRow);
if (setIndex > this.chrsPerRow - 1) {
xOffset = this.margin.left + this._config.chrHeight * 1.3;
yOffset = this.getChromosomeSetYTranslate(setIndex - this.chrsPerRow);
} else {
xOffset = this.margin.left;
yOffset = this.getChromosomeSetYTranslate(setIndex);
Expand Down
Loading

0 comments on commit cd77ee0

Please sign in to comment.