combiStructureGenerator {MethEvolSIM} | R Documentation |
combiStructureGenerator
Description
an R6 class representing several genomic structures. Each genomic structure contained is an object of class singleStructureGenerator. Note that default clone(deep=TRUE) fails to clone singleStructureGenerator objects contained, use method $copy() instead.
Public fields
testing_output
Public attribute: Testing output for initialize
Methods
Public methods
Method new()
Create a new combiStructureGenerator object.
Note that this object can be generated within a treeMultiRegionSimulator object.
Usage
combiStructureGenerator$new(infoStr, params = NULL, 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'
params
Default NULL. When given: data frame containing model parameters.
testing
Default FALSE. TRUE for writing in public field of new instance $testing_output
Returns
A new combiStructureGenerator
object.
Method get_singleStr()
Public method: Get one singleStructureGenerator object in $singleStr
Usage
combiStructureGenerator$get_singleStr(i)
Arguments
i
index of the singleStructureGenerator object in $singleStr
Returns
the singleStructureGenerator object in $singleStr with index i
Method get_singleStr_number()
Public method: Get number of singleStructureGenerator objects in $singleStr
Usage
combiStructureGenerator$get_singleStr_number()
Returns
number of singleStructureGenerator object contained in $singleStr
Method get_singleStr_siteNumber()
Public method: Get number of sites in all singleStructureGenerator objects
Usage
combiStructureGenerator$get_singleStr_siteNumber()
Returns
number of sites in all singleStructureGenerator objects
Method get_island_number()
Public method: Get number of singleStructureGenerator objects in $singleStr with $globalState "U" (CpG islands)
Usage
combiStructureGenerator$get_island_number()
Returns
number of singleStructureGenerator in $singleStr objects with $globalState "U" (CpG islands)
Method get_island_index()
Public method: Get index of singleStructureGenerator objects in $singleStr with $globalState "U" (CpG islands)
Usage
combiStructureGenerator$get_island_index()
Returns
index of singleStructureGenerator objects in $singleStr with $globalState "U" (CpG islands)
Method set_IWE_events()
Public method: Set information of the IWE events sampled in a tree branch
Usage
combiStructureGenerator$set_IWE_events(a)
Arguments
a
value to which IWE_events should be set
Returns
NULL
Method get_IWE_events()
Public method: Get information of the IWE events sampled in a tree branch
Usage
combiStructureGenerator$get_IWE_events()
Returns
information of the IWE events sampled in a tree branch
Method set_name()
Public method: Set the name of the leaf if evolutionary process (simulated from class treeMultiRegionSimulator) ends in a tree leaf.
Usage
combiStructureGenerator$set_name(a)
Arguments
a
value to which name should be set
Returns
NULL
Method get_name()
Public method: Get the name of the leaf if evolutionary process (simulated from class treeMultiRegionSimulator) ended in a tree leaf.
Usage
combiStructureGenerator$get_name()
Returns
Name of the leaf if evolutionary process (simulated from class treeMultiRegionSimulator) ended in a tree leaf. For iner tree nodes return NULL
Method get_own_index()
Public method: Set own branch index in the tree along which the evolutionary process is simulated (from class treeMultiRegionSimulator).
Usage
combiStructureGenerator$get_own_index()
Returns
NULL
Method set_own_index()
Public method: Get own branch index in the tree along which the evolutionary process is simulated (from class treeMultiRegionSimulator).
Usage
combiStructureGenerator$set_own_index(i)
Arguments
i
index of focal object
Returns
Own branch index in the tree along which the evolutionary process is simulated (from class treeMultiRegionSimulator).
Method get_parent_index()
Public method: Get parent branch index in the tree along which the evolutionary process is simulated (from class treeMultiRegionSimulator).
Usage
combiStructureGenerator$get_parent_index()
Returns
Parent branch index in the tree along which the evolutionary process is simulated (from class treeMultiRegionSimulator).
Method set_parent_index()
Public method: Set parent branch index in the tree along which the evolutionary process is simulated (from class treeMultiRegionSimulator).
Usage
combiStructureGenerator$set_parent_index(i)
Arguments
i
set parent_index to this value
Returns
NULL
Method get_offspring_index()
Public method: Get offspring branch index in the tree along which the evolutionary process is simulated (from class treeMultiRegionSimulator).
Usage
combiStructureGenerator$get_offspring_index()
Returns
Offspring branch index in the tree along which the evolutionary process is simulated (from class treeMultiRegionSimulator).
Method set_offspring_index()
Public method: Set offspring branch index in the tree along which the evolutionary process is simulated (from class treeMultiRegionSimulator).
Usage
combiStructureGenerator$set_offspring_index(i)
Arguments
i
set offspring_index to this value
Returns
NULL
Method add_offspring_index()
Public method: Add offspring branch index in the tree along which the evolutionary process is simulated (from class treeMultiRegionSimulator).
Usage
combiStructureGenerator$add_offspring_index(i)
Arguments
i
index to be added
Returns
NULL
Method get_mu()
Public method.
Usage
combiStructureGenerator$get_mu()
Returns
Model parameter for the rate of the IWE evolutionary process (per island and branch length).
Method get_id()
Public method. Get the unique ID of the instance
Usage
combiStructureGenerator$get_id()
Returns
A numeric value representing the unique ID of the instance.
Method set_id()
Public method. Set the unique ID of the instance
Usage
combiStructureGenerator$set_id(id)
Arguments
id
integer value to identificate the combiStructure instance
Returns
A numeric value representing the unique ID of the instance.
Method get_sharedCounter()
Public method. Get the counter value from the shared environment between instances of combiStructureGenerator class
Usage
combiStructureGenerator$get_sharedCounter()
Returns
Numeric counter value.
Method reset_sharedCounter()
Public method. Reset the counter value of the shared environment between instances of combiStructureGenerator class
Usage
combiStructureGenerator$reset_sharedCounter()
Returns
NULL
Method set_singleStr()
Public method: Clone each singleStructureGenerator object in $singleStr
Usage
combiStructureGenerator$set_singleStr(singStrList)
Arguments
singStrList
object to be cloned
Returns
NULL
Method copy()
Public method: Clone combiStructureGenerator object and all singleStructureGenerator objects in it
Usage
combiStructureGenerator$copy()
Returns
cloned combiStructureGenerator object
Method branch_evol()
Simulate CpG dinucleotide methylation state evolution along a tree branch. The function samples the IWE events on the tree branch and simulates the evolution through the SSE and IWE processes.
Usage
combiStructureGenerator$branch_evol(branch_length, dt, testing = FALSE)
Arguments
branch_length
Length of the branch.
dt
Length of SSE time steps.
testing
Default FALSE. TRUE for testing purposes.
Details
It handles both cases where IWE events are sampled or not sampled within the branch.
Returns
Default NULL. If testing = TRUE it returns information for testing purposes.
Method get_highest_rate()
Public Method. Gets the highest rate among all singleStructureGenerator objects for CFTP.
Usage
combiStructureGenerator$get_highest_rate()
Returns
Highest rate value.
Method set_CFTP_info()
Public Method. Sets a cftpStepGenerator instance asthe CFTP info.
Usage
combiStructureGenerator$set_CFTP_info(CFTP_instance)
Arguments
CFTP_instance
CFTP info.
Returns
NULL
Method get_CFTP_info()
Public Method. Gets the CFTP info.
Usage
combiStructureGenerator$get_CFTP_info()
Returns
CFTP info.
Method cftp_apply_events()
Public Method. Applies the CFTP events.
Usage
combiStructureGenerator$cftp_apply_events(testing = FALSE)
Arguments
testing
default FALSE. TRUE for testing output
Returns
NULL when testing FALSE. Testing output when testing TRUE.
Method cftp()
Public Method. Applies the CFTP algorithm to evolve a structure and checks for convergence by comparing methylation states.
This method generates CFTP steps until the methylation sequences of the current structure and a cloned structure become identical across all singleStr instances or a step limit is reached. If the step limit is exceeded, an approximation method is applied to finalize the sequence.
Usage
combiStructureGenerator$cftp( steps = 10000, step_limit = 327680000, testing = FALSE )
Arguments
steps
minimum number of steps to apply (default 10000).
step_limit
maximum number of steps before applying an approximation method (default 327680000 corresponding to size of CFTP info of approx 6.1 GB). If this limit is reached, the algorithm stops and an approximation is applied.
testing
logical. If TRUE, returns additional testing output including the current structure, the cloned structure, the counter value, total steps, and the chosen site for the CFTP events. Default is FALSE.
Returns
NULL when testing is FALSE. If testing is TRUE, returns a list with:
-
self
: the current object after applying the CFTP algorithm. -
combi_m
: a deep cloned object with applied CFTP events. -
counter
: the number of iterations performed. -
total_steps
: the number of steps applied by the CFTP algorithm. -
CFTP_chosen_site
: the site selected during the CFTP event application.
Method clone()
The objects of this class are cloneable with this method.
Usage
combiStructureGenerator$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.