AbstractDataset

AbstractDataset

Dataset stored as a SummarizedExperiment (or one of its subclasses) in the takane format. This is intended as a virtual base class so that applications can define their own subclasses with the appropriate getter and listing methods. Subclasses should define abbreviate() and serialize() methods, as well as the static format() and unserialize() methods - see the Dataset contract for more details.

Constructor

new AbstractDataset(path, getter, lister)

Source:
Parameters:
Name Type Description
path string

Some kind of the path to the SummarizedExperiment. The exact interpretation of this argument is left to subclasses.

getter function

A (possibly async) function that accepts a string containing the relative path to the file of interest, and returns a Uint8Array of that file's contents. Each path is created by adding unix-style file separators to path.

lister function

A (possibly async) function that accepts a string containing the relative path to the directory of interest, and returns an array of the contents of that directory (non-recursive). Each path is created by adding unix-style file separators to path.

Classes

AbstractDataset

Methods

clear()

Description:
  • Destroy caches if present, releasing the associated memory. This may be called at any time but only has an effect if cache = true in load or summary.

Source:

(async) load(optionsopt) → {object}

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

Optional parameters.

Properties
Name Type Attributes Default Description
cache boolean <optional>
false

Whether to cache the intermediate results for re-use in subsequent calls to any methods with a cache option. If true, users should consider calling clear to release the memory once this dataset instance is no longer needed.

Returns:

Object containing the per-feature and per-cell annotations. This has the following properties:

  • features: an object where each key is a modality name and each value is a DataFrame of per-feature annotations for that modality.
  • cells: a DataFrame containing per-cell annotations.
  • matrix: a MultiMatrix containing one ScranMatrix per modality.
  • primary_ids: an object where each key is a modality name and each value is an array (usually of strings) containing the primary feature identifiers for each row in that modality.

Modality names are guaranteed to be one of "RNA", "ADT" or "CRISPR". We assume that the instance already contains an appropriate mapping from the observed feature types to each expected modality, either from the defaults or with setOptions.

Type
object

options() → {object}

Source:
Returns:

Object containing all options used for loading.

Type
object

(async) previewPrimaryIds(optionsopt) → {object}

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

Optional parameters.

Properties
Name Type Attributes Default Description
cache boolean <optional>
false

Whether to cache the intermediate results for re-use in subsequent calls to any methods with a cache option. If true, users should consider calling clear to release the memory once this dataset instance is no longer needed.

Returns:

An object where each key is a modality name and each value is an array (usually of strings) containing the primary feature identifiers for each row in that modality. The contents are the same as the primary_ids returned by load but the order of values may be different.

Type
object

setOptions(options)

Source:
Parameters:
Name Type Description
options object

Optional parameters that affect load (but not summary).

Properties
Name Type Attributes Description
rnaCountAssay string | number <optional>

Name or index of the assay containing the RNA count matrix.

adtCountAssay string | number <optional>

Name or index of the assay containing the ADT count matrix.

crisprCountAssay string | number <optional>

Name or index of the assay containing the CRISPR count matrix.

rnaExperiment string | number <optional>
<nullable>

Name or index of the alternative experiment containing gene expression data. If i is a negative integer, the main experiment is assumed to contain the gene expression data. Otherwise, if i is null or invalid (e.g., out of range index, unavailable name), it is ignored and no RNA data is assumed to be present.

adtExperiment string | number <optional>
<nullable>

Name or index of the alternative experiment containing ADT data. If i is a negative integer, the main experiment is assumed to contain the ADT data. Otherwise, if i is null or invalid (e.g., out of range index, unavailable name), it is ignored and no ADTs are assumed to be present.

crisprExperiment string | number <optional>
<nullable>

Name or index of the alternative experiment containing CRISPR guide data. If i is a negative integer, the main experiment is assumed to contain the guide data. Otherwise, if i is null or invalid (e.g., out of range index, unavailable name), it is ignored and no CRISPR guides are assumed to be present.

primaryRnaFeatureIdColumn string | number <optional>
<nullable>

Name or index of the column of the features DataFrame that contains the primary feature identifier for gene expression. If i is null or invalid (e.g., out of range index, unavailable name), it is ignored and the primary identifier is defined as the existing row names. However, if no row names are present in the SummarizedExperiment, no primary identifier is defined.

primaryAdtFeatureIdColumn string | number <optional>
<nullable>

Name or index of the column of the features DataFrame that contains the primary feature identifier for the ADTs. If i is null or invalid (e.g., out of range index, unavailable name), it is ignored and the primary identifier is defined as the existing row names. However, if no row names are present in the SummarizedExperiment, no primary identifier is defined.

primaryCrisprFeatureIdColumn string | number <optional>
<nullable>

Name or index of the column of the features DataFrame that contains the primary feature identifier for the CRISPR guides. If i is null or invalid (e.g., out of range index, unavailable name), it is ignored and the existing row names (if they exist) are used as the primary identifier. However, if no row names are present in the SummarizedExperiment, no primary identifier is defined.

(async) summary(optionsopt) → {object}

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

Optional parameters.

Properties
Name Type Attributes Default Description
cache boolean <optional>
false

Whether to cache the intermediate results for re-use in subsequent calls to any methods with a cache option. If true, users should consider calling clear to release the memory once this dataset instance is no longer needed.

Returns:

Object containing the per-feature and per-cell annotations. This has the following properties:

  • modality_features: an object where each key is a modality name and each value is a DataFrame of per-feature annotations for that modality.
  • cells: a DataFrame of per-cell annotations.
  • modality_assay_names: an object where each key is a modality name and each value is an Array containing the names of available assays for that modality. Unnamed assays are represented as null names.
Type
object

(static) defaults() → {object}

Source:
Returns:

Default options, see setOptions for more details.

Type
object