Validate a SingleCellExperiment created by readH5AD(). Designed to be used inside testhat::test_that() during package testing.

validateH5ADSCE(sce, names, missing)

Arguments

sce

A SingleCellExperiment object.

names

Named list of expected names. Names are slots and values are vectors of names that are expected to exist in that slot.

missing

Named list of known missing names. Names are slots and values are vectors of names that are expected to not exist in that slot.

Value

If checks are successful TRUE invisibly, if not other output depending on the context

Details

This function checks that a SingleCellExperiment contains the expected items in each slot. The main reason for this function is avoid repeating code when testing multiple .h5ad files. The following items in names and missing are recognised:

  • assays - Assay names

  • colData - colData column names

  • rowData - rowData column names

  • metadata - metadata names

  • redDim - Reduced dimension names

  • varm - Column names of the varm rowData column (from the AnnData varm slot)

  • colPairs - Column pair names

  • rowPairs - rowData pair names

  • raw_rowData - rowData columns names in the raw altExp

  • raw_varm - Column names of the raw varm rowData column (from the AnnData varm slot)

If an item in names or missing is NULL then it won't be checked. The items in missing are checked that they explicitly do not exist. This is mostly for record keeping when something is known to not be converted but can also be useful when the corresponding names item is NULL.

Author

Luke Zappia