AnaCoDa (version 0.1.0)

initializeParameterObject: Initialize Parameter

Description

initializeParameterObject initializes a new parameter object or reconstructs one from a restart file

Usage

initializeParameterObject(genome = NULL, sphi = NULL, num.mixtures = 1,
  gene.assignment = NULL, initial.expression.values = NULL, model = "ROC",
  split.serine = TRUE, mixture.definition = "allUnique",
  mixture.definition.matrix = NULL, init.with.restart.file = NULL,
  mutation.prior.sd = 0.35, init.csp.variance = 0.0025,
  init.sepsilon = 0.1)

Arguments

genome

An object of type Genome necessary for the initialization of the Parameter object. The default value is NULL.

sphi

Initial values for sphi. Expected is a vector of length numMixtures. The default value is NULL.

num.mixtures

The number of mixtures elements for the underlying mixture distribution (numMixtures > 0). The default value is 1.

gene.assignment

A vector holding the initial mixture assignment for each gene. The vector length has to equal the number of genes in the genome. Valid values for the vector range from 1 to numMixtures. It is possible but not advised to leave a mixture element empty. The default Value is NULL.

initial.expression.values

(Optional) A vector with intial phi values. The length of the vector has to equal the number of genes in the Genome object. The default value is NULL.

model

Specifies the model used. Valid options are "ROC", "PA", "PANSE", or "FONSE". The default model is "ROC". ROC is described in Gilchrist et al. 2015. PA, PANSE and FONSE are currently unpublished.

split.serine

Whether serine should be considered as one or two amino acids when running the model. TRUE and FALSE are the only valid values. The default value for split.serine is TRUE.

mixture.definition

A string describing how each mixture should be treated with respect to mutation and selection. Valid values consist of "allUnique", "mutationShared", and "selectionShared". The default value for mixture.definition is "allUnique". See details for more information.

mixture.definition.matrix

A matrix representation of how the mutation and selection categories correspond to the mixtures. The default value for mixture.definition.matrix is NULL. If provided, the model will use the matrix to initialize the mutation and selection categories instead of the definition listed directly above. See details for more information.

init.with.restart.file

File name containing information to reinitialize a previous Parameter object. If given, all other arguments will be ignored. The default value for init.with.restart.file is NULL.

mutation.prior.sd

Controlling the standard deviation of the normal prior on the mutation parameters

init.csp.variance

specifies the initial proposal width for codon specific parameter (default is 0.0025). The proposal width adapts during the runtime to reach a taget acceptance rate of ~0.25

init.sepsilon

specifies the initial value for sepsilon. default is 0.1

Value

parameter Returns an initialized Parameter object.

Details

initializeParameterObject checks the values of the arguments given to insure the values are valid.

The mixture definition and mixture definition matrix describes how the mutation and selection categories are set up with respect to the number of mixtures. For example, if mixture.definition = "allUnique" and numMixtures = 3, a matrix representation would be matrix(c(1,2,3,1,2,3), ncol=2) where each row represents a mixture, the first column represents the mutation category, and the second column represents the selection category. Another example would be mixture.definition = "selectionShared" and numMixtures = 4 ( matrix(c(1,2,3,4,1,1,1,1), ncol=2)). In this case, the selection category is the same for every mixture. If a matrix is given, and it is valid, then the mutation/selection relationship will be defined by the given matrix and the keyword will be ignored. A matrix should only be given in cases where the keywords would not create the desired matrix.

Examples

Run this code
# NOT RUN {
genome_file <- system.file("extdata", "genome.fasta", package = "AnaCoDa")
restart_file <- system.file("extdata", "restart_file.rst", package = "AnaCoDa")

genome <- initializeGenomeObject(file = genome_file)

## initialize a new parameter object
sphi_init <- 1
numMixtures <- 1
geneAssignment <- rep(1, length(genome))
parameter <- initializeParameterObject(genome = genome, sphi = sphi_init, 
                                       num.mixtures = numMixtures, 
                                       gene.assignment = geneAssignment, 
                                       mixture.definition = "allUnique")

## re-initialize a parameter object from a restart file. Useful for checkpointing
parameter <- initializeParameterObject(init.with.restart.file = restart_file)

## initialize a parameter object with a custon mixture definition matrix
def.matrix <- matrix(c(1,1,1,2), ncol=2)
geneAssignment <- sample(1:2, length(genome), replace = TRUE) # random assignment to mixtures
parameter <- initializeParameterObject(genome = genome, sphi = c(0.5, 2), num.mixtures = 2,
                                       gene.assignment = geneAssignment,
                                       mixture.definition.matrix = def.matrix)

# }

Run the code above in your browser using DataCamp Workspace