meth2DDensity: Create a 2D density plot of methylation levels for two...

View source: R/meth2DDensity.R

meth2DDensityR Documentation

Create a 2D density plot of methylation levels for two samples

Description

Create a 2D density plot of methylation levels for two samples

Usage

meth2DDensity(
  betas,
  sample_1 = NULL,
  sample_2 = NULL,
  which = 10000,
  genome = "hg38",
  chr = NULL,
  palette = "PuBu",
  make_log = FALSE
)

Arguments

betas

BSseq or matrix of methylation values, must contain at least two samples

sample_1

Sample name to plot on x-axis, sample at index 1 if NULL (default: NULL)

sample_2

Sample name to plot on y-axis, sample at index 2 if NULL (default: NULL)

which

Integer or GRanges. If Integer, find bins using tileGenome() with Integer tilewidth, otherwise use GRanges. If GRanges, ignores genome and chr (default: 10000)

genome

Genome data is from, currently only works for hg19, hg38, mm9, and mm10 (default: "hg38")

chr

Pull out a single chromosome for bins, use all chromosomes if NULL (default: NULL)

palette

RColorBrewer palette to create plot with (default: "PuBu")

make_log

Make z-axis for density be log10 (default: FALSE)

Value

a ggplot2 object of the density plot

Examples


orig_bed <- system.file("extdata", "MCF7_Cunha_chr11p15.bed.gz", package="biscuiteer")
orig_vcf <- system.file("extdata", "MCF7_Cunha_header_only.vcf.gz", package="biscuiteer")
bisc1    <- readBiscuit(BEDfile = orig_bed, VCFfile = orig_vcf, merged = FALSE)

shuf_bed <- system.file("extdata", "MCF7_Cunha_chr11p15_shuffled.bed.gz", package="biscuiteer")
shuf_vcf <- system.file("extdata", "MCF7_Cunha_shuffled_header_only.vcf.gz", package="biscuiteer")
bisc2    <- readBiscuit(BEDfile = shuf_bed, VCFfile = shuf_vcf, merged = FALSE)

comb <- unionize(bisc1, bisc2)

meth2DDensity(comb, chr="chr11", sample_1 = "MCF7_Cunha", sample_2 = "MCF7_Cunha_shuffled")


huishenlab/bisplotti documentation built on Sept. 20, 2023, 10:13 p.m.