PlotSingleSiteSMF: Plot SMF data at single site

View source: R/plot_single_molecule_examples.r

PlotSingleSiteSMFR Documentation

Plot SMF data at single site

Description

Plot SMF data at single site

Usage

PlotSingleSiteSMF(
  ContextMethylation,
  sample,
  range,
  SortedReads = NULL,
  TFBSs,
  saveAs = NULL
)

Arguments

ContextMethylation

Context methylation object as returned by CallContextMethylation function

sample

one sample as reported in the SampleName files of the QuasR sampleSheet

range

GRange interval to plot

SortedReads

Defaults to NULL, in which case will plot unsorted reads. Sorted reads object as returned by SortReads function or "HC" to perform hierarchical clustering

TFBSs

GRange or GRangesList of transcription factor binding sites to add to the plot. If SortedReads are passed, the format of TFBSs (GRanges vs GRangesList) will be used to determie if single molecules were sorted based on one or multiple TFs

saveAs

Full path to pdf file to save plot to. Defaults to NULL, in which case will only display

Value

Single site plot including average SMF signal, single molecules stack and state quantification plot

Examples

Qinput = paste0(tempdir(), "/NRF1Pair_Qinput.txt")
library(BSgenome.Mmusculus.UCSC.mm10)

if(file.exists(Qinput)){
    QuasRprj = GetQuasRprj(Qinput, BSgenome.Mmusculus.UCSC.mm10)

    MySample = readr::read_delim(Qinput, delim = "\t")$SampleName[1]
    Region_of_interest = GRanges(seqnames = "chr6", ranges = IRanges(start = 88106000, end = 88106500), strand = "*")

    Methylation = CallContextMethylation(sampleSheet = Qinput,
                                     sample = MySample,
                                     genome = BSgenome.Mmusculus.UCSC.mm10,
                                     range = Region_of_interest,
                                     coverage = 20,
                                     ConvRate.thr = 0.2)

    TFBSs = GenomicRanges::GRanges("chr6", IRanges(c(88106253), c(88106263)), strand = "-")
    elementMetadata(TFBSs)$name = c("NRF1")
    names(TFBSs) = c(paste0("TFBS_", c(4305216)))
    SortedReads = SortReadsByTFCluster(MethSM = Methylation[[2]], TFBSs = TFBSs)

    PlotSingleSiteSMF(ContextMethylation = Methylation,
                      sample = MySample,
                      range = Region_of_interest,
                      SortedReads = SortedReads,
                      TFBSs = TFBSs,
                      saveAs = NULL)
}


Krebslabrep/SingleMoleculeFootprinting documentation built on Nov. 19, 2022, 3:56 a.m.