profileFixedFeatures: Calculate metadata profiles across fixed-width features

Description Usage Arguments Value Examples

View source: R/profileFixedFeatures.R

Description

This function calculates metadata profiles across fixed-width features using a procedure similar to that used in (https://www.sciencedirect.com/science/article/pii/S1097276519303533?via

Usage

1
2
3
4
profileFixedFeatures(fixedRegions = NULL, sampleObject = NULL,
  TxDb = NULL, bins = c(150), weightCol = NULL,
  ignoreStrand = FALSE, dropEmpty = TRUE, normType = c("density",
  "max", "none"), collapse = TRUE, verbose = TRUE)

Arguments

fixedRegions

A named GenomicRanges or list of GenomicRanges objects. The GenomicRanges width must be the same within the same group, but it can vary between groups.

sampleObject

A GenomicRanges or GenomicAlignments object.

TxDb

A GenomicFeatures object. Required if fixedRegions or sampleObject have missing GenomeInfoDb information. It must contain GenomeInfoDb information.

bins

An ordered integer vector (must be greater equal that the length of fixedRegions). The vector order determines the number of bins for each region. If more bins than regions are provided, the additional will be ignored.

weightCol

A single character string. This must be the name of an integer column in the sampleObject object.

ignoreStrand

When set to 'TRUE', the strand information in sampleObject is ignored. This does not affect the features in fixedRegions.

dropEmpty

When set to 'TRUE', the transcripts with no signal in any of their sub-regions will be discarded. When set to 'FALSE', all values of these regions will be set to 0.

normType

A character string indicating which region normalising method to use. One of 'density' (default), 'max', 'none': can be abbreviated. Depending on the chosen method the values of each region are normalised using the sum ('density'), the maximum ('max') of the values across the region, or not normalised at all ('none').

collapse

When set to 'TRUE', the profiles are collapsed into a single profile.

verbose

When set to 'TRUE', the function prints diagnostic messages.

Value

A data.table of the normalised binned coverage across the fixed features. Column names are determined by collapse.

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
library("TxDb.Dmelanogaster.UCSC.dm3.ensGene")
TxDb = TxDb.Dmelanogaster.UCSC.dm3.ensGene

query = genes(TxDb, filter=list(tx_chrom = "chr4"))
query = GRangesList(Promoter = promoters(query, upstream=500, downstream=1000))

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

fl1 <- untreated1_chr4()
subject = readGAlignments(fl1)

profile = profileFixedFeatures(fixedRegions=query, sampleObject=subject, TxDb=TxDb)

library("ggplot2")

ggplot(profile, aes(x=bin, y=Mean)) + 
  geom_line() +
  geom_vline(xintercept=50, linetype="dashed", colour="grey30") +
  scale_x_continuous("Relative position",
       breaks=c(1, 50.5, 150), label=c("-500", "TSS", "1000")) +
  scale_y_continuous("Average normalised signal") +
  coord_cartesian(xlim=c(0, 150)) +
  theme_bw()

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