prepSCE {muscat} | R Documentation

## Prepare SCE for DS analysis

### Description

...

### Usage

    prepSCE(x, cluster_id, sample_id, group_id, drop = FALSE)

### Arguments

`x` | a `SingleCellExperiment`.
`cluster_id, sample_id, group_id` | character strings specifying the `colData(x)` columns containing cluster assignments, unique sample identifiers, and group IDs (e.g., treatment).
`drop` | logical. Specifies whether `colData(x)` columns besides those specified as `cluster_id,sample_id,group_id` should be retained (default `drop = FALSE`) or removed (`drop = TRUE`).

### Value

a `SingleCellExperiment`.

### Author(s)

Helena L Crowell

### Examples

    # generate random counts
    ng <- 50
    nc <- 200
    counts <- matrix(sample(ng * nc), nrow = ng, ncol = nc)

    # generate some cell metadata
    gids <- sample(c("groupA", "groupB"), nc, TRUE)
    sids <- sample(paste0("sample", seq_len(3)), nc, TRUE)
    kids <- sample(paste0("cluster", seq_len(5)), nc, TRUE)
    batch <- sample(seq_len(3), nc, TRUE)

    # construct SCE
    library(SingleCellExperiment)
    sce <- SingleCellExperiment(
      assays = list(counts = counts),
      colData = data.frame(group = gids, id = sids, cluster = kids, batch))

    # prep. for workflow
    sce <- prepSCE(sce,
      group_id = "group",
      sample_id = "id",
      cluster_id = "cluster")

    head(colData(sce))
    metadata(sce)$experiment_info

[Package muscat version 1.0.1 Index]