Skip to content

Escape brackets/periods/backslashes/quotes in input rank IDs and sample metadata fields, and in any "inputs" to plot JSONs #66

@fedarko

Description

@fedarko

Apparently vega treats these specially. See this page for context.

This is causing a problem with the rank names in the Byrd data example -- trying to switch to a rank that isn't "Intercept" brings up an error.

I guess we have to apply this not only for each column but for every possible string that's passed to Vega: so every feature/sample ID, augmented feature ID, sample metadata, and probably more. sheesh.

ideally we should have tests that verify that our measures to protect against Vega interpreting things wrongly work (#2).

Note: you can escape these either with a ton of backslashes or by enclosing the field names in square brackets. The latter sounds easier.

Note: related to vega/vega-lite#4965

Note: should also ensure that field names (when passed into the plot JSONs, e.g. for things like setting an encoding field of the sample plot's color or setting the encoding field of the rank plot's y-axis) are escaped in JS via something like vega.stringValue().

Note from 2025 (!!!): current versions of Altair treat colons (:) specially now; see https://altair-viz.github.io/user_guide/encodings/index.html#encoding-shorthands . Per vega/altair#1896 it seems like the simplest solution is escaping colons, now, also (and no longer converting periods to colons).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingexternalissues/bugs with other libraries, frameworks, etc.; might include reproducing an issue minimally

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions