DifferentialEnrichment: DifferentialEnrichment

View source: R/DifferentialEnrichment.R

DifferentialEnrichmentR Documentation

DifferentialEnrichment

Description

Calculate differential ChIP enrichment in peaks.

Usage

DifferentialEnrichment(
  peaks,
  bamFiles,
  bamNames = bamFiles,
  group,
  controlGroup = group[length(group)],
  width = 0,
  minOverlap = 1,
  PairedEnd = FALSE,
  minMQS = 255,
  strand = 0,
  splitOnly = FALSE,
  nonSplitOnly = FALSE,
  readExtension3 = 0,
  readShiftSize = 0,
  requireBothEndsMapped = FALSE,
  read2pos = 5
)

Arguments

peaks

A GRanges object containing your regions of interest. Must include seqnames (chromosomes), start, end, strand, and name.

bamFiles

Character vector containing the filenames (including the full path) of read alignment files in bam format.

bamNames

Character vector containing the names to describe the bamFiles you are using (for example: "H3K9me3_reads"). If no names are supplied, the full bamFiles names are used.

group

Character vector containing the group names that the ChIP samples belong to, with the order corresponding to the ChIP sample names in bamNames.

controlGroup

Character scalar giving the name of the control group that all other groups will be compared to. Eg "WT". If not specified the last element of the group vector will be used.

width

Integer scalar providing the width around the center of the peaks GRanges object provided in which the reads will be counted,default = 0. If width=0, the provided regions will remain the original size.

minOverlap

Integer scalar giving the minimum number of overlapping bases required for assigning a read to a genomic region (provided in peaks). For assignment of read pairs, number of overlapping bases from each read in the same pair will be summed. If a negative value is provided, then a gap of up to specified size will be allowed between read and the feature that the read is assigned to. 1 by default.

PairedEnd

Logical scalar, indicating wether reads in bam files were generated with paired-end or single-end sequencing. Default is FALSE (=single-end).

minMQS

Integer scalar, specifying the minimum mapping quality that a read must have to be included. Default is 255, which eliminates multimapping reads in case the STAR aligner was used to generate the bamFiles.

strand

Integer vector indicating if strand-specific read counting should be performed. Length of the vector should be either 1 (meaning that the value is applied to all input files), or equal to the total number of input files provided. Each vector element should have one of the following three values: 0 (unstranded), 1 (stranded) and 2 (reversely stranded). Default value of this parameter is 0 (ie. unstranded read counting is performed for all input files).

splitOnly

Logical scalar indicating whether only split alignments (their CIGAR strings contain letter 'N') should be included. FALSE by default.

nonSplitOnly

Logical scalar indicating whether only non-split alignments (their CIGAR strings do not contain letter 'N') should be included. FALSE by default.

readExtension3

Integer scalar giving the number of bases extended downstream from 3' end of each read. 0 by default. Negative value is not allowed.

readShiftSize

Integer scalar specifying the number of bases the reads will be shifted downstream by. 0 by default. Negative value is not allowed.

requireBothEndsMapped

Logical scalar indicating if both ends from the same fragment are required to be successfully aligned before the fragment can be assigned to a feature or meta-feature. This parameter is only appliable when PairedEnd is TRUE.

read2pos

Specifying whether each read should be reduced to its 5' most base or 3' most base. It has three possible values: NULL, 5 (denoting 5' most base) and 3 (denoting 3' most base). Default value is 5, ie. only the 5' end of the read will be counted. If a read is reduced to a single base, only that base will be considered for the read assignment. Read reduction is performed after read shifting and extension.

Details

Calculates read counts for two groups of ChIPs (at least 2 replicates each), normalizes them to total mapped read counts (voom), and calculates differential enrichment between all groups and a control group using Limma.

Value

A data.frame with the logFC (log2 fold change), p-values, and adjusted p-values for each peak and each contrast (each group compared to the control group).

#' @examples peaks <- SimulatePeaks(1000,rep(100,1000),chromosomeSizes= system.file("extdata", "chrNameLength_mm10_chr11.txt", package = "MiniChip")) bamFiles <- list.files(system.file("extdata", package = "MiniChip"), full.names=TRUE,pattern="*bam$") bamNames <- gsub(paste(system.file("extdata", package = "MiniChip"),"/",sep=""),"",bamFiles) bamNames <- gsub("_chr11.bam","",bamNames) DifferentialEnrichment(peaks=peaks,bamFiles=bamFiles,bamNames=bamNames,group=c("A","A","A","IN","IN","IN"))


fmi-basel/gbuehler-MiniChip documentation built on June 13, 2025, 6:15 a.m.