saveInterGenerationResults {methylInheritance} | R Documentation

## Save the result of on CpG site or tile analysis on all generations. The anaysis can come from observed or shuffled dataset. Each case is saved with a different extension.

### Description

Save the result of on CpG site or tile analysis on all generations. The results are saved in a RDS file. The anaysis can have been done on the observed or shuffled dataset. Each permutation is saved using its identifiant in the file name.

### Usage

    saveInterGenerationResults(outputDir, permutationID, type = c("sites",
      "tiles"), interGenerationResult)

### Arguments

`outputDir` | a string of `character`, the name of the directory that will contain the results of the permutation. The name should end with a slash. The directory should already exists.
`permutationID` | an `integer`, the identifiant of the permutation. When the `permutationID` = `0`, the results are considered as the observed results and are saved in a file with the "_observed_results.RDS" extension. When the `permutationID` != `0`, the results are considered as permutation results and are saved in a file with the "_permutation_permutationID.RDS" extension.
`type` | One of the `"sites"` or `"tiles"` strings. Specifies the type of differentially methylated elements should be saved. Default: `"sites"`.
`interGenerationResult` | a `list` that corresponds to the output of the `interGeneration` function, the result of on CpG site or tile analysis on all generations.

### Value

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

### Author(s)

Astrid Deschenes, Pascal Belleau

### Examples

    ## Load permutation results on sites

    permutationResultsFile <- system.file("extdata",
        "permutationResultsForSites.RDS", package="methylInheritance")
    permutationResults <- readRDS(permutationResultsFile)

    ## Transform result to GRanges
    resultsGR <- methylInheritance:::getGRangesFromMethylDiff(methDiff =
        permutationResults, pDiff = 10, qvalue = 0.01, type = "hyper")

    ## Extract inter-generationally conserved sites
    interGenerationResult <- methylInheritance:::interGeneration(resultsGR)

    ## Create directories
    dir.create("TEST", showWarnings = TRUE)
    dir.create("TEST/SITES", showWarnings = TRUE)

    ## Save results
    methylInheritance:::saveInterGenerationResults(
        outputDir = "TEST/", permutationID=100, type = "sites",
        interGenerationResult = interGenerationResult)

[Package methylInheritance version 1.11.0 Index]