Extract vector gene list (or named gene vector) from data.frame results of FindAllMarkers or similar analysis.

Extract_Top_Markers(
  marker_dataframe,
  num_genes = 10,
  group_by = "cluster",
  rank_by = "avg_log2FC",
  gene_column = "gene",
  gene_rownames_to_column = FALSE,
  data_frame = FALSE,
  named_vector = TRUE,
  make_unique = FALSE
)

Arguments

marker_dataframe

data.frame output from FindAllMarkers or similar analysis.

num_genes

number of genes per group (e.g., cluster) to include in output list.

group_by

column name of marker_dataframe to group data by. Default is "cluster" based on FindAllMarkers.

rank_by

column name of marker_dataframe to rank data by when selecting num_genes per group_by. Default is "avg_log2FC" based on FindAllMarkers.

gene_column

column name of marker_dataframe that contains the gene IDs. Default is "gene" based on FindAllMarkers.

gene_rownames_to_column

logical. Whether gene IDs are stored in rownames and should be moved to column. Default is FALSE.

data_frame

Logical, whether or not to return filtered data.frame of the original markers_dataframe or to return a vector of gene IDs. Default is FALSE.

named_vector

Logical, whether or not to name the vector of gene names that is returned by the function. If TRUE will name the vector using the column provided to group_by. Default is TRUE.

make_unique

Logical, whether an unnamed vector should return only unique values. Default is FALSE. Not applicable when data_frame = TRUE or named_vector = TRUE.

Value

filtered data.frame, vector, or named vector containing gene IDs.

Examples

if (FALSE) {
top10_genes <- Extract_Top_Markers(marker_dataframe = markers_results, num_genes = 10,
group_by = "cluster", rank_by = "avg_log2FC")
}