simEachGeneration: Simulate a multigeneration methylation experiment with...

Description Usage Arguments Value Author(s) Examples

View source: R/methylInheritanceSimInternalMethods.R

Description

Simulate a multigeneration methylation case versus control experiment with inheritance relation using a real control dataset.

The simulation can be parametrized to fit different models. The number of cases and controls, the proportion of the case affected by the treatment (penetrance), the effect of the treatment on the mean of the distribution, the proportion of sites inherited, the proportion of the differentially methylated sites from the precedent generation inherited, etc..

The function simulates a multigeneration dataset like a bisulfite sequencing experiment. The simulation includes the information about control and case for each generation.

Usage

1
2
3
simEachGeneration(simulation, nbCtrl, nbCase, treatment, sample.id, generation,
  stateInfo, minReads, maxPercReads, context, assembly, meanCov, saveGRanges,
  saveMethylKit, runAnalysis)

Arguments

nbCtrl

a positive integer, the number of controls.

nbCase

a positive integer, the number of cases.

treatment

a numeric vector denoting controls and cases

sample.id

a matrix the name of each samples for each generation (row) and each case and control (column).

generation

a positive integer, the number of generations simulated.

stateInfo

a GRanges that contains the CpG (or methylated sites). The GRanges have four metadata from the real dataset:

  • chrOri a numeric, the chromosome from the real dataset

  • startOri a numeric, the position of the site in the real dataset

  • meanCTRL a numeric, the mean of the control in the real dataset

  • varCTRL a numeric, the variance of the control in the real dataset.

minReads

a positive integer, sites and regions having lower coverage than this count are discarded. The parameter corresponds to the lo.count parameter in the methylKit package.

maxPercReads

a double between [0,100], the percentile of read counts that is going to be used as upper cutoff. Sites and regions having higher coverage than maxPercReads are discarded. This parameter is used for both CpG sites and tiles analysis. The parameter correspond to the hi.perc parameter in the methylKit package.

context

a string of character, the short description of the methylation context, such as "CpG", "CpH", "CHH", etc..

assembly

a string of character, the short description of the genome assembly, such as "mm9", "hg18", etc..

meanCov

a positive integer, the mean of the coverage at the simulated CpG sites.

saveGRanges

a logical, when true, the package save two files type. The first generate for each simulation contains a list. The length of the list corresponds to the number of generation. The generation are stored in order (first entry = first generation, second entry = second generation, etc..). All samples related to one generations are contained in a GRangesList. The GRangeaList store a list of GRanges. Each GRanges stores the raw mehylation data of one sample. The second file a numeric vector denoting controls and cases (a file is generates by entry in the vector parameters vNbSample).

saveMethylKit

a logical, when TRUE, the package save a file contains a list. The length of the list corresponds to the number of generation. The generation are stored in order (first entry = first generation, second entry = second generation, etc..). All samples related to one generations are contained in a S4 methylRawList object. The methylRawList object contains two Slots: 1. treatment: A numeric vector denoting controls and cases. 2. .Data: A list of methylRaw objects. Each object stores the raw methylation data of one sample.

runAnalysis

a logical, if TRUE, two files are saved :

  • 1. The first file is the methylObj... file formated with the methylkit package in a S4 methylBase object (with the methylKit functions: filterByCoverage, normalizeCoverage and unite).

  • 2. The second file contains a S4 calculateDiffMeth object generated with the methylKit functions calculateDiffMeth using the first file.

Value

0 indicating that the function has been successful.

Author(s)

Pascal Belleau, Astrid Deschenes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Load dataset
data("samplesForChrSynthetic")
data("dataSimExample")

## Generate a stateInfo object using samples
stateInformation <- methInheritSim:::getSyntheticChr(methInfo = 
    samplesForChrSynthetic, nbBlock = 1, nbCpG = 3)

## Generate a stateDiff and stateInherite objects with length corresponding 
## to nbBlock * nbCpG from stateInformation
stateDiff  <- c(1, 0, 1)
stateInherite <- c(1, 0, 0)

## Create simulation
sim <- methInheritSim:::getSim(nbCtrl = 3, nbCase = 2, 
    generation = 3, stateInfo = stateInformation, stateDiff = stateDiff, 
    stateInherite = stateInherite, diffValue = 10, 
    propDiff = 0.8, propDiffsd = 0.2, propInheritance = 0.8, 
    propHetero = 0.1)

## TODO
methInheritSim:::simEachGeneration(simulation = sim, 
nbCtrl = 3, nbCase = 2, treatment = c(0,0,0,1,1), 
sample.id = dataSimExample$sample.id,
generation = 3, stateInfo = stateInformation, minReads = 10, 
maxPercReads = 99, context = "Cpg", assembly = "RNOR_5.0", meanCov = 80, 
saveGRanges = FALSE, saveMethylKit = FALSE, runAnalysis = FALSE)

belleau/methInheritSim documentation built on Dec. 4, 2018, 8:01 a.m.