validateRunPermutation {methylInheritance} | R Documentation

## Parameters validation for the `runPermutation` function

### Description

Validation of all parameters needed by the public `runPermutation` function.

### Usage

    validateRunPermutation(methylKitData, type, outputDir, runObservedAnalysis,
      nbrPermutations, nbrCores, nbrCoresDiffMeth, minReads, minMethDiff,
      qvalue, maxPercReads, destrand, minCovBasesForTiles, tileSize, stepSize,
      vSeed, restartCalculation, saveInfoByGeneration)

### Arguments

`methylKitData` | a `list` of `methylRawList` entries or the name of the RDS file containing the `list`. Each `methylRawList` entry must contain all the `methylRaw` entries related to one generation (first entry = first generation, second entry = second generation, etc..). The number of generations must correspond to the number of entries in the `methylKitData`. At least 2 generations must be present to do a permutation analysis. More information can be found in the methylKit package.
`type` | One of the "sites","tiles" or "both" strings. Specifies the type of differentially methylated elements should be returned. For retrieving differentially methylated bases type="sites"; for differentially methylated regions type="tiles". Default: "both".
`outputDir` | a string, the name of the directory that will contain the results of the permutation. If the directory does not exist, it will be created.
`runObservedAnalysis` | a `logical`, when `runObservedAnalysis` = `TRUE`, a CpG analysis on the observed dataset is done.
`nbrPermutations,` | a positive `integer`, the total number of permutations that is going to be done.
`nbrCores` | a positive `integer`, the number of cores to use when processing the analysis.
`nbrCoresDiffMeth` | a positive `integer`, the number of cores to use for parallel differential methylation calculations.Parameter used for both sites and tiles analysis. The parameter corresponds to the `num.cores` parameter in the `methylKit` package.
`minReads` | a positive `integer` Bases and regions having lower coverage than this count are discarded. The parameter corresponds to the `lo.count` parameter in the `methylKit` package.
`minMethDiff` | a positive `double` betwwen [0,100], the absolute value of methylation percentage change between cases and controls. The parameter corresponds to the `difference` parameter in the `methylKit` package.
`qvalue` | a positive `double` betwwen [0,1], the cutoff for qvalue of differential methylation statistic. TODO
`maxPercReads` | a `double` between [0,100], the percentile of read counts that is going to be used as upper cutoff. Bases ore regions having higher coverage than this percentile are discarded. Parameter used for both CpG sites and tiles analysis. The parameter correspond to the `hi.perc` parameter in the `methylKit` package.
`destrand` | a `logical`, when `TRUE` will merge reads on both strands of a CpG dinucleotide to provide better coverage. Only advised when looking at CpG methylation. Parameter used for both CpG sites and tiles analysis.
`minCovBasesForTiles` | a non-negative `integer`, the minimum number of bases to be covered in a given tiling window. The parameter corresponds to the `cov.bases` parameter in the package `methylKit`. Only used when `doingTiles` = `TRUE`. Default: `0`.
`tileSize` | a positive `integer`, the size of the tiling window. The parameter corresponds to the `win.size` parameter in the `methylKit` package. Only used when `doingTiles` = `TRUE`.
`stepSize` | a positive `integer`, the step size of tiling windows. The parameter corresponds to the `stepSize` parameter in the `methylKit` package. Only used when `doingTiles` = `TRUE`.
`vSeed` | a `integer`, a seed used when reproducible results are needed. When a value inferior or equal to zero is given, a random integer is used.
`restartCalculation` | a `logical`, when `TRUE`, only permutations that don't have an associated RDS result file are run. Useful to restart a permutation analysis that has been interrupted.
`saveInfoByGeneration` | a `logical`, when `TRUE`, the information about differentially methylated sites and tiles for each generation is saved in a RDS file. The information is saved in a different file for each permutation. The files are only saved when the `outputDir` is not `NULL`.

### Value

`0` indicating that all parameters validations have been successful.

### Author(s)

Astrid Deschenes

### Examples

    ## Load dataset
    data(samplesForTransgenerationalAnalysis)

    ## The function returns 0 when all paramaters are valid
    methylInheritance:::validateRunPermutation(
        methylKitData = samplesForTransgenerationalAnalysis, type = "sites",
        outputDir = "test", runObservedAnalysis = TRUE,
        nbrPermutations = 10000, nbrCores = 1,
        nbrCoresDiffMeth = 1, minReads = 10, minMethDiff = 25, qvalue = 0.01,
        maxPercReads = 99.9, destrand = TRUE, minCovBasesForTiles = 10,
        tileSize = 1000, stepSize = 500, vSeed = 12, restartCalculation = FALSE,
        saveInfoByGeneration = FALSE)

    ## The function raises an error when at least one paramater is not valid
    ## Not run: methylInheritance:::validateRunPermutation(
        methylKitData = "HI", type = "tiles", outputDir = "test",
        runObservedAnalysis = FALSE, nbrPermutations = 10000, nbrCores = 1,
        nbrCoresDiffMeth = 1, minReads = 10, minMethDiff = 25, qvalue = 0.01,
        maxPercReads = 99.9, destrand = TRUE, minCovBasesForTiles = 10,
        tileSize = 1000, stepSize = 500, vSeed = 12, restartCalculation = FALSE,
        saveInfoByGeneration = FALSE)
    ## End(Not run)

[Package methylInheritance version 1.11.0 Index]