Learn R Programming

MethEvolSIM (version 0.2.1)

treeMultiRegionSimulator: treeMultiRegionSimulator

Description

an R6 class representing the methylation state of GpGs in different genomic structures in the nodes of a tree.

The whole CpG sequence is an object of class combiStructureGenerator. Each genomic structure in it is contained in an object of class singleStructureGenerator.

Arguments

Public fields

testing_output

Public attribute: Testing output for initialize

Branch

Public attribute: List containing objects of class combiStructureGenerator

branchLength

Public attribute: Vector with the corresponding branch lengths of each $Branch element

Methods


Method treeEvol()

Simulate CpG dinucleotide methylation state evolution along a tree. The function splits a given tree and simulates evolution along its branches. It recursively simulates evolution in all of the subtrees in the given tree until the tree leafs

Usage

treeMultiRegionSimulator$treeEvol(
  Tree,
  dt = 0.01,
  parent_index = 1,
  testing = FALSE
)

Arguments

Tree

String. Tree in Newick format. When called recursivelly it is given the corresponding subtree.

dt

Length of SSE time steps.

parent_index

Default 1. When called recursivelly it is given the corresponding parent branch index.

testing

Default FALSE. TRUE for testing purposes.

Returns

NULL


Method new()

Create a new treeMultiRegionSimulator object. $Branch is a list for the tree branches, its first element represents the tree root.

Note that one of either infoStr or rootData needs to be given. Not both, not neither.

Usage

treeMultiRegionSimulator$new(
  infoStr = NULL,
  rootData = NULL,
  tree = NULL,
  params = NULL,
  dt = 0.01,
  CFTP = FALSE,
  CFTP_step_limit = 327680000,
  testing = FALSE
)

Arguments

infoStr

A data frame containing columns 'n' for the number of sites, and 'globalState' for the favoured global methylation state. If initial equilibrium frequencies are given the dataframe must contain 3 additional columns: 'u_eqFreq', 'p_eqFreq' and 'm_eqFreq'

rootData

combiStructureGenerator object. When given, the simulation uses its parameter values.

tree

tree

params

Default NULL. When given: data frame containing model parameters. Note that if rootData is not null, its parameter values are used.

dt

length of the dt time steps for the SSE evolutionary process

CFTP

Default FALSE. TRUE for calling cftp algorithm to set root state according to model equilibrium (Note that current implementation neglects IWE process).

CFTP_step_limit

when CFTP = TRUE, maximum number of steps before applying an approximation method (default 327680000 corresponding to size of CFTP info of approx 6.1 GB).

testing

Default FALSE. TRUE for testing output.

Returns

A new treeMultiRegionSimulator object.


Method clone()

The objects of this class are cloneable with this method.

Usage

treeMultiRegionSimulator$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.