mixedcirc_detect: Perform differential circadian rhythm analysis using mixed...

View source: R/mixedcirc_detect.R

mixedcirc_detectR Documentation

Perform differential circadian rhythm analysis using mixed models

Description

This functions performs differential circadian rhythm analysis using mixed models.

Usage

mixedcirc_detect(
  data_input = NULL,
  time = NULL,
  group = NULL,
  id = NULL,
  period = 24,
  lm_method = c("lm", "lme")[2],
  f_test = c("multcomp_f", "multcomp_chi", "Satterthwaite", "Kenward-Roger")[3],
  abs_phase = TRUE,
  obs_weights = NULL,
  RRBS = FALSE,
  replicate_id = NULL,
  separate_tests = TRUE,
  force_weight_estimation = FALSE,
  ncores = 1,
  verbose = FALSE,
  ...
)

Arguments

data_input

A numerical matrix or data.frame (N*P) or DGEList where in the rows are samples (N) and the columns are variables (P). If DGEList is provided, regression weights will be estimated!

time

A vector of length N, showing circadian time of each sample

group

A character vector of length N. If performing differential circadian rhythm analysis, group is a factor, showing grouping of the samples. Analysis of two groups is supported at this stage! See details!

id

A vector of length N showing identity of each *unique* sample. See details

period

Period of circadian rhythm. Default: 24

lm_method

The regression method to use. At this stage, 'lm' and 'lme' are supported! If lm is selected, normal regression will be performed. Default: "lme"

f_test

Type of f-test for calculating p-value of the rhythm. Possible values are "multcomp_f","multcomp_chi","Satterthwaite", "Kenward-Roger". Default: Satterthwaite

abs_phase

Whether to return absolute phase or not. Default: TRUE

obs_weights

Regression weights. Default: NULL. See details

RRBS

If 'TRUE', the data is assumed to be RRBS methylation data. if TRUE, obs_weights must be set. Default FALSE

replicate_id

If 'RRBS' is set to 'TRUE', This has to be a factor showing identity of each unique replicate.

separate_tests

If TRUE (defualt), separate models will be fit for each group to estimate rhythmicity otherwise, groupwise rhythmicity will be based on the a global model.

force_weight_estimation

If TRUE, variance-mean trend weight estimation will be performed regardless of the data input type

ncores

number of cores

verbose

Show information about different stages of the processes. Default FALSE

...

additionl arguments to the regression function

Details

For each variable we use the following mode: In this part we do rhythmicity analysis on individual variables using the following model: measure ~0 + group + group:in + group:out Where 'in' is defined as cos(2 * pi * time / period) and 'out' as sin(2 * pi * time / period). The global inference is tested on group:in == 0 or group:out == 0 The between group difference is tested as differences between in and out across different groups. No p-value adjustment is performed!

'obs_weights' is a matrix of size N*P where each colum shows the weights for all the observations for that particular variable.

If 'RRBS' is set to 'TRUE', we assume that the data is RRBS methylation. In this case, the regression will be change to suit this type of analysis. In BS-seq methylation analysis, each DNA sample generates two counts, a count of methylated reads and a count of unmethylated reads, for each genomic locus for each sample. The samples are assumed to be ordered as methylated and then unmethylated. For example, given the samples are A1_1, A1_2,A2_1, and B1_1. The rows in 'data_input' are assumed to be ordered as A1_1_methylated,A1_1_unmethylated, A1_2_methylated,A1_2_unmethylated,A2_1_methylated,A2_1_unmethylated,B1_1_methylated,B1_1_unmethylated. In this setting, 'replicate_id' must show the unique identify of each replicate (in contrast to unique biological sample). This means for example above, 'replicate_id' would be A1_1,A1_2,A2_1,B1_1. Please note that if 'RRBS' is set to 'TRUE', 'obs_weights' must be set. We provide a starting function to estimate these weights (mixedcirc_rrbs_voom) for class of 'methylBaseDB' from 'methylKit' package. Alternatively, one can use 'voomWithDreamWeights' with correct formula.

Value

A class of mixedcirc_fit_list.

Examples

data("circa_data")

results<-mixedcirc_detect(data_input = circa_data$data_matrix,
time = circa_data$time,group = circa_data$group,id = circa_data$id,period = 24,verbose = TRUE)


PayamEmami/mixedcirc documentation built on Jan. 15, 2025, 5:36 p.m.