genome_spy.X2

class genome_spy.X2(value, /, *, band=Undefined, chrom=Undefined, datum=Undefined, description=Undefined, domainInert=Undefined, expr=Undefined, field=Undefined, offset=Undefined, pos=Undefined, resolutionChannel=Undefined, title=Undefined, type=Undefined, axis=Undefined, scale=Undefined)View on GitHub

Bases: Channel

Generated wrapper for the x2 encoding channel.

Methods

axis([value, chromGrid, chromGridCap, ...])

Return a channel with a GenomeAxis axis.

band(value)

Return a channel with band updated.

chrom(value)

Return a channel with chrom updated.

datum(value)

Return a channel with datum updated.

description(value)

Return a channel with description updated.

domainInert(value)

Return a channel with domainInert updated.

expr(value)

Return a channel with expr updated.

field(value)

Return a channel with field updated.

offset(value)

Return a channel with offset updated.

pos(value)

Return a channel with pos updated.

resolutionChannel(value)

Return a channel with resolutionChannel updated.

scale([value, align, assembly, base, bins, ...])

Return a channel with a Scale scale.

sort([value, field, order])

Return a channel with a sort configuration.

title(value)

Return a channel with title updated.

to_dict()

Return the JSON-serializable channel definition.

type(value)

Return a channel with type updated.

value(value)

Return a channel with value updated.

Attributes

definition

encoding_name

band(value)View on GitHub

Return a channel with band updated.

chrom(value)View on GitHub

Return a channel with chrom updated.

datum(value)View on GitHub

Return a channel with datum updated.

description(value)View on GitHub

Return a channel with description updated.

domainInert(value)View on GitHub

Return a channel with domainInert updated.

expr(value)View on GitHub

Return a channel with expr updated.

field(value)View on GitHub

Return a channel with field updated.

offset(value)View on GitHub

Return a channel with offset updated.

pos(value)View on GitHub

Return a channel with pos updated.

resolutionChannel(value)View on GitHub

Return a channel with resolutionChannel updated.

title(value)View on GitHub

Return a channel with title updated.

type(value)View on GitHub

Return a channel with type updated.

value(value)View on GitHub

Return a channel with value updated.

sort(value=Undefined, /, *, field=Undefined, order=Undefined)View on GitHub

Return a channel with a sort configuration.

axis(value=Undefined, /, *, chromGrid=Undefined, chromGridCap=Undefined, chromGridColor=Undefined, chromGridDash=Undefined, chromGridDashOffset=Undefined, chromGridFillEven=Undefined, chromGridFillOdd=Undefined, chromGridOpacity=Undefined, chromGridWidth=Undefined, chromLabelAlign=Undefined, chromLabelColor=Undefined, chromLabelFont=Undefined, chromLabelFontSize=Undefined, chromLabelFontStyle=Undefined, chromLabelFontWeight=Undefined, chromLabelPadding=Undefined, chromLabels=Undefined, chromTickColor=Undefined, chromTickDash=Undefined, chromTickDashOffset=Undefined, chromTickSize=Undefined, chromTickWidth=Undefined, chromTicks=Undefined, domain=Undefined, domainCap=Undefined, domainColor=Undefined, domainDash=Undefined, domainDashOffset=Undefined, domainWidth=Undefined, extraValues=Undefined, format=Undefined, grid=Undefined, gridCap=Undefined, gridColor=Undefined, gridDash=Undefined, gridDashOffset=Undefined, gridOpacity=Undefined, gridWidth=Undefined, labelAlign=Undefined, labelAngle=Undefined, labelBaseline=Undefined, labelColor=Undefined, labelFlush=Undefined, labelFlushOffset=Undefined, labelFont=Undefined, labelFontSize=Undefined, labelFontStyle=Undefined, labelFontWeight=Undefined, labelLimit=Undefined, labelOverlap=Undefined, labelPadding=Undefined, labelSeparation=Undefined, labels=Undefined, maxExtent=Undefined, minExtent=Undefined, offset=Undefined, orient=Undefined, placement=Undefined, style=Undefined, tickCap=Undefined, tickColor=Undefined, tickCount=Undefined, tickDash=Undefined, tickDashOffset=Undefined, tickMinStep=Undefined, tickSize=Undefined, tickWidth=Undefined, ticks=Undefined, title=Undefined, titleColor=Undefined, titleFit=Undefined, titleFont=Undefined, titleFontSize=Undefined, titleFontStyle=Undefined, titleFontWeight=Undefined, titleOpacity=Undefined, titlePadding=Undefined, values=Undefined, zindex=Undefined)View on GitHub

