metagenePlotsForComparison: Function to create metage plots for comparison

Description Usage Arguments Value Examples

View source: R/ComparisonFunctions.R

Description

QC-metrics of newly analysed ChIP-seq samples can be compared with the reference values of the compendium and enrichment profiles can be plotted against pre-computed profiles of published datasets. The metagene profiles show the problematic samples signal (red line) for the ChIP, for the input and their relative enrichment when compared to the compendium<e2><80><99>s mean signal (black line) and its 2 x standard error (blue shadow). Additionally the function plots the desired QC-metric as a red dashed line for the sample plotted against the reference distribution (density plots) of the compendium values stratified by chromatin marks.

metagenePlotsForComparison

Usage

1
metagenePlotsForComparison(data, target, tag, savePlotPath = NULL)

Arguments

data

metagene-object of metagene profile by createMetageneProfile() containing input and chip profile

target

String, chromatin mark or transcription factor to be analysed. Use listAvailableElements() function to check availability.

tag

indicating the kind of profile to plot. Can be either: geneBody, TES or TSS.

savePlotPath

if set the plot will be saved under 'savePlotPath'. Default=NULL and plot will be forwarded to stdout.

Value

Creates a pdf figure under 'savePlotPath'

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
## This command is time intensive to run
##
## To run the example code the user must provide two bam files for the ChIP
## and the input and read them with the readBamFile() function. To make it
## easier for the user to run the example code we provide tow bam examples 
## (chip and input) in our ChIC.data package that have already been loaded 
## with the readBamFile() function.

mc=4
finalTagShift=98

## Not run: 

filepath=tempdir()
setwd(filepath)

data("chipSubset", package = "ChIC.data", envir = environment())
chipBam=chipSubset
data("inputSubset", package = "ChIC.data", envir = environment())
inputBam=inputSubset

## calculate binding characteristics 

chip_binding.characteristics<-spp::get.binding.characteristics(
    chipBam, srange=c(0,500), bin=5,accept.all.tags=TRUE)
input_binding.characteristics<-spp::get.binding.characteristics(
    inputBam, srange=c(0,500), bin=5,accept.all.tags=TRUE)

##get chromosome information and order chip and input by it
chrl_final=intersect(names(chipBam$tags),names(inputBam$tags))
chipBam$tags=chipBam$tags[chrl_final]
chipBam$quality=chipBam$quality[chrl_final]
inputBam$tags=inputBam$tags[chrl_final]
inputBam$quality=inputBam$quality[chrl_final]

##remove sigular positions with extremely high read counts with 
##respect to the neighbourhood
selectedTags=removeLocalTagAnomalies(chipBam, inputBam, 
chip_binding.characteristics, input_binding.characteristics)

inputBamSelected=selectedTags$input.dataSelected
chipBamSelected=selectedTags$chip.dataSelected

##smooth input and chip tags
smoothedChip <- tagDensity(chipBamSelected, 
    tag.shift = finalTagShift, mc = mc)
smoothedInput <- tagDensity(inputBamSelected, 
    tag.shift = finalTagShift, mc = mc)

##calculate metagene profiles
Meta_Result <- createMetageneProfile(
    smoothed.densityChip = smoothedChip, 
    smoothed.densityInput = smoothedInput, 
    tag.shift = finalTagShift, mc = mc)

##compare metagene features of the geneBody with the compendium
metagenePlotsForComparison(data = Meta_Result$geneBody,
    target = "H3K4me3", tag = "geneBody")

## End(Not run)

ChIC documentation built on Nov. 8, 2020, 5:15 p.m.