get_ers: Define sets of ERs

Description Usage Arguments Value Functions Examples

View source: R/get-ers.R

Description

get_ers defines expressed regions across an inputted range of mean coverage cut-offs (MCCs) and max region gaps (MRGs) from the coverage.

get_strand_ers defines ERs across an inputted range of mean coverage cut-offs (MCCs) and max region gaps (MRGs) from the coverage.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
get_ers(coverage, mccs, mrgs)

get_strand_ers(
  bw_pos,
  bw_neg,
  auc_raw_pos,
  auc_raw_neg,
  auc_target,
  chrs,
  mccs,
  mrgs,
  bw_chr = "chr"
)

Arguments

coverage

the coverage of the bigwig files passed into get_coverage.

mccs

mean coverage cut-offs to apply.

mrgs

max region gaps to apply.

bw_pos

positive strand bigwig file

bw_neg

negative strand bigwig file

auc_raw_pos

vector containing AUCs(Area Under Coverage) matching the order of the positive bigwig paths.

auc_raw_neg

vector containing AUCs(Area Under Coverage) matching the order of the negative bigwig paths.

auc_target

total AUC to normalise all samples to. E.g. 40e6 * 100 would be the estimated total auc for sample sequenced to 40 million reads of 100bp in length.

chrs

chromosomes to obtain mean coverage for, default is "" giving every chromosome. Can take UCSC format(chrs = "chr1") or just the chromosome i.e. chrs = c(1,X)

bw_chr

specifies whether the bigwig files has the chromosomes labelled with a "chr" preceding the chromosome i.e. "chr1" vs "1". Can be either "chr" or "nochr" with "chr" being the default.

Value

list containing sets of ERs, each generated using a particular combination of MCC and MRG.

list containing sets of stranded ERs, each generated using a particular combination of MCC and MRG.

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
data(gtex_SRP012682_SRX222703_lung_coverage_1, package = "ODER")

eg_ers <- get_ers(
    coverage = gtex_SRP012682_SRX222703_lung_coverage_1,
    mccs = c(5, 10),
    mrgs = c(10, 20)
)

eg_ers
library("magrittr")
gtex_metadata <- recount::all_metadata("gtex")
gtex_metadata <- gtex_metadata %>%
    as.data.frame() %>%
    dplyr::filter(project == "SRP012682")

rec_url <- recount::download_study(
    project = "SRP012682",
    type = "samples",
    download = FALSE
)
# file_cache is an internal function to download a bigwig file from a link
# if the file has been downloaded recently, it will be retrieved from a cache
bw_plus <- file_cache(rec_url[58])
bw_minus <- file_cache(rec_url[84])

# As of rtracklayer 1.25.16, BigWig is not supported on Windows.
if (!xfun::is_windows()) {
    stranded_ers <- get_strand_ers(
        bw_pos = bw_plus, bw_neg = bw_minus,
        auc_raw_pos = gtex_metadata[["auc"]][58],
        auc_raw_neg = gtex_metadata[["auc"]][84], auc_target = 40e6 * 100,
        chrs = "chr21", mccs = c(5, 10), mrgs = c(10, 20)
    )
    stranded_ers
}

eolagbaju/ODER documentation built on Dec. 20, 2021, 5:21 a.m.