Return a channel with a GenomeAxis axis.

Parameters:
  • chromGrid (bool) – A boolean flag indicating if chromosome grid lines should be included as part of the axis. __Default value:__ false

  • chromGridCap (Literal['butt', 'round', 'square']) – The stroke cap for the chromosome grid line’s ending style. One of "butt", "round" or "square". __Default value:__ "butt"

  • chromGridColor (str) – Color of grid lines. __Default value:__ lightgray

  • chromGridDash (Sequence[float]) – An array of alternating [stroke, space] lengths for dashed chromosome grid mark lines.

  • chromGridDashOffset (float) – The pixel offset at which to start drawing with the chromosome grid mark dash array.

  • chromGridFillEven (str) – Fill color of odd chromosomes. __Default value:__ (none)

  • chromGridFillOdd (str) – Fill color of odd chromosomes. __Default value:__ (none)

  • chromGridOpacity (float) – The opacity of the chromosome grid lines. __Default value:__ 1

  • chromGridWidth (float) – Width of the chromosome grid lines. __Default value:__ 1

  • chromLabelAlign (Align_T) – Horizontal text alignment of chromosome name labels. __Default value:__ "left"

  • chromLabelColor (str) – Text color of chromosome name labels. __Default value:__ "black"

  • chromLabelFont (str) – The font of chromosome name labels.

  • chromLabelFontSize (float) – Font size of chromosome name labels, in pixels. __Default value:__ 13

  • chromLabelFontStyle (FontStyle_T) – Font style of chromosome name labels. __Default value:__ "normal"

  • chromLabelFontWeight (FontWeight_T) – Font weight of chromosome name labels. __Default value:__ "normal"

  • chromLabelPadding (float) – The padding, in pixels, between chromosome boundary ticks and chromosome name labels. __Default value:__ 7

  • chromLabels (bool) – A boolean flag indicating if chromosome name labels should be included as part of the genome axis. __Default value:__ true

  • chromTickColor (str) – The color of chromosome boundary ticks. __Default value:__ "#989898"

  • chromTickDash (Sequence[float]) – An array of alternating [stroke, space] lengths for dashed chromosome boundary ticks. __Default value:__ [4, 2]

  • chromTickDashOffset (float) – The pixel offset at which to start drawing with the chromosome tick dash array. __Default value:__ 1

  • chromTickSize (float) – The size in pixels of chromosome boundary ticks. __Default value:__ 18

  • chromTickWidth (float) – The width, in pixels, of chromosome boundary ticks. __Default value:__ 1

  • chromTicks (bool) – A boolean flag indicating if chromosome boundary ticks should be included as part of the genome axis. __Default value:__ true

  • domain (bool) – A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis. __Default value:__ true

  • domainCap (Literal['butt', 'round', 'square']) – The stroke cap for the domain line’s ending style. One of "butt", "round" or "square". __Default value:__ "butt"

  • domainColor (str) – Color of axis domain line. __Default value:__ "gray".

  • domainDash (Sequence[float]) – An array of alternating [stroke, space] lengths for dashed domain lines.

  • domainDashOffset (float) – The pixel offset at which to start drawing with the domain dash array.

  • domainWidth (float) – Stroke width of axis domain line __Default value:__ 1

  • extraValues (Sequence[float]) – Additional tick and label values to include alongside automatically generated ticks on continuous scales. Values outside the visible scale range are omitted and duplicates are removed. During automatic overlap removal, these labels are reduced against other explicitly specified labels but take precedence over automatically generated labels. This property is ignored on discrete scales and when values is set.

  • format (str) – The format specifier pattern for axis labels. Must be a legal d3-format specifier.

  • grid (bool) – A boolean flag indicating if grid lines should be included as part of the axis. __Default value:__ false

  • gridCap (Literal['butt', 'round', 'square']) – The stroke cap for the grid line’s ending style. One of "butt", "round" or "square". __Default value:__ "butt"

  • gridColor (str) – Color of grid lines. __Default value:__ lightgray

  • gridDash (Sequence[float]) – An array of alternating [stroke, space] lengths for dashed grid mark lines.

  • gridDashOffset (float) – The pixel offset at which to start drawing with the grid mark dash array.

  • gridOpacity (float) – The opacity of the grid lines. __Default value:__ 1

  • gridWidth (float) – Width of the grid lines. __Default value:__ 1

  • labelAlign (Align_T) – Horizontal text alignment of axis tick labels, overriding the default setting for the current axis orientation.

  • labelAngle (float) – The rotation angle of the axis labels. __Default value:__ -90 for nominal and ordinal fields; 0 otherwise.

  • labelBaseline (Baseline_T) – Vertical text baseline of axis tick labels, overriding the default setting for the current axis orientation. One of "alphabetic" (default), "top", "middle", "bottom".

  • labelColor (str) – The color of the tick label, can be in hex color code or regular color name.

  • labelFlush (bool | float) – Indicates whether labels near the beginning or end of the axis should be aligned flush with the scale range. A number specifies the endpoint distance threshold in pixels. true uses a threshold of one pixel. Flushing is supported for quantitative, index, and locus axes. By default, it is enabled for non-zoomable x axes of these types. On a zoomable x axis with a configured bounded zoom extent, ticks matching the extent boundaries are flushed while they remain visible. Other zoomable ticks and y-axis ticks are not flushed by default. Flushing supports label angles that are multiples of 90 degrees. The automatic behavior is disabled at other angles.

  • labelFlushOffset (float) – The number of pixels by which to move flush-adjusted labels outward from the axis range. __Default value:__ 0

  • labelFont (str) – The font of the tick label.

  • labelFontSize (float) – The font size of the label, in pixels.

  • labelFontStyle (FontStyle_T) – Font style of the title.

  • labelFontWeight (FontWeight_T) – Font weight of axis tick labels.

  • labelLimit (float) – Maximum allowed pixel width of axis tick labels. __Default value:__ 180

  • labelOverlap (bool | Literal['parity'] | Literal['greedy']) – The strategy for removing overlapping axis labels. true uses the "parity" strategy. "parity" removes every other label until the remaining labels no longer overlap. "greedy" keeps each label that does not overlap the previously retained label. false disables overlap removal. By default, overlap removal uses "parity" for linear-like continuous scales and "greedy" for logarithmic and symlog scales. It is disabled for discrete scales. Overlap removal supports label angles that are multiples of 90 degrees. The automatic behavior is disabled at other angles.

  • labelPadding (float) – The padding, in pixels, between axis and text labels. __Default value:__ 2

  • labelSeparation (float) – The minimum separation, in pixels, between retained axis labels. __Default value:__ 2

  • labels (bool) – A boolean flag indicating if labels should be included as part of the axis. __Default value:__ true.

  • maxExtent (float) – The maximum extent in pixels that axis ticks and labels should use. This determines a maximum offset value for axis titles. __Default value:__ undefined.

  • minExtent (float) – The minimum extent in pixels that axis ticks and labels should use. This determines a minimum offset value for axis titles. __Default value:__ 30 for y-axis; undefined for x-axis.

  • offset (float) – The orthogonal offset in pixels by which to displace the axis from its position along the edge of the chart.

  • orient (AxisOrient_T) – The orientation of the axis. One of "top", "bottom", "left" or "right". The orientation can be used to further specialize the axis type (e.g., a y axis oriented for the right edge of the chart). __Default value:__ "bottom" for x-axes and "left" for y-axes.

  • placement (AxisPlacement_T) – Placement of the axis relative to the plotting area. Outside axes reserve layout space outside the plot. Inside axes are mirrored into the plot and do not reserve external layout space. __Default value:__ "outside".

  • style (str | Sequence[str] | None) – Named style reference(s) resolved from config.style. If an array is provided, later styles override earlier ones. Set to null to reset inherited axis styles.

  • tickCap (Literal['butt', 'round', 'square']) – The stroke cap for the tick lines’ ending style. One of "butt", "round" or "square". __Default value:__ "butt"

  • tickColor (str) – The color of the axis’s tick. __Default value:__ "gray"

  • tickCount (float | ExprRef | dict[str, Any]) – A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are “nice” (multiples of 2, 5, 10) and lie within the underlying scale’s range. An expression reference can use axisLength for the current length of the axis in pixels. For example, { "expr": "ceil(axisLength / 40)" } requests one tick per 40 pixels. __Default value:__ an expression based on axisLength

  • tickDash (Sequence[float]) – An array of alternating [stroke, space] lengths for dashed tick mark lines.

  • tickDashOffset (float) – The pixel offset at which to start drawing with the tick mark dash array.

  • tickMinStep (float) – The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of 1 indicates that ticks should not be less than 1 unit apart. If tickMinStep is specified, the tickCount value will be adjusted, if necessary, to enforce the minimum step value.

  • tickSize (float) – The size in pixels of axis ticks. __Default value:__ 5

  • tickWidth (float) – The width, in pixels, of ticks. __Default value:__ 1

  • ticks (bool) – Boolean value that determines whether the axis should include ticks. __Default value:__ true

  • title (str | None) – A title for the axis. By default, the title is derived from the encoding title, field, or expression. Set to null to remove it.

  • titleColor (str) – Color of the title, can be in hex color code or regular color name.

  • titleFit (Literal['point', 'range']) – Fitting mode for the axis title. "point" anchors the title at the center of the axis without constraining its length. "range" constrains the title to the axis span using ranged text, allowing it to be squeezed to fit and kept visible inside scrollable viewports. __Default value:__ "point"

  • titleFont (str) – Font of the title. (e.g., "Helvetica Neue").

  • titleFontSize (float) – Font size of the title.

  • titleFontStyle (FontStyle_T) – Font style of the title.

  • titleFontWeight (FontWeight_T) – Font weight of the title. This can be either a string (e.g "bold", "normal") or a number (100, 200, 300, …, 900 where "normal" = 400 and "bold" = 700).

  • titleOpacity (float) – Opacity of the axis title.

  • titlePadding (float) – The padding, in pixels, between title and axis.

  • values (Sequence[Any]) – Explicitly set the visible axis tick and label values. During automatic overlap removal, these labels are reduced against each other but take precedence over automatically generated labels.

  • zindex (float) – Z-order of the axis relative to the view content. Values greater than 0 render after the view marks. Values less than or equal to 0 render before the marks. __Default value:__ 0, or 10 when the view content is clipped or scrollable.

