getAvgProfileWithCI: Compute the average profile and its confidence interval for a...

Description Usage Arguments Value Examples

View source: R/getAvgProfileWithCI.R

Description

Compute the average profile and its confidence interval for a selection of features

Usage

1
2
3
4
5
6
7
getAvgProfileWithCI(
  FeatureProfiles,
  selFeatures = NULL,
  pos = NULL,
  conf = 0.95,
  type = c("mean", "freq", "avgnorm", "sum", "n")
)

Arguments

FeatureProfiles

Matrix (features in row, position in columns) or RleList with coverage profiles for a set of features

selFeatures

Character or integer vector defining a selection of features from FeatureProfiles

pos

(Optional) Integer vector with values defining the genomic positions represented in FeatureProfiles

conf

Numeric in ]0,1] representing the confidence level used to compute the confidence interval

type

Character string indicating the method used to aggregate values from all the selFeatures. Methods are:

  • "mean" (Default). Compute the average value at each position.

  • "freq" Compute the proportion of signal at each position. Sum of "freq" signal accross positions is 1.

  • "avgnorm" Same as "freq" but mutiplied by the number of positions. Mean of "avgnorm" signal accross positions is 1.

  • "sum" Compute the sum of signal at each position.

  • "n" Compute the number of non missing observations at each genomic positions.

Value

a data frame with 4 columns:

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
## Extract the profiles around (+/-50bp) the first 200 genes. We bin the genes in 3 bins only.
  top200Prof <- annotationCoverageAroundFeatures(Genegr,
                                                 features=1:200,
                                                 sidedist = 50,
                                                 usePercent = TRUE,
                                                 nbins=3)
## Assemble the metagene profiles
  Prof <- assembleProfiles(top200Prof)
## Select a set of 50 random genes within the top200
  set.seed(123)
  randGenes <- sample(names(Genegr)[1:200], 50)
##Get the average profile for these genes
  avgProf_sense <- getAvgProfileWithCI(Prof$Profiles_Sense,
                                       selFeatures = randGenes,
                                       pos = c(-50:0, 1:3, 0:50))
  head(avgProf_sense)
## A quick look at the profile:
  plot(1:105, avgProf_sense$Profile,
       type="l", axes = FALSE,
       xlab="Position", ylab="Percent")
  lines(1:105, avgProf_sense$Upper, lty=2, col="grey")
  lines(1:105, avgProf_sense$Lower, lty=2, col="grey")
  axis(side=2)
  axis(side=1, at=c(1,51,55,105),
       labels=c("-50bp", "TSS", "TES", "+50bp"),
       las=2)

pgpmartin/GeneNeighborhood documentation built on Sept. 2, 2021, 6:37 a.m.