gosling.js icon indicating copy to clipboard operation
gosling.js copied to clipboard

A request for the "Formula" data transform Genomespy have already provided

Open zhangzhen opened this issue 2 years ago • 1 comments

The "Formula" transform in Genomespy provides a flexible means to process data just-in-time, not beforehand. It can contains arithmetic and logarithmic operations. I just name a few operations here. It's very common for me to add values of two columns or add a number to values of one column. A json example from Genomespy is listed below:

{
  "type": "formula",
  "expr": "datum.x + datum.y",
  "as": "z"
}

I suppose that Data transforms in Genomespy are a good reference to check: Data transforms in Genomespy

zhangzhen avatar Nov 25 '21 05:11 zhangzhen

I think this can be a useful addition to the grammar. One limitation would be that the expression is expressed in a string format, so we cannot provide auto-completion and the debugging (e.g., typos) could be a bit challenging.

It looks Vega supports the expression, which is the one used by GenomeSpy, which we can use as well: https://github.com/vega/vega/tree/master/packages/vega-expression

sehilyi avatar Nov 29 '21 16:11 sehilyi