Moanin is a class that extends SummarizedExperiment and is used to store the additional spline basis and meta data for timecourse analysis.

In addition to the slots of the SummarizedExperiment class, the Moanin object has the additional slots described in the Slots section.

There are several methods implemented for this class. The most important methods have their own help page. Simple helper methods are described in the Methods section below. For a comprehensive list of methods specific to this class see the Reference Manual.

The constructor create_moanin_model creates an object of the class Moanin.

# S4 method for DataFrame
create_moanin_model(data, meta, ...)

# S4 method for data.frame
create_moanin_model(data, ...)

# S4 method for matrix
create_moanin_model(data, meta, ...)

# S4 method for SummarizedExperiment
create_moanin_model(
  data,
  spline_formula = NULL,
  basis_matrix = NULL,
  group_variable_name = "Group",
  time_variable_name = "Timepoint",
  degrees_of_freedom = NULL,
  log_transform = FALSE,
  drop_levels = TRUE
)

Arguments

data

The input data. Can be a SummarizedExperiment class, or matrix/data.frame. If the input data is a matrix or data.frame, then the user must also provide input to the meta argument, which will be transformed into colData of the resulting Moanin object

meta

Meta data on the samples (columns) of the data argument. Must be given f input data is a matrix or data.frame. If input is SummarizedExperiment, this argument is ignored.

...

arguments passed from methods to the SummarizedExperiment method.

spline_formula

formula object, optional, default: NUlL. Used to construct splines from the data in meta. See details.

basis_matrix

matrix, optional, default: NULL. A basis matrix, where each row corresponds to the evaluation of a sample on the basis function (thus one column for each basis function).

group_variable_name

A character value giving the column that corresponds to the grouping variable to test for DE. By default "Group"

time_variable_name

A character value giving the column that corresponds to the time variable. By default "Timepoint".

degrees_of_freedom

int, optional. Number of degrees of freedom to use if neither the basis_matrix nor the spline_formula is provided. If not provided by the user, internally will be set to 4

log_transform

whether the data should be log-transformed by certain methods (see splines_kmeans)

drop_levels

Logical, whether to perform droplevels on the grouping variable (i.e. remove empty levels)

Value

An object of class Moanin

Details

If neither spline_formula nor basis_matrix is given, then by default, the function will create a basis matrix based on the formula:

spline_formula = ~Group:ns(Timepoint, df=4) + Group +
 0

Note that the meta data will have levels dropped (via droplevels).

Input to data that is given as a class DataFrame or data.frame will be converted to class matrix. The reason for this is that use of a data.frame creates errors in taking duplicate rows/columns of SummarizedExperiment, as in bootstrapping. Users who absolutely want the object to hold a object that is not a matrix can construct a SummarizedExperiment object (which will not convert the input into a matrix), and use this as input to create_moanin_model.

Slots

time_variable_name

character value giving the column in colData that defines the time variable (must be of class numeric)

group_variable_name

character value giving the column in colData that defines the grouping variable (must be of class factor)

basis_matrix

A basis matrix, where each row corresponds to the evaluation of a sample on the basis function (thus one column for each basis function).

spline_formula

a formula. The formula used in creating the basis matrix

degrees_of_freedom

a numeric integer. Number of degrees of freedom used in creating basis matrix. If NULL, degrees of freedom is not known (usually if user provided basis without degrees of freedom)

log_transform

logical, whether to log-transform the data for certain methods

Examples

# Load some data data(exampleData) # Use the default options moanin = create_moanin_model(data=testData,meta=testMeta) moanin
#> Moanin object on 126 samples containing the following information: #> Group variable given by 'Group' with the following levels: #> C K M #> 42 42 42 #> Time variable given by 'Timepoint' #> Basis matrix with 15 basis_matrix functions #> Basis matrix was constructed with the following spline_formula #> ~Group + Group:splines::ns(Timepoint, df = 4) + 0 #> #> Information about the data (a SummarizedExperiment object): #> class: SummarizedExperiment #> dim: 500 126 #> metadata(0): #> assays(1): '' #> rownames(500): NM_009912 NM_008725 ... NM_001163774 NM_026944 #> rowData names(0): #> colnames(126): GSM1557140 GSM1557141 ... GSM1557264 GSM1557265 #> colData names(5): '' Group Replicate Timepoint WeeklyGroup
# Change the number of degrees of freedom moanin = create_moanin_model(data=testData,meta=testMeta, degrees_of_freedom=6) moanin
#> Moanin object on 126 samples containing the following information: #> Group variable given by 'Group' with the following levels: #> C K M #> 42 42 42 #> Time variable given by 'Timepoint' #> Basis matrix with 21 basis_matrix functions #> Basis matrix was constructed with the following spline_formula #> ~Group + Group:splines::ns(Timepoint, df = 6) + 0 #> #> Information about the data (a SummarizedExperiment object): #> class: SummarizedExperiment #> dim: 500 126 #> metadata(0): #> assays(1): '' #> rownames(500): NM_009912 NM_008725 ... NM_001163774 NM_026944 #> rowData names(0): #> colnames(126): GSM1557140 GSM1557141 ... GSM1557264 GSM1557265 #> colData names(5): '' Group Replicate Timepoint WeeklyGroup