profileStrandedRegions: Calculate metadata profiles across GRanges or GRangesList

Description Usage Arguments Value Examples

View source: R/profileStrandedRegions.R

Description

This function calculates coverage profiles across genomic regions.

Usage

1
profileStrandedRegions(query, subject, nbin = 100)

Arguments

query

A single stranded GenomicRanges or GenomicRanges objects, possibly named.

subject

A IRanges, usually generated by the coverage function.

nbin

A single integer. It determines the number of bins in which each region will be divided.

Value

A data.table of the normalised binned coverage across the genomic regions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library("TxDb.Dmelanogaster.UCSC.dm3.ensGene")
TxDb = TxDb.Dmelanogaster.UCSC.dm3.ensGene

query = keepSeqlevels(exonsBy(TxDb, by="tx", use.names=TRUE), "chr4", pruning.mode="coarse")
query = query[strand(query)=="+"]
query = query[sum(width(query))>0]

library("pasillaBamSubset")
library("GenomicAlignments")

fl1 <- untreated1_chr4()
subject = coverage(keepSeqlevels(readGAlignments(fl1), "chr4"))

profile = profileStrandedRegions(query, subject)
profile = profile[, list(value = mean(value)), by="bin"]

library("ggplot2")

ggplot(profile, aes(x=bin, y=value)) + 
  geom_line() +
  scale_x_continuous("Position") +
  scale_y_continuous("Average normalised coverage") +
  theme_bw()

fagostini/Mimir documentation built on Dec. 3, 2019, 7:53 p.m.