countUniqueFeatures: Count Unique Features

View source: R/QFeatures-functions.R

countUniqueFeaturesR Documentation

Count Unique Features

Description

This function counts the number of unique features per sample. A grouping structure can be provided to count higher level features from assays, for example counting the number of unique proteins from PSM data.

Usage

countUniqueFeatures(object, i, groupBy = NULL, colDataName = "count")

Arguments

object

An object of class QFeatures.

i

A numeric() or character() vector indicating from which assays the rowData should be taken.

groupBy

A character(1) indicating the variable name in the rowData that contains the grouping variable, for instance to count the unique number of peptides or proteins expressed in each samples (column). If groupBy is missing, the number of non zero elements per sample will be stored.

colDataName

A character(1) giving the name of the new variable in the colData where the number of unique features will be stored. The name cannot already exist in the colData.

Value

An object of class QFeatures.

Examples

data("ft_na")
## Count number of (non-missing) PSMs
ft_na <- countUniqueFeatures(ft_na, 
                             i = "na", 
                             colDataName = "counts")
ft_na$counts
## Count number of unique rowData feature
ft_na <- countUniqueFeatures(ft_na, 
                             i = "na", 
                             groupBy = "Y",
                             colDataName = "Y_counts")
ft_na$Y_counts


lgatto/Features documentation built on Dec. 25, 2024, 5:50 a.m.