genome_spy.ruler

genome_spy.ruler(name=None, /, *, clear=Undefined, disabled=Undefined, display=Undefined, encodings=Undefined, extent=Undefined, mark=Undefined, on=Undefined, snap=Undefined, source=Undefined, description=Undefined, persist=Undefined, push=Undefined, value=Undefined)View on GitHub

Create a GenomeSpy ruler parameter.

Parameters:
  • name – Parameter name. A stable name is generated when omitted.

  • clear – Event that clears the ruler, or false to keep the current value. __Default value:__ "mouseleave" for on: "mousemove", otherwise false.

  • disabled – Clears the coordinate and ignores tracking events while true. Expressions resolve where the ruler is declared. Re-enabling waits for the next pointer or viewport event; it does not restore the initial value. With push: "outer", other enabled bindings can still update the shared coordinate. __Default value:__ false

  • display – How the ruler is drawn for snapped index or locus coordinates. "line" draws at the coordinate. "center" draws at the center of the coordinate band. "band" draws a rectangle covering the coordinate band. "none" tracks the ruler value without drawing a guide. __Default value:__ "center" for snapped index and locus scales, otherwise "line".

  • encodings – Positional channels whose domain coordinates are tracked by the ruler. __Default value:__ ["x"]

  • extent – Visual extent of the ruler. "view" draws one guide per participating view. "container" draws one spanning guide when participating projections align. "auto" chooses a spanning guide only when it is safe. __Default value:__ "auto"

  • mark – Rule or band appearance. Expressions resolve in the scope where this ruler is declared, including when it uses push: "outer". Has no effect when display is "none".

  • on – Event that updates a pointer-driven ruler. "mousemove" follows the pointer. "mousedown" updates on press and continues while dragging. Event filters can require modifier keys. __Default value:__ "mousemove"

  • snap – Quantization applied before writing the ruler value. "auto" snaps index and locus scales to integer coordinates. "integer" snaps all numeric coordinates. false keeps the original coordinate. __Default value:__ "auto" for index and locus scales, otherwise false.

  • source – Source of the ruler coordinate. "pointer" uses pointer events configured by on. "viewport" tracks the center of the current viewport. __Default value:__ "pointer"

  • description – A description of the parameter. Can be used for documentation and to explain the meaning of the control or selection.

  • persist – Whether the parameter should be persisted in bookmarks and provenance. This primarily affects GenomeSpy App behavior. Set to false for ephemeral params (e.g., hover selections) or when the selection cannot be persisted due to missing encoding.key. __Default value:__ true

  • push – Reuses the nearest same-named parameter in an ancestor scope and writes updates to it. Declare the target parameter on the ancestor first. This is useful when interaction in a child view updates state owned by a composed view, such as a parameter that controls a shared scale.

  • value – Initial ruler value.

Returns:

A reusable parameter handle.

Raises:

TypeError – If the generated parameter definition is invalid.

Example

>>> ruler().param.to_dict(validate=False)
{...}