From 88fd8d3483528b222ea794d4bde72932e883df6c Mon Sep 17 00:00:00 2001 From: Scott Cain Date: Wed, 5 Jul 2023 13:18:26 -0700 Subject: [PATCH] adding back the CeNDR track custom coloring --- config.json | 6 +++++- variantColor_plugin.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 9f1a7c84..93f64673 100644 --- a/config.json +++ b/config.json @@ -10867,7 +10867,11 @@ "displays" : [ { "type" : "LinearVariantDisplay", - "displayId" : "cendr_variation-c_elegans_PRJNA13758-LinearVariantDisplay" + "displayId" : "cendr_variation-c_elegans_PRJNA13758-LinearVariantDisplay", + "renderer": { + "type": "SvgFeatureRenderer", + "color1": "jexl:variantColor(feature)" + } } ], "description" : "Strain variant data from https://www.elegansvariation.org/. For more information see Cook DE, Zdraljevic S, Roberts JP, Andersen EC. CeNDR, the Caenorhabditis elegans natural diversity resource. Nucleic Acids Res. 2017 Jan 4;45(D1):D650-D657. doi: 10.1093/nar/gkw893. Epub 2016 Oct 3. PubMed PMID: 27701074; PubMed Central PMCID: PMC5210618. Colors follow the same scheme as ENSEMBL for predicted variants (https://uswest.ensembl.org/info/genome/variation/prediction/predicted_data.html), and variants with no predicted impact are black and variants that don't have recognized predicted consequence are peachpuff (a pale pink-orange). Variants with more than one predicted consequences are colored by the first annotation.", diff --git a/variantColor_plugin.js b/variantColor_plugin.js index 51017b8e..f0609700 100644 --- a/variantColor_plugin.js +++ b/variantColor_plugin.js @@ -5,7 +5,7 @@ install(pluginManager) { pluginManager.jexl.addFunction('variantColor', f => { - if (f['variant']['INFO']['ANN']) { + if ('variant' in f && 'INFO' in f['variant'] && 'ANN' in f['variant']['INFO']) { var ann = f['variant']['INFO']['ANN'][0].split('|') var cons = ann[1] if (cons.indexOf('&') > -1) {