Given a list of cell types and marker genes, convert to a binary cell type by gene matrix required by cellassign.

marker_list_to_mat(marker_list, include_other = TRUE)

Arguments

marker_list

A list where each entry is named by a cell type and contains a character vector of gene names belonging to that cell type

include_other

If TRUE adds a column of zeros for cells that do not exhibit high expression of any marker gene to be binned into

Value

A cell type by gene binary matrix with 1 if a gene is a marker for a cell type and 0 otherwise

Details

This function takes a list of marker genes and converts it to a binary gene by cell type matrix. The input list should be the same length as the number of cell types with names corresponding to cell types. Each element of the list should be a character vector of the genes corresponding to that cell type. There is no requirement for mutually-exclusive marker genes.

Examples

marker_list <- list( `cell_type_1` = c("geneA", "geneB"), `cell_type_2` = c("geneB", "geneC") ) marker_list_to_mat(marker_list)
#> cell_type_1 cell_type_2 other #> geneA 1 0 0 #> geneB 1 1 0 #> geneC 0 1 0