rnbtn_model_agg_parallel: rnbtn_model_agg_parallel aggregates the regularized nested...

View source: R/rnbtn_model_agg_parallel.R

rnbtn_model_agg_parallelR Documentation

rnbtn_model_agg_parallel aggregates the regularized nested negative binomial model results for all genes in a parallel fashion.

Description

rnbtn_model_agg_parallel aggregates the regularized nested negative binomial model results for all genes in a parallel fashion.

Usage

rnbtn_model_agg_parallel(
  df,
  formula = formula,
  locus_tag = locus_tag,
  fctrel = NONE,
  iter = 5,
  a = 0,
  cores = 10,
  ctype = "PSOCK"
)

Arguments

df

: Dataframe containing counts,covariates in the long format

formula

: Provide model matrix formula using as.formula()

locus_tag

: Column corresponding to gene names/locus tags .Ex: "gene"

fctrel

: A list of column names and desired factor relevels .

a

: elastic net mixing parameter . Default is zero

cores

The number of cores to run in parallel

ctype

: Socket type for parallel operation. "PSOCK" runs both on windows and linux. "FORK" runs only on linux but is much faster

iter:

Number of times to run cross validation to take the mean error associated with each lambda value, and then choose lambda. Default is 5.iter increases your run time

Examples

#Simulating and selecting Counts
TC_df <- rnbtn_simulate_data(n_strain=3,n_condition=4,n_slevel=3,n_rep=2)[[1]]
#Selecting only first twenty locus tags as an  example
locuslist <- TC_df$locus_tag[1:20]
TC_20_df <- subset(TC_df, locus_tag %in% locuslist)
#Preparing covariate desired levels for fct_relevel
fct_rel <- list(strain=c("strain_1","strain_2","strain_3"),
condition=c("condition_1","condition_2","condition_3","condition_4"),
slevel=c("slevel_1","slevel_2","slevel_3"))
#Model nested formula
formula <- as.formula(tncnt ~ strain/condition/slevel)
#Run and aggregrate model results in parallel fashion
rnbtn_model_agg_parallel(TC_20_df,formula = formula,
locus_tag = "locus_tag",fctrel = fct_rel,
iter =2, a=0, cores=2,ctype= "PSOCK")

vsarsani/rnbtn documentation built on May 13, 2022, 1:45 p.m.