question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to use 'feature' argument in jexl functions

See original GitHub issue

Describe the bug

I’m trying to implement configuration callbacks accoding to the docs written here. The function described in the docs don’t work for me somehow. Any function that has feature as argument to the function call fails, i.e. get(...) fails while log(...) works.

To Reproduce

  1. Use jexl expression in config.json
// ...
    {
      "type": "FeatureTrack",
      "trackId": "OrganismGenome_ChromatinStatesTp0",
      "name": "TP0 4h",
      "formatDetails": {
        "feature": "jexl:{name:get(feature,'start')}"  // <------
      },
      "adapter": {
        "type": "BedTabixAdapter",
        "bedGzLocation": {
// ...
  1. Load JBrowse2 web and click on a feature in the respective track.

Expected behavior

The “Feature details” panel should show the evaluated result of the jexl expression. In the case of the example above it would the the start position of the feature. Instead, the Panel remains white and the Console (F12) shows an error traceback:

[mobx] uncaught error in 'Reaction[Autorun]' Error: TypeError: e.get is not a function

Screenshots

image

Version:

JBrowse2 v2.1.2 Firefox 104.0 Google Chrome Version 105.0.5195.102 (Official Build) (64-bit) Ubuntu 20.04

Additional context

Using only variables in jexl (i.e. not a function call with feature as input) works, however:

// ...
    {
      "type": "FeatureTrack",
      "trackId": "OrganismGenome_ChromatinStatesTp0",
      "name": "TP0 4h",
      "formatDetails": {
        "feature": "jexl:{name:feature.start}"  // <------
      },
      "adapter": {
        "type": "BedTabixAdapter",
        "bedGzLocation": {
// ...

Of course, this example above with the start of the feature does not make sense and I only use it to test it. Later on I have to integrate my own functions for more complex configuration callbacks, but these will need to access feature as well.

Also, I’m not a web developer and have little to no experience with Typescript/Javascript. I’m just a Bioinformatics PhD student that was tasked to implement a genome browser by his PI. So I hope that I’m not just missing something really obvious here.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
mriedl93commented, Sep 13, 2022

Ah, now I get it! Sorry for my confusion.

I now managed to implement the configuration callback for coloring the chromatin states with a custom plugin. Much like the example in JBrowse1.

Thanks a lot for the help and explanations. From my side it is now solved and I would close the issue.

Thanks again and have a nice day!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apache Commons JEXL Syntax
Assigns the value of a variable ( my. var = 'a value' ) using a JexlContext as initial resolver.
Read more >
JEXL Syntax Reference - Percussion Software
When scripts are created with named parameters, those behave as local variables. Local variables can not use ant-style naming, only one identifier.
Read more >
org.apache.commons.jexl3 (Apache Commons JEXL 3.1 API)
Provides a framework for evaluating JEXL expressions. ... If you think you need to use directly some of their features or methods, it...
Read more >
commons-jexl/RELEASE-NOTES.txt at master - GitHub
JEXL -290: Safe navigation fails on chained method calls. * JEXL-289: Passing undeclared function parameter can overwrite a local function variable.
Read more >
Newest 'jexl' Questions - Stack Overflow
I use version 0.13.0 of Apache IoTDB and want to use JEXL function to ... I know, I can do several things in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found