get-names {ondisc}R Documentation

Get cell barcodes, feature names, and feature IDs

Description

Obtain cell barcodes, feature names, and feature IDs of an ondisc_matrix, metadata_ondisc_matrix, or multimodal_ondisc_matrix.

Usage

get_feature_ids(x)

get_feature_names(x)

get_cell_barcodes(x)

## S4 method for signature 'ondisc_matrix'
get_feature_ids(x)

## S4 method for signature 'ondisc_matrix'
get_feature_names(x)

## S4 method for signature 'ondisc_matrix'
get_cell_barcodes(x)

## S4 method for signature 'metadata_ondisc_matrix'
get_feature_ids(x)

## S4 method for signature 'metadata_ondisc_matrix'
get_feature_names(x)

## S4 method for signature 'metadata_ondisc_matrix'
get_cell_barcodes(x)

## S4 method for signature 'multimodal_ondisc_matrix'
get_feature_ids(x)

## S4 method for signature 'multimodal_ondisc_matrix'
get_feature_names(x)

## S4 method for signature 'multimodal_ondisc_matrix'
get_cell_barcodes(x)

Arguments

x

an object of class ondisc_matrix, covaraite_ondisc_matrix, or multimodal_ondisc_matrix.

Details

The following functions can be used to obtain feature and cell identifiers:

In general, these functions return a character vector containing the requested identifiers. When get_feature_names or get_feature_ids is called on a multimodal_ondisc_matrix, the function instead returns a list containing the feature names and feature IDs, respectively, of the modalities contained within the multimodal_ondisc_matrix.

Value

A character vector or list of character vectors containing the requested identifiers.

Examples

# NOTE: You must create the RDS files "expressions.rds" and
# "perturbations.rds" to run this example. Navigate to the help file of
# "create_ondisc_matrix_from_mtx" (via ?create_ondisc_matrix_from_mtx),
# and execute both code blocks.

# ondisc_matrix
h5_fp <- paste0(tempdir(), "/expressions.h5")
if (file.exists(h5_fp)) {
odm <- ondisc_matrix(h5_file = h5_fp)
barcodes <- get_cell_barcodes(odm)
feature_names <- get_feature_names(odm)
feature_ids <- get_feature_ids(odm)
}

# metadata_ondic_matrix
expressions_fp <- paste0(tempdir(), "/expressions.rds")
if (file.exists(expressions_fp)) {
expressions <- readRDS(expressions_fp)
barcodes <- get_cell_barcodes(odm)
feature_names <- get_feature_names(odm)
feature_ids <- get_feature_ids(odm)
}

# multimodal_ondisc_matrix
expression_fp <- paste0(tempdir(), "/expressions.rds")
perturbations_fp <- paste0(tempdir(), "/perturbations.rds")
if (file.exists(expression_fp) && file.exists(perturbations_fp)) {
    crispr_experiment <- multimodal_ondisc_matrix(list(expressions = readRDS(expression_fp),
    perturbations = readRDS(perturbations_fp)))
    barcodes <- get_cell_barcodes(crispr_experiment)
    feature_ids <- get_feature_ids(crispr_experiment)
}

[Package ondisc version 1.0.0 Index]