CustomSelectionsStandalone

CustomSelectionsStandalone

Standalone version of CustomSelectionsState that provides the same functionality outside of runAnalysis. Users can supply their own normalized matrices and blocking factor to compute the various marker statistics for each custom selection. Users are also responsible for ensuring that the lifetime of the supplied objects exceeds that of the constructed CustomSelectionsStandalone instance, i.e., the Wasm-related free() methods are not called while the MarkerDetectionStandalone instance is still in operation.

Constructor

new CustomSelectionsStandalone(normalized, optionsopt)

Source:
Parameters:
Name Type Attributes Default Description
normalized external:MultiMatrix

A MultiMatrix of log-normalized values for multiple modalities.

options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
block Array | TypedArray <optional>
<nullable>
null

Array of length equal to the number of columns in any value of normalized, containing the block assignments for each column. If null, all columns are assigned to the same block.

Classes

CustomSelectionsStandalone

Methods

addSelection(id, selection, optionsopt)

Description:
  • Add a custom selection and compute its markers. Users should run compute at least once before calling this function.

Source:
Parameters:
Name Type Attributes Description
id string

A unique identifier for the new custom selection.

selection Array | TypedArray

The indices of the cells in the selection.

options object <optional>

Optional parameters.

Properties
Name Type Attributes Default Description
copy boolean <optional>
true

Whether to make a copy of selection before storing it inside this object. If false, it is assumed that the caller makes no further modifications to the passed selection.

Returns:

The custom selection is added to the state and calculation of its markers is performed. Nothing is returned.

computeVersus(left, right) → {object}

Description:
  • Extract markers for a pairwise comparison between two selections, for more detailed examination of the differences between them.

Source:
Parameters:
Name Type Description
left string

Identifier of one selection in which to find upregulated markers.

right string

Identifier of another selection to be compared against left.

Returns:

Object containing:

  • results: object containing the marker statistics for the comparison between two clusters. Each key is a modality name and each value is a ScoreMarkersResults object.
  • left: index of the group corresponding to the left selection in each ScoreMarkersResults object. e.g., Cohen's d for the RNA markers of the left selection are defined as output.results.RNA.cohen(output.left).
  • right: index of the group corresponding to the right selection in each ScoreMarkersResults object. e.g., Cohen's d for the RNA markers of the right selection are defined as output.results.RNA.cohen(output.right).
Type
object

fetchBlockLevels(optionsopt) → {Array}

Source:
Parameters:
Name Type Attributes Default Description
options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
copy boolean <optional>
true

Whether to copy the return value on output. Set to false for greater efficiency in strictly read-only applications.

Returns:

Array of levels for the blocking factor. Block indices in the ScoreMarkersResults instances returned by fetchResults can be cross-referenced to this array.

Type
Array

fetchParameters() → {object}

Source:
Returns:

Object containing the parameters.

Type
object

fetchResults(id) → {object}

Source:
Parameters:
Name Type Description
id string

An identifier for the desired selection.

Returns:

Object containing the markers for the desired selection. Each key is a modality name while each value is a ScoreMarkersResults object, containing the marker detection results across all features of the corresponding modality. The set of cells in the selection is denoted as group 1, while all cells outside of the selection are denoted as group 0.

Type
object

fetchSelectionIndices(id, optionsopt) → {Array|TypedArray}

Description:
  • Retrieve the indices for a selection of interest.

Source:
Parameters:
Name Type Attributes Description
id string

The identifier for the selection.

options object <optional>

Optional parameters.

Properties
Name Type Attributes Default Description
copy boolean <optional>
true

Whether to make a copy of selection before returning it. If false, it is assumed that the caller does not modify the selection.

Returns:

Array of indices in the requested selection.

Type
Array | TypedArray

fetchSelections(optionsopt, forceopt, nullable) → {object}

Description:
  • Retrieve indices for all selections.

Source:
Parameters:
Name Type Attributes Default Description
options object <optional>

Optional parameters.

Properties
Name Type Attributes Default Description
copy boolean <optional>
true

Whether to make a copy of selection before returning it. If false, it is assumed that the caller does not modify the selection.

force string <optional>
<nullable>
null

Whether to force each selection to be an "Array" or "Int32Array". If null, the existing type of each selection is used.

Returns:

Object where the keys are the selection names and the values are arrays of indices for each selection. Each array is a copy and can be modified without affecting the CustomSelectionsState.

Type
object

free()

Description:
  • Frees all resources associated with this instance.

Source:

removeSelection(id)

Description:
  • Remove a custom selection and its results from the state.

Source:
Parameters:
Name Type Description
id string

An identifier for the selection to be removed.

Returns:

The specified selection and its results are removed from the state. Nothing is returned.

setParameters(parameters)

Description:
  • If this method is not called, the parameters default to those in CustomSelectionsState.defaults.

Source:
Parameters:
Name Type Description
parameters object

Parameter object, see the argument of the same name in CustomSelectionsState.compute for more details.

Returns:

The state is updated with the new parameters.