mult_lm_count_mat: Fast linear regression for multiple exposure

View source: R/mult_lm_count_mat.R

mult_lm_count_matR Documentation

Fast linear regression for multiple exposure

Description

Calculated associtation gene counts matrix with the pehonotype where each of gene counts on multiple traits

Usage

mult_lm_count_mat(
  count_matrix,
  pheno,
  covariates_string,
  traits,
  gene_IDs = NULL,
  log_transform = "log_replace_half_min"
)

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.

covariates_string

A character string with specifying the covariates, include "as.factor" statements. example: covariates_string = "age + as.factor(sex)"

traits

Characters, the name of the exposure variables. The traits should columns in pheno.

gene_IDs

A vector of selection of gene IDs, 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)

Value

Linear regression results as a data frame with columns geneID, adjLogFC.Trait.1,adjLogFC.Trait.2 ,se,chisq_stat,chisq_stat_df,p_value(join p-value),fdr_bh

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"
mult_lm_count_mat(count_matrix=rnaseq_count_matrix,pheno = phenotype,traits = traits,
                  covariates_string=covars)

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