bin_scdata {scFeatureFilter}R Documentation

Bin genes by mean expression.

Description

Divides the genes that were not included in the top window in windows of the same size with decreasing mean expression levels.

Usage

bin_scdata(dataset, window_number = NULL, window_size = NULL,
  verbose = TRUE)

Arguments

dataset

A list, containing the top window generated by extract_top_genes as the first element, and the rest of undivided genes as the second. Usually the output of define_top_genes

window_number

An integer, indicating the number of bins to be used.

window_size

An integer, indicating the number of genes to be included in each window. Ignored if window_size is defined.

verbose

A boolean. Should the function print a message about window size or the number of windows created?

Details

Two binning methods are available:

This function adds a bin number column to the data frame.

This function is designed to take the list output by the extract_top_window function as an argument, operating only on the second element of it. Once the genes in it have been binned, both elements of the list are bound together in a data frame and returned. The output contains a new column bin, which indicates the window number assigned to each gene.

Value

A data frame containing the binned genes.

Examples

library(magrittr)
expMat <- matrix(
    c(1, 1, 1,
      1, 2, 3,
      0, 1, 2,
      0, 0, 2),
    ncol = 3, byrow = TRUE, dimnames = list(paste("gene", 1:4), paste("cell", 1:3))
)

calculate_cvs(expMat) %>%
    define_top_genes(window_size = 1) %>%
    bin_scdata(window_number = 2)

calculate_cvs(expMat) %>%
    define_top_genes(window_size = 1) %>%
    bin_scdata(window_size = 1)


[Package scFeatureFilter version 1.8.0 Index]