View source: R/motif_enrichment_HOMER.R
calcBinnedMotifEnrHomer | R Documentation |
Run complete HOMER motif enrichment analysis, consisting of
calls to prepareHomer
, system2
and
parseHomerOutput
. This function requires HOMER
to be installed (see http://homer.ucsd.edu/homer/index.html)
and the path to the tool to be provided (homerfile
argument).
calcBinnedMotifEnrHomer(
gr,
b,
genomedir,
outdir,
motifFile,
homerfile = findHomer(),
regionsize = "given",
pseudocount.log2enr = 8,
p.adjust.method = "BH",
Ncpu = 2L,
verbose = FALSE,
verbose.Homer = FALSE
)
gr |
A |
b |
A vector of the same length as |
genomedir |
Directory containing sequence files in Fasta format (one per chromosome). |
outdir |
A path specifying the folder into which the output files will be written. |
motifFile |
A file with HOMER formatted PWMs to be used in the enrichment analysis. |
homerfile |
Path and file name of the |
regionsize |
The peak size to use in HOMER ( |
pseudocount.log2enr |
A numerical scalar with the pseudocount to add to foreground and background counts when calculating log2 motif enrichments |
p.adjust.method |
A character scalar selecting the p value adjustment
method (used in |
Ncpu |
Number of parallel threads that HOMER can use. |
verbose |
A logical scalar. If |
verbose.Homer |
A logical scalar. If |
A SummarizedExperiment
object with motifs in rows and bins
in columns, containing seven assays:
: -log10 P values
: -log10 adjusted P values
: motif enrichments as Pearson residuals
: expected number of foreground sequences with motif hits
: motif enrichments as log2 ratios
: Sum of foreground sequence weights in a bin that have motif hits
: Sum of background sequence weights in a bin that have motif hits
The rowData
of the object contains annotations (name, PFMs, PWMs
and GC fraction) for the motifs, while the colData
slot contains
summary information about the bins.
The functions that are wrapped: prepareHomer
,
system2
and parseHomerOutput
,
bin
for binning of regions
if (!is.na(findHomer())){
# genome
genome <- system.file("extdata", "exampleGenome.fa", package = "monaLisa")
# create motif file for Homer
motiffile <- tempfile()
motifIDs <- c("MA0139.1", "MA1102.1", "MA0740.1")
dumpJaspar(filename = motiffile, pkg = "JASPAR2020",
opts = list(ID = motifIDs))
# GRanges of regions used in binned motif enrichment analysis
gr <- GenomicRanges::tileGenome(
seqlengths = c(chr1 = 10000L, chr2 = 10000L, chr3 = 10000L),
tilewidth = 200, cut.last.tile.in.chrom = TRUE)
# create bins (motif enrichment analysis will be per bin)
bins <- factor(GenomicRanges::seqnames(gr))
table(bins)
# run calcBinnedMotifEnrHomer
outdir <- tempfile()
se <- calcBinnedMotifEnrHomer(gr = gr, b = bins, genomedir = genome,
outdir = outdir, motifFile = motiffile)
list.files(outdir)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.