generateControl | R Documentation |
function to generate random control region for given regions.
generateControl(regions, ...)
## S4 method for signature 'GenomicRanges'
generateControl(
regions,
genome,
gene.txdb = NULL,
n.random = 5,
random.seed = NULL
)
regions |
|
genome |
BSgenome object, or short string signifying genome build
recognized by |
gene.txdb |
|
n.random |
number for generating random control.For each region, generating n.random control regions.(default=5) |
random.seed |
seed for random programs |
If the gene.txdb is specified, control regions will be generated from the same TSS distance to random gene of given region. Otherwise, the control region will be generated by random location with the same chromosome and region width of given regions.
GenomicRanges
random control regions
with n.random times the length of the input regions
generateControl(GenomicRanges)
: GenomicRanges
library(BSgenome.Hsapiens.UCSC.hg19)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
example_motifs <- getJasparMotifs(species = "Homo sapiens",
collection = "CORE")
# Make a set of input regions
Input <- GenomicRanges::GRanges(seqnames = c("chr1","chr2","chr2"),
ranges = IRanges::IRanges(start = c(76585873,42772928,
100183786),
width = 500))
# Make a set of control regions by generateControl
Control <- generateControl(Input, genome=BSgenome.Hsapiens.UCSC.hg19,
gene.txdb=TxDb.Hsapiens.UCSC.hg19.knownGene)
# Scan motif for example motifs
motif_ix_input <- motifScan(example_motifs, Input, genome = "BSgenome.Hsapiens.UCSC.hg19")
motif_ix_control <- motifScan(example_motifs, Control, genome = "BSgenome.Hsapiens.UCSC.hg19")
# Find Enrichment motif of input by control
Enrichment_result <- motifEnrichment(motif_ix_input, motif_ix_control)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.