getDIMPatGenes: Count DMPs at gene-body

getDIMPatGenesR Documentation

Count DMPs at gene-body

Description

The function counts DMPs overlapping with gene-body. In fact, this function also can be used to count DMPs overlapping with any set of regions given in a GRanges object.

Usage

getDIMPatGenes(
  GR,
  GENES,
  type = "within",
  ignore.strand = TRUE,
  only.hypo = FALSE,
  only.hyper = FALSE,
  output = c("list", "GRanges"),
  by.coord = FALSE,
  gene_id_col = NULL,
  gene_name_col = NULL,
  ...
)

## Default S3 method:
getDIMPatGenes(
  GR,
  GENES,
  type = "within",
  ignore.strand = TRUE,
  only.hypo = FALSE,
  only.hyper = FALSE,
  output = NULL,
  by.coord = FALSE,
  gene_id_col = NULL,
  gene_name_col = NULL,
  ...
)

## S3 method for class 'GRanges'
getDIMPatGenes(
  GR,
  GENES,
  type = "within",
  ignore.strand = TRUE,
  only.hypo = FALSE,
  only.hyper = FALSE,
  output = NULL,
  by.coord = FALSE,
  gene_id_col = NULL,
  gene_name_col = NULL,
  ...
)

## S3 method for class 'pDMP'
getDIMPatGenes(
  GR,
  GENES,
  type = "within",
  ignore.strand = TRUE,
  only.hypo = FALSE,
  only.hyper = FALSE,
  output = c("list", "GRanges"),
  by.coord = FALSE,
  gene_id_col = NULL,
  gene_name_col = NULL,
  ...
)

## S3 method for class 'InfDiv'
getDIMPatGenes(
  GR,
  GENES,
  type = "within",
  ignore.strand = TRUE,
  only.hypo = FALSE,
  only.hyper = FALSE,
  output = c("list", "GRanges"),
  by.coord = FALSE,
  gene_id_col = NULL,
  gene_name_col = NULL,
  ...
)

## S3 method for class 'list'
getDIMPatGenes(
  GR,
  GENES,
  type = "within",
  ignore.strand = TRUE,
  only.hypo = FALSE,
  only.hyper = FALSE,
  output = c("list", "GRanges"),
  by.coord = FALSE,
  gene_id_col = NULL,
  gene_name_col = NULL,
  ...
)

Arguments

GR

An objects object from the any of the classes: 'pDMP', 'InfDiv', GRangesList, GRanges or a list of GRanges.

GENES

A GRanges object with gene coordinates and gene IDs. A column named 'gene_id' carrying the gene ids should be included in the metacolumns. If the meta-column named 'gene_id' is not provided, then gene (region) ids will be created using the gene (region) coordinates.

ignore.strand, type

Same as for findOverlaps-methods.

only.hypo, only.hyper

logical(1). Whether to select only hypo-methylated or hyper-methylated cytosine sites.

output

Class of the object to be returned, a "list", or a "GRanges" object.

by.coord

logical(1). If TRUE, then the DMP are count per coordinate and not per gene id.

gene_id_col

Optional. An integer denoting the column from the GENES metacolumn where the gene ids are given.

gene_name_col

Optional. An integer denoting the column from the GENES metacolumn where the gene 'name' are given.

...

optional arguments for findOverlaps-methods. Users must evaluate whether specific setting makes sense on each particular context.

Details

If by.coord == FALSE and "gene_id" is provided in GENES argument, then DMP counts are made per gene-id. Hence, DMPs from different regions with the same gene-id, say e.g. exons, will be pooled in the count as they bear the same id.

Value

A a list GRanges object.

See Also

getDMPatRegions

Examples

## Gene annotation
genes <- GRanges(seqnames = '1',
ranges = IRanges(start = c(3631, 6788, 11649), end = c(5899, 9130, 13714)),
strand = c('+', '-', '-'))
mcols(genes) <- data.frame(gene_id = c('AT1G01010', 'AT1G01020',
'AT1G01030'))

## Get a dataset of potential signals and the estimated cutpoint from the
## package
data(PS, cutpoint)

## The estimated cutpoints are used to discriminate signals from the noise.
## That is, DMPs are selected using the cupoints
DIMPs <- selectDIMP(PS, div.col = 9L, cutpoint = cutpoint$cutpoint)

## Finally DMPs found on genes
DIMR <- getDIMPatGenes(GR = DIMPs$T1, GENES = genes)


genomaths/MethylIT documentation built on Feb. 3, 2024, 1:24 a.m.