isColorMapCompatible {iSEE}R Documentation

Check compatibility between ExperimentColorMap and SummarizedExperiment objects

Description

This function compares a pair of ExperimentColorMap and SingleCellExperiment objects, and examines whether all of the assays, colData, and rowData defined in the ExperimentColorMap object exist in the SingleCellExperiment object.

Usage

isColorMapCompatible(ecm, se, error = FALSE)

Arguments

ecm

An ExperimentColorMap.

se

A SingleCellExperiment.

error

A logical value that indicates whether an informative error should be thrown, describing why the two objects are not compatible.

Value

A logical value that indicates whether a given pair of ExperimentColorMap and SummarizedExperiment objects are compatible. If error=TRUE, an informative error is thrown, rather than returing FALSE.

Author(s)

Kevin Rue-Albrecht

Examples


# Example color maps ----

count_colors <- function(n){
  c("black","brown","red","orange","yellow")
}

qc_color_fun <- function(n){
  qc_colors <- c("forestgreen", "firebrick1")
  names(qc_colors) <- c("Y", "N")
  return(qc_colors)
}

ecm <- ExperimentColorMap(
    assays = list(
        tophat_counts = count_colors
    ),
    colData = list(
        passes_qc_checks_s = qc_color_fun
    )
)

# Example SingleCellExperiment ----

library(scRNAseq)
data(allen)
library(scater)
sce <- as(allen, "SingleCellExperiment")

# Test for compatibility ----

isColorMapCompatible(ecm, sce)


[Package iSEE version 1.0.1 Index]