Identifier¶
The "identifier" transform adds a runtime-unique identifier (__uniqueId) to
each row.
GenomeSpy uses these identifiers internally for picking, including tooltips and
point selections. It inserts an identifier transform automatically when a mark
participates in picking or uses a point-selection condition and the dataflow
branch does not already contain one. The required uniqueId encoding is
inferred automatically, including on marks with picking disabled.
Identifiers are runtime values. Do not use them as persistent record keys. For
point selections that need to survive state persistence, use encoding.key, as
described in the non-visual channels
section, with fields that identify rows
independently of the current data flow.
Explicit identifiers¶
Most specifications do not need to add this transform themselves. Add one explicitly when several downstream views must refer to the same input object after the data has been expanded or branched. Place it before the expansion or branching step:
{
"transform": [
{ "type": "identifier" },
{
"type": "flattenCigar",
"copyFields": ["__uniqueId", "chrom", "name", "cigar"]
}
],
"layer": [
{
"transform": [{ "type": "filter", "expr": "datum.cigarType == 'skip'" }],
"mark": "rule"
},
{
"transform": [
{ "type": "filter", "expr": "datum.cigarType == 'aligned'" }
],
"mark": "rect"
}
]
}
Both layers receive the same identifier for all CIGAR elements derived from
one input alignment. When a transform limits the fields copied to generated
rows, include "__uniqueId" explicitly, as in the example above.