Jexl feature colors and labels
Color and re-label each feature from its own attributes.
The jexl guide lists the functions and variables an expression can use.
View source — 26 lines
import { LinearGenomeView } from '@jbrowse/react-linear-genome-view2'
export default function JexlColorsAndLabels() {
return (
<LinearGenomeView
assembly={{
name: 'volvox',
uri: 'https://jbrowse.org/genomes/volvox/volvox.2bit',
}}
tracks={[
{
trackId: 'volvox_genes_jexl',
name: 'Volvox genes (jexl color + label)',
uri: 'https://jbrowse.org/code/jb2/main/test_data/volvox/volvox.sort.gff3.gz',
displayDefaults: {
color: "jexl:get(feature,'strand')==1?'#1f77b4':'#d62728'",
labels: {
name: "jexl:get(feature,'name')+' ['+get(feature,'type')+']'",
},
},
},
]}
view={{ loc: 'ctgA:1..50,000', tracks: ['volvox_genes_jexl'] }}
/>
)
}