featureEnrich {RLSeq} | R Documentation

## Test Genomic Feature Enrichment

### Description

Tests the enrichment of genomic features in supplied peaks. See details.

### Usage

    featureEnrich(
      object,
      annotype = c("primary", "full"),
      annotations = NULL,
      downsample = 10000,
      quiet = FALSE
    )

### Arguments

`object` | An RLRanges object.
`annotype` | The type of annotations to use. Can be one of "primary" or "full". Default: "primary". See RLHub::annotations for greater detail.
`annotations` | A custom annotation list of the same structure described in RLHub::annotations.
`downsample` | If a numeric, data will be down sampled to the requested number of peaks. This improves the speed of genomic shuffling and helps prevent p-value inflation. If FALSE, then downsampling will not be performed. Default: 10000.
`quiet` | If TRUE, messages will be suppressed. Default: FALSE

### Details

#### Method

Annotations relevant to R-loops were curated as part of the RLBase-data workflow and are provided via RLHub::annotations.

In `featureEnrich`, each annotation "type" (e.g., "Exons", "Introns", etc) is compared to the supplied RLRanges, yielding enrichment statistics with the following procedure:

1. For each annotation type, the peaks are overlapped with the annotations.

2. Then, valr::bed_reldist is used to find the relative distance distribution between the peaks and the annotations for both the supplied RLRanges and shuffled RLRanges (via valr::bed_shuffle). Significance of the relative distance is calculated via stats::ks.test.

3. Then, Fisher’s exact test is implemented via valr::bed_fisher to obtain the significance of the overlap and the odds ratio.

### Value

An RLRanges object containing the results of the enrichment test accessed via `rlresult(object, "featureEnrichment")`. The results are in `tbl` format. For a full description of all columns in the output table see RLHub::feat_enrich_samples.

### Examples

    # Example RLRanges dataset
    rlr <- readRDS(system.file("extdata", "rlrsmall.rds", package = "RLSeq"))

    # RL Region Test
    featureEnrich(rlr)

    # With custom annotations
    small_anno <- list(
        "Centromeres" = readr::read_csv(
            system.file("extdata", "Centromeres.csv.gz", package="RLSeq"),
            show_col_types = FALSE
        )
    )
    featureEnrich(rlr, annotations = small_anno)

[Package RLSeq version 1.0.0 Index]