rm_low_counts_tidy: Tidy Wrapper To Remove Lowly Expressed Genes From Expression...

Description Usage Arguments Value Examples

View source: R/feature_selection.R

Description

Tidy Wrapper To Remove Lowly Expressed Genes From Expression Data

Usage

1
2
3
4
5
6
rm_low_counts_tidy(
  expr,
  count_threshold = NULL,
  perc_threshold = NULL,
  transpose = FALSE
)

Arguments

expr

A tibble of gene expression with cells as rows and genes as columns

count_threshold

A threshold for the number of counts a gene must have to be included. Only one threshold may be used at a time.

perc_threshold

A threshold for what percentile the gene counts should be cut off at. Only one threshold may be used at a time.

transpose

A logical value indicating whether the expression matrix should be transposed before any operations are carried out.

Value

A tibble of gene expressions with the low count genes, as specified by the user, removed.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Creating Data
library(tibble)
gene1 <- c(0, 0, 0, 0, 1, 2, 3)
gene2 <- c(5, 5, 3, 2, 0, 0, 0)
gene3 <- c(2, 0, 2, 1, 3, 0, 1)
gene4 <- c(3, 3, 3, 3, 3, 3, 3)
gene5 <- c(0, 0, 0, 0, 5, 0, 0)
gene_counts <- matrix(c(gene1, gene2, gene3, gene4, gene5), ncol = 5)
rownames(gene_counts) <- paste0("cell", 1:7)
colnames(gene_counts) <- paste0("gene", 1:5)
gene_counts <- as_tibble(gene_counts)

# Removing Low Count Genes
rm_low_counts_tidy(gene_counts, count_threshold = 7)
rm_low_counts_tidy(gene_counts, perc_threshold = 0.1)

hwarden162/SCEnt documentation built on Dec. 20, 2021, 5:52 p.m.