lm_mult_count_mat_emp_pval: Wrapper function for differential expression analysis for...

View source: R/mult_lm_count_mat.R

lm_mult_count_mat_emp_pvalR Documentation

Wrapper function for differential expression analysis for multiple exposure

Description

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

Usage

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

Arguments

count_matrix

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

pheno

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

traits

Characters, the name of the exposure variable. The traits should be a column in pheno.

covariates_string

A character 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

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

seed

Random seed

log_transform

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

outcome_type

continuous and binary.Default is continuous

Value

Linear regression results as a data frame with columns geneID, adjLogFC.Trait1,adjLogFC.Trait2 ,se, chisq_stat,chisq_stat_df(degree of freedom),p_value(join p-value),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,]
traits<-c("Trait.1","Trait.2")
covars<- "Age+Sex"
lm_mult_count_mat_emp_pval(count_matrix=rnaseq_count_matrix, pheno=phenotype, traits=traits, covariates_string=covars,
                        outcome_type="continuous")

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