qualityScores_GM: Wrapper function to calculate GM metrics from global read...

Description Usage Arguments Value Examples

View source: R/qualityScores_GM.R

Description

This set of values is based on the global read distribution along the genome for immunoprecipitation and input data (Diaz et al., 2012). The genome is binned and the read coverage counted for each bin. Then the function computes the cumulative distribution of reads density per genomic bin and plots the fraction of the coverage on the y-axis and the fraction of bins on the x-axis. Then different values can be sampled from the cumulative distribution: like the fraction of bins without reads for in immunoprecipitation and input,the point of the maximum distance between the ChIP and the input (x-axis, y-axis for immunoprecipitation and input, distance (as absolute difference), the sign of the differences), the fraction of reads in the top 1 percent bin for immunoprecipitation and input. Finally, the funciton returns 9 QC-measures.

qualityScores_GM

Usage

1
2
3
4
5
6
7
8
9
qualityScores_GM(
  selectedTagsChip,
  selectedTagsInput,
  tag.shift,
  annotationID,
  savePlotPath = NULL,
  mc = 1,
  returnDensities = FALSE
)

Arguments

selectedTagsChip

Data-structure with selected tag information for ChIP (returned by qualityScores_EM).

selectedTagsInput

Data-structure with selected tag information for Input (returned by qualityScores_EM)

tag.shift,

Integer containing the value of the tag shif, calculated by getCrossCorrelationScores()

annotationID

String, indicating the genome assembly

savePlotPath

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

mc

Integer, the number of CPUs for parallelization (default=1)

returnDensities

Boolean, default FALSE. Whether smoothed Chip and Input reads densities should be returned. This is used only for optimizing the flow od fata in the ChIC_wrapper function

Value

finalList List with 9 QC-values

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
## 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)

Ch_Results <- qualityScores_GM(densityChip = smoothedChip,
    densityInput = smoothedInput, savePlotPath = filepath)

## End(Not run)

carmencita/ChIC documentation built on April 28, 2021, 7:20 p.m.