scale(value=Undefined, /, *, align=Undefined, assembly=Undefined, base=Undefined, bins=Undefined, clamp=Undefined, constant=Undefined, domain=Undefined, domainMax=Undefined, domainMid=Undefined, domainMin=Undefined, domainTransition=Undefined, exponent=Undefined, interpolate=Undefined, name=Undefined, nice=Undefined, numberingOffset=Undefined, padding=Undefined, paddingInner=Undefined, paddingOuter=Undefined, range=Undefined, reverse=Undefined, round=Undefined, scheme=Undefined, type=Undefined, zero=Undefined, zoom=Undefined)View on GitHub

Return a channel with a Scale scale.

Parameters:
  • align (float) – The alignment of the steps within the scale range. This value must lie in the range [0,1]. A value of 0.5 indicates that the steps should be centered within the range. A value of 0 or 1 may be used to shift the bands to one side, say to position them adjacent to an axis. __Default value:__ 0.5

  • assembly (str | UrlGenomeDefinition | dict[str, Any] | InlineGenomeDefinition) – Genome assembly definition for locus scales. This can be: - A string reference to a named assembly (built-in or root-configured). - An inline anonymous assembly that defines either contigs or url. If undefined, the default genome from the genome store is used.

  • base (float) – The logarithm base of the log scale (default 10).

  • bins (Sequence[float]) – An array of bin boundaries over the scale domain. If provided, axes and legends will use the bin boundaries to inform the choice of tick marks and text labels.

  • clamp (bool) – If true, values that exceed the data domain are clamped to either the minimum or maximum range value __Default value:__ derived from the Vega-Lite scale config’s clamp (true by default).

  • constant (float) – A constant determining the slope of the symlog function around zero. Only used for symlog scales. __Default value:__ 1

  • domain (ScalarDomain_T | Sequence[ChromosomalLocus | dict[str, Any]] | SelectionDomainRef | dict[str, Any] | ViewportDomainRef | ExprRef | Sequence[float | str | bool | ExprRef | dict[str, Any]]) – Customized domain values. For quantitative fields, domain can take the form of a two-element array with minimum and maximum values. Vega-Lite piecewise scales can be created by providing a domain with more than two entries. For ordinal and nominal fields, domain can be an array that lists valid input values. The domain can also be defined by an expression reference that evaluates to the domain array. Array elements may also be expression references. All parameter names referenced by a scale, including selection-domain parameters, resolve from the view that owns the scale resolution. For a shared scale, declare controlling parameters on that owning composed view or an ancestor.

  • domainMax (float) – Sets the maximum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains.

  • domainMid (float) – Inserts a single mid-point value into a two-element domain. The mid-point value must lie between the domain minimum and maximum values. This property can be useful for setting a midpoint for Vega-Lite diverging color scales. The domainMid property is only intended for use with scales supporting continuous, piecewise domains.

  • domainMin (float) – Sets the minimum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains.

  • domainTransition (bool) – Controls whether domain updates are applied immediately or with a smooth transition. Set this to false to apply domain updates immediately. The default is true, except for domains that include ExprRef``s, which default to ``false unless overridden. __Default value:__ true, except false for ExprRef-driven domains.

  • exponent (float) – The exponent of the pow scale.

  • interpolate (ScaleInterpolate_T | ScaleInterpolateParams | ScaleInterpolateParamsKwds) – The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include rgb, hsl, hsl-long, lab, hcl, hcl-long, cubehelix and cubehelix-long (‘-long’ variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued type property and an optional numeric gamma property applicable to rgb and cubehelix interpolators. For more, see the d3-interpolate documentation. __Default value:__ hcl

  • name (str) – The name of the scale. Names are optional but allow the scales to be referenced and found with the API.

  • nice (bool | float | dict[str, Any]) – Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of [0.201479…, 0.996679…], a nice domain might be [0.2, 1.0]. For quantitative scales such as linear, nice can be either a boolean flag or a number. If nice is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain. __Default value:__ true for unbinned quantitative fields; false otherwise.

  • numberingOffset (float) – The offset added to data values when formatting tick labels on index and locus scales. This property does not transform data values. __Default value:__ 0

  • padding (float) – For Vega-Lite continuous scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the zero, nice, domainMin, and domainMax properties. For Vega-Lite band scales, shortcut for setting paddingInner and paddingOuter to the same value. For Vega-Lite point scales, alias for paddingOuter. __Default value:__ For continuous scales, derived from the Vega-Lite scale config’s continuousPadding. For band and point scales, see paddingInner and paddingOuter. By default, Vega-Lite sets padding such that width/height = number of unique values * step.

  • paddingInner (float) – The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1]. For point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands). __Default value:__ derived from the Vega-Lite scale config’s bandPaddingInner.

  • paddingOuter (float) – The outer padding (spacing) at the ends of the range of band and point scales, as a fraction of the step size. This value must lie in the range [0,1]. __Default value:__ derived from the Vega-Lite scale config’s bandPaddingOuter for band scales and pointPadding for point scales. By default, Vega-Lite sets outer padding such that width/height = number of unique values * step.

  • range (Sequence[float | str | ExprRef | dict[str, Any]] | str) – The range of the scale. One of: - A string indicating a pre-defined named scale range from Vega-Lite (e.g., example, "symbol", or "diverging"). - For Vega-Lite continuous scales, two-element array indicating minimum and maximum values, or an array with more than two entries for specifying a Vega-Lite piecewise scale. Array elements may also be expression references, which use the parameter scope of the view that owns the scale resolution. - For Vega-Lite discrete and Vega-Lite discretizing scales, an array of desired output values. Array elements may also be expression references, which use the parameter scope of the view that owns the scale resolution. __Notes:__ 1) For color scales you can also specify a color scheme instead of range. 2) Any directly specified range for x and y channels will be ignored. Range can be customized via the view’s corresponding Vega-Lite size (width and height).

  • reverse (bool) – If true, reverses the order of the scale range. __Default value:__ false.

  • round (bool) – If true, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid. __Default value:__ false.

  • scheme (str | SchemeParams | SchemeParamsKwds) – A string indicating a color Vega-Lite scheme name (e.g., "category10" or "blues") or a Vega-Lite scheme parameter object. Discrete color schemes may be used with Vega-Lite discrete or Vega-Lite discretizing scales. Continuous color schemes are intended for use with color scales. For the full list of supported schemes, please refer to the Vega Scheme reference.

  • type (ScaleType_T) – The type of scale. GenomeSpy follows the Vega-Lite scale model; the links below refer to the Vega-Lite documentation: 1) Continuous Scales – mapping continuous domains to continuous output ranges ("linear", "pow", "sqrt", "symlog", "log", "time", "utc"). 2) Discrete Scales – mapping discrete domains to discrete ("ordinal") or continuous ("band" and "point") output ranges. 3) Discretizing Scales – mapping continuous domains to discrete output ranges "bin-ordinal", "quantile", "quantize" and "threshold". GenomeSpy also provides index and locus scales for sequence and genomic coordinates. __Default value:__ please see the Vega-Lite scale type table.

  • zero (bool) – If true, ensures that a zero baseline value is included in the scale domain. __Default value:__ true for x and y channels if the quantitative field is not binned and no custom domain is provided; false otherwise. __Note:__ Log scales do not support zero.

  • zoom (bool | ZoomParams | ZoomParamsKwds) – If true and the scale is used on a positional channel, it can bee zoomed and translated interactively.

to_dict()View on GitHub

Return the JSON-serializable channel definition.