lm_count_mat: Fast linear regression

View source: R/lm_count_mat.R

lm_count_matR Documentation

Fast linear regression

Description

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

Usage

lm_count_mat(
  count_matrix,
  pheno,
  trait,
  covariates_string,
  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, 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)"

gene_IDs

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)

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

Examples

library(dplyr)
data(rnaseq_count_matrix)
rnaseq_count_matrix<- rnaseq_count_matrix[rowSums(rnaseq_count_matrix)>0,]
data(phenotype)
trait<-"Trait.1"
covars<-"Age+Sex"
log_transform<-"log_replace_half_min"
lm_count_mat(count_matrix=rnaseq_count_matrix,pheno=phenotype,trait=trait,
             covariates_string=covars, log_transform=log_transform)

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