Skip to content

Commit 505cea4

Browse files
authored
Merge pull request #377 from eweitz/simpler-leads-config
Simplify configuration for Gene Leads
2 parents 36ca987 + 9254fcb commit 505cea4

5 files changed

Lines changed: 21 additions & 24 deletions

File tree

examples/vanilla/gene-leads-lite.html

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,24 @@ <h1>Gene Leads Lite<small>Minimal <a href="https://github.com/eweitz/ideogram/bl
2929
<div id="ideogram-container" style="visibility: hidden;"></div>
3030
<div>
3131
<pre>
32-
/** Upon clicking a triangular annotation or tooltip, plot that gene */
32+
// Setup
33+
npm install ideogram
34+
35+
// Either use a modern import statement
36+
import Ideogram from 'ideogram'
37+
38+
// or use a classic HTML script tag
39+
&lt;script src="https://cdn.jsdelivr.net/npm/ideogram@1.50.0/dist/js/ideogram.min.js"&gt;&lt;/script&gt;
40+
41+
// Upon clicking a triangular annotation, plot that gene
3342
function onClickAnnot(annot) {
3443
ideogram.plotRelatedGenes(annot.name);
3544
}
3645

37-
// Ideogram configuration object
38-
config = {
39-
organism: 'homo-sapiens',
46+
const ideogram = Ideogram.initGeneLeads({
4047
container: '#ideogram-container',
41-
legendName: 'Gene leads',
42-
showGeneStructureInTooltip: true,
43-
showProteinInTooltip: true,
4448
onClickAnnot
45-
}
46-
47-
const ideogram = Ideogram.initGeneLeads(config);
49+
});
4850
</pre>
4951
</div>
5052
</div>
@@ -54,17 +56,12 @@ <h1>Gene Leads Lite<small>Minimal <a href="https://github.com/eweitz/ideogram/bl
5456
ideogram.plotRelatedGenes(annot.name);
5557
}
5658

57-
// Ideogram configuration object
58-
config = {
59+
// Instantiate Gene Leads ideogram
60+
const ideogram = Ideogram.initGeneLeads({
5961
organism: 'homo-sapiens',
6062
container: '#ideogram-container',
61-
legendName: 'Gene leads',
62-
showGeneStructureInTooltip: true,
63-
showProteinInTooltip: true,
6463
onClickAnnot
65-
}
66-
67-
const ideogram = Ideogram.initGeneLeads(config);
64+
});
6865
</script>
6966
</body>
7067
</html>

examples/vanilla/gene-leads.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ <h1>Gene Leads<small>Enrich your gene search</small></h1>
224224
updateUrl();
225225

226226
ideogram.config.relatedGenesMode = 'related';
227-
const selector = '#ideogram-container #_ideogramInnerWrap'
228227
ideogram.plotRelatedGenes(annot.name);
229228
}
230229

@@ -246,8 +245,6 @@ <h1>Gene Leads<small>Enrich your gene search</small></h1>
246245
onLoad: plotGeneFromUrl,
247246
onPlotFoundGenes: reportFoundGenes,
248247
onHoverLegend: reportLegendMetrics,
249-
showGeneStructureInTooltip: true,
250-
showProteinInTooltip: true,
251248
onClickAnnot
252249
}
253250

src/js/init/organism-metadata.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ var organismMetadata = {
4141
'Pan_tro 3.0': 'GCF_000001515.7'
4242
},
4343
hasGeneCache: true,
44-
hasParalogCache: true,
4544
hasSynonymCache: true
4645
},
4746
10116: {

src/js/kit/protein-color.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,8 @@ export function getColors(domainType) {
646646
domainType === 'Laminin domain II' ||
647647
domainType === 'Troponin I residues 1-32' || // e.g. TNNI3 in ACMG
648648
domainType === 'KI67R' || // KI67 / Chmadrin repeat
649-
domainType.includes('FAD-binding')
649+
domainType.includes('FAD-binding') ||
650+
domainType.includes('Glucagon') // e.g. GCG, which encodes GLP-1
650651
) {
651652
return [orange, orangeLines];
652653
} else if (

src/js/kit/related-genes.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,8 @@ async function fetchParalogs(annot, ideo) {
873873
homologs = hasParalogs ? paralogsByName[nameUc] : [];
874874
} else {
875875
const params = `&format=condensed&type=paralogues&target_taxon=${taxid}`;
876-
const path = `/homology/id/${annot.id}?${params}`;
876+
const organismUnderscore = ideo.config.organism.replace('-', '_');
877+
const path = `/homology/id/${organismUnderscore}/${annot.id}?${params}`;
877878
const ensemblHomologs = await Ideogram.fetchEnsembl(path);
878879
homologs = ensemblHomologs.data[0].homologies;
879880
}
@@ -1950,6 +1951,8 @@ const globalKitDefaults = {
19501951
onDidShowAnnotTooltip,
19511952
showTools: true,
19521953
showAnnotLabels: true,
1954+
showGeneStructureInTooltip: true,
1955+
showProteinInTooltip: true,
19531956
chrFillColor: {centromere: '#DAAAAA'}
19541957
};
19551958

0 commit comments

Comments
 (0)