MethCPFromStat {MethCP} | R Documentation

## Create a `MethCP` object given the per-cytosine based tests.

### Description

Given the per-cytosine based `p`-values and effect sizes, `MethCPFromStat` create a `MethCP` object for segmentation.

### Usage

    MethCPFromStat(
      data,
      test.name,
      pvals.field = "pvals",
      effect.size.field = "effect.size",
      seqnames.field = c("seqnames", "seqname", "chromosome", "chrom", "chr",
        "chromosome_name", "seqid"),
      pos.field = "pos"
    )

### Arguments

`data` | a data.frame or GPos or GRanges object.
`test.name` | a character string containing the name of the test to be performed per cytosine.
`pvals.field` | A character vector of recognized names for the column (if 'data' is a data.frame) or meta data column (is 'data' is GPos or GRanges object) in 'data' that contains the p-value.
`effect.size.field` | A character vector of recognized names for the column (if 'data' is a data.frame) or meta data column (is 'data' is GPos or GRanges object) in 'data' that contains the effect size.
`seqnames.field` | A character vector of recognized names for the column in 'data' that contains the chromosome name (sequence name) associated with each position. Only the first name in seqnames.field that is found in colnames(data) is used. If no one is found, then an error is raised. This column is only used when 'data' is a data.frame. Otherwise, chromosome name is obtained from GPos or GRanges object.
`pos.field` | A character vector of recognized names for the column in df that contains the position integer associated with each position. Only the first name in pos.field that is found in colnames(data) is used. If no one is found, then an error is raised. This column is only used when 'data' is a data.frame. Otherwise, position is obtained from GPos or GRanges object.

### Value

a `MethCP` object that is not segmented.

### Examples

    # ====== construct using data frame
    data <- data.frame(
        chr = rep("Chr01", 5),
        pos = c(2, 5, 9, 10, 18),
        effect.size = c(1,-1, NA, 9, Inf),
        pvals = c(0, 0.1, 0.9, NA, 0.02))
    obj <- MethCPFromStat(
        data, test.name="myTest",
        pvals.field = "pvals",
        effect.size.field="effect.size",
        seqnames.field="chr",
        pos.field="pos"
    )
    # ====== construct using GRanges
    library(GenomicRanges)
    data <- GRanges(
        "Chr01", IRanges(c(2, 5, 9, 10, 18), c(2, 5, 9, 10, 18)),
        pvals=c(0, 0.1, 0.9, NA, 0.02), effect.size = c(1,-1, NA, 9, Inf))
    obj <- MethCPFromStat(
        data, test.name="myTest",
        pvals.field = "pvals",
        effect.size.field="effect.size"
    )

[Package MethCP version 1.4.0 Index]