feature_select: Feature Selection

View source: R/feature_selection.R

feature_selectR Documentation

Feature Selection

Description

This function selects features based on either correlation or differential expression analysis. It uses the 'limma' package for differential expression and basic statistical tests for correlation analysis.

Usage

feature_select(
  x,
  y,
  method = c("cor", "dif"),
  family = c("spearman", "pearson"),
  cutoff = NULL,
  padjcut = NULL
)

Arguments

x

A matrix with rownames representing features like gene symbols or cgi, and colnames as samples.

y

A response variable vector that can be quantitative, binary, or survival type.

method

Specifies the method for feature selection; "cor" for correlation or "dif" for differential expression.

family

Specifies the correlation method to use if method="cor"; options are "spearman" or "pearson".

cutoff

Numeric value for estimating and log2 fold change cutoff for correlation analysis and limma differential analysis.

padjcut

Numeric value for adjusted P-value cutoff.

Value

Returns a vector of selected feature names based on the specified criteria.

Examples

data("imvigor210_eset",package = "IOBR")
data("imvigor210_pdata", package = "IOBR")

mad <- apply(imvigor210_eset, 1, mad)
imvigor210_eset <- imvigor210_eset[mad > 0.5, ]
pd1 <- as.numeric(imvigor210_eset["PDCD1", ])
group <- ifelse(pd1 > mean(pd1), "high", "low")
pd1_cor <- feature_select(x = imvigor210_eset, y = pd1, method = "cor", family = "pearson", padjcut = 0.05, cutoff = 0.5)
pd1_dif <- feature_select(x = imvigor210_eset, y = pd1, method = "dif", padjcut = 0.05, cutoff = 2)
pd1_dif_2 <- feature_select(x = imvigor210_eset, y = group, method = "dif", padjcut = 0.05, cutoff = 2)

IOBR/IOBR documentation built on April 3, 2025, 2:19 p.m.