View source: R/permutation_lm_count_mat.R
lm_count_mat_perm_pval | R Documentation |
The function is to calculate DEG (Differential Expression Genes) analysis for selected genes using multiple residual permuation results as outcome to calucate permutation p-value
lm_count_mat_perm_pval(
count_matrix,
pheno,
trait,
covariates_string,
n_permute = 1e+05,
gene_IDs = NULL,
log_transform = "log_replace_half_min",
seed = NULL,
outcome_type = "continuous"
)
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 |
A character string with specifying the covariats, include "as.factor" statements. example: covariate_string = "Age+as.factor(Sex)" |
n_permute |
Number of permutation. Default is 100000 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 |
Linear regression results as a data frame with columns GeneID, beta,se,t_stat (t-statistic), t_stat_df(degree of freedom),p_value, perm_pval
library(dplyr)
data(rnaseq_count_matrix)
data(phenotype)
rnaseq_count_matrix<- rnaseq_count_matrix[rowSums(rnaseq_count_matrix)>0,]
genes<-c("ENSG00000000003","ENSG00000000005","ENSG00000000419","ENSG00000000457","ENSG00000000460")
covariates_string<-"Age+Sex"
trait<-"Trait.1"
lm_count_mat_perm_pval(count_matrix=rnaseq_count_matrix, pheno=phenotype,
trait=trait, covariates_string= covariates_string,
gene_IDs=genes,n_permute=1000,
log_transform = "log_replace_half_min",
seed = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.