min_count_filter: min_count_filter

View source: R/MODULE_3_QC_PCA.R

min_count_filterR Documentation

min_count_filter

Description

Function to filter out genes with counts below a minimum in one or more samples.

Usage

min_count_filter(x, mincount, columns, method = "all")

Arguments

x

Input data frame containing RNA-seq or Ribo-seq data. Rows are genes/transcripts and columns are samples. The data.frame may contain additional columns for gene/transcript ID or other metadata.

mincount

A single number (float), minimum RNA or RPF count required for a gene/transcript to be retained.

columns

A vector specifying the columns to be considered for minimum count filtering.

method

The method of filtering. Options: "all", "average". Default: "all".

Details

If method="all" is chosen, a gene passes the filtering only if all samples specified by the columns argument have values >= mincount. If method="average" is chosen, a gene passes the filtering if the average count among the specified columns is >= mincount.

Use the columns argument to exclude gene/transcript ID and other metadata columns from the calculations or to filter RNA and RPF counts separately while keeping them in the same data.frame.

Value

Filtered data frame containing all the original columns but only the rows (genes) that pass the filtering criterion.

Examples

rr_LMCN.v1 <- min_count_filter(rr_LMCN, mincount = 5, columns = c(2:9), method = "all")
rr_LMCN.v2 <- min_count_filter(rr_LMCN.v1, mincount = 2, columns = c(10:17), method = "average")

goodarzilab/Ribolog documentation built on Oct. 7, 2022, 10:14 p.m.