lm_count_mat_emp_pval: Wrapper function for differential expression analysis

View source: R/lm_count_mat.R

lm_count_mat_emp_pvalR Documentation

Wrapper function for differential expression analysis

Description

The function is to calculate DEG (Differential Expression Genes) analysis using residual permuation approach to calculate empirical p-value

Usage

lm_count_mat_emp_pval(
  count_matrix,
  pheno,
  trait,
  covariates_string,
  n_permute = 100,
  gene_IDs = NULL,
  log_transform = "log_replace_half_min",
  seed = NULL,
  outcome_type = "continuous"
)

Arguments

count_matrix

A matrix of gene counts (possibly transformed). rows are genes, columns are individuals

pheno

A data frame of phenotype data, includes the trait and covariates

trait

A character, the name of the exposure variable. The trait should be a column in pheno

covariates_string

Characters string with specifying the covariats, include "as.factor" statements. example: covariate_string = "age+as.factor(sex)"

n_permute

number of computing residual permutation. Default is 100 times

gene_IDs

A vector of selection of geneID, NULL if all genes are tested

log_transform

One of the transformations log_replace_half_min, log_add_min, log_add_0.5, or NULL (default)

seed

Random seed

outcome_type

continuous and binary.Default is continuous

Value

Linear regression results as a data frame with columns geneID, adjLogFC,se,t_stat (t-statistic),t_stat_df(degree of freedom),p_value, fdr_bh,, emp_pvals,bh_emp_pvals

Examples

set.seed(123)
library(dplyr)
data(phenotype)
data(rnaseq_count_matrix)
rnaseq_count_matrix<- rnaseq_count_matrix[rowSums(rnaseq_count_matrix)>0,]
trait<-"Trait.1"
covars<- "Age+Sex"
lm_count_mat_emp_pval(count_matrix=rnaseq_count_matrix,pheno = phenotype,trait = trait,
                      covariates_string=covars, outcome_type="continuous")

nkurniansyah/Olivia documentation built on July 29, 2023, 9:10 a.m.