Takes in data annotated peak files that include expression information to produce a Cumulative Fraction Plot showing log2FoldChange vs. cumulative fraction of genes included.
CumulativeFractionPlot(peaks.list, res, by = "Nearest.Ensembl", boxplot = FALSE)
Results used to annotate gene expression (with same log2FoldChanges) to calculate "Remaining Genes" distribution. Must have a column labeled with your joining parameter to peaks and "log2FoldChange" (assumed to be ENSEMBL, thus `Nearest.Ensembl`)
Argument for dplyr::left_join to combine peaks and results frame
Plot a boxplot instead of a CDF.
Output from HOMER
ggplot2 showing cumulative fraction plot.
Peaks should be annotated using the
annotatePeaks.pl script in HOMER
and paired with expression data using the -gene argument. An example
command might look like:
annotatePeaks.pl regions.txt mm10 -ann genes_ens2.gtf -gene results.txt
For multiple regions:expression pairings, separate peak files should be
read in, rather than performing multiple runs of
list (with names) should be provided.
Ensure that every columns in your expression file has a column name! Else
ReadPeaks will get tripped up and not work.
res <- data.frame(Nearest.Ensembl = rownames(results(dds)), results(dds)) tf <- ReadPeaks(TF.peaks, TF.peaks.exp.anno) CumulativeFractionPlot(tf, res) se <- ReadPeaks("data-raw/G_43/superEnhancers.txt", "data-raw/G_43/superEnhancers_gene_anno.txt") te <- ReadPeaks("data-raw/G_43/typical.txt", "data-raw/G_43/typical_gene_anno.txt") CumulativeFractionPlot(list(se = se, te = te), res)