CellLabellingStandalone

CellLabellingStandalone

Standalone version of CellLabellingState that provides the same functionality outside of runAnalysis. Users can supply their own feature annotations to build the reference datasets prior to label assignment. Users should await on the return value of the ready method after construction. Once resolved, other methods in this class may be used.

Constructor

new CellLabellingStandalone(annotations)

Source:
Parameters:
Name Type Description
annotations external:DataFrame

Feature annotations for the dataset.

Classes

CellLabellingStandalone

Members

availableReferences :object

Description:
  • Available references for each species. Each key is a taxonomy ID and each value is an array of strings containing the names of references for that species.

Source:

Available references for each species. Each key is a taxonomy ID and each value is an array of strings containing the names of references for that species.

Type:
  • object

Methods

computeLabels(x, optionsopt) → {object}

Source:
Parameters:
Name Type Attributes Default Description
x external:ScranMatrix | external:ScoreMarkersResults

A matrix of (normalized or unnormalized) expression values, with genes in rows and cells/clusters in columns. Alternatively, an object containing marker results, e.g., as computed by MarkerDetectionState.

In both cases, the identity of genes should correspond to that in annotations in the constructor of this instance.

options object <optional>
{}

Optional parameters.

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

Array of length equal to the number of columns of x, containing grouping assignments. If provided, the average expression profile of each group is used for cell type labelling. This is only used if x is a ScranMatrix.

Returns:

Object containing:

  • per_reference: an object where each key is the name of a reference dataset and its value is an array. Each array is of length equal to the number of columns of x (if matrix), groups in x (if marker results), or groups in group. Each entry is an object containing best, the name of the best label assigned to a column/group in this reference; and all, an object where each key is a label in this reference dataset and its value is the score for assigning that label to this column/group.
  • (optional) integrated: an array of length equal to the number of columns/groups. Each entry is an object containing best, the name of the best reference for this column/group; and all, an object where each key is the name of a reference dataset and its value is the score for this column/group. This property is only reported if multiple references are used.
  • (optional) groups: an array of length equal to the number of groups, containing the identity of each group. Only reported if an input group is supplied and x is a ScranMatrix.
Type
object

fetchParameters() → {object}

Source:
Returns:

Object containing the parameters.

Type
object

(async) ready()

Description:
  • This should be called after construction and/or setParameters. Users should wait for the return value to resolve before calling any other methods of this class.

Source:
Returns:

Reference datasets are loaded into memory.

(async) setParameters(parameters)

Source:
Parameters:
Name Type Description
parameters object

Parameter object, equivalent to the cell_labelling property of the parameters of runAnalysis.

Properties
Name Type Attributes Description
references Array <nullable>

Array of strings specifying the names of the reference datasets, see availableReferences for more details. If null, all reference datasets from all species are used.

guess_ids boolean

Automatically choose feature-based parameters based on the feature annotation for the RNA modality. If true, the column of the annotation that best matches human/mouse Ensembl/symbols is identified and used to set species, gene_id_column and gene_id_type.

species Array

Array of strings specifying zero, one or more species involved in this dataset. Each entry should be a taxonomy ID (e.g. "9606", "10090") as specified in availableReferences. This is used internally to filter references to the entries relevant to these species. Ignored if guess_ids = true.

gene_id_column string | number <nullable>

Name or index of the column of the RNA entry of InputsState.fetchFeatureAnnotations containing the identity of each gene. If null, identifiers are taken from the row names. Ignored if guess_ids = true.

gene_id_type string

Type of feature identifier in gene_id_column. This should be one of "ENSEMBL", "SYMBOL" or "ENTREZ" Ignored if guess_ids = true.

Returns:

The object is updated with the new results.

(static) defaults() → {object}

Source:
Returns:

Default parameters that may be modified and fed into compute.

Type
object

(static) flush()

Description:
  • Flush all cached references.

    By default, this class will cache the loaded references in a global cache for re-use across CellLabellingStandlone instances. These cached references are not tied to any single instance and will not be removed by garbage collectors or by free. Rather, this function should be called to release the relevant memory.

Source:

(static) setDownload(fun)

Description:
  • Specify a function to download references for the cell labelling step.

Source:
Parameters:
Name Type Description
fun function

Function that accepts a single string containing a URL and returns any value that can be used in the SimpleFile constructor. This is most typically a Uint8Array of that URL's contents, but it can also be a path to a locally cached file on Node.js.

Returns:

fun is set as the global downloader for this step. The previous value of the downloader is returned.