Description Usage Arguments Details Value Author(s) See Also Examples
Apply a function to each chromosome in a genome.
1 |
BSParams |
a BSParams object that holds the various parameters needed to configure the bsapply function |
... |
optional arguments to 'FUN'. |
By default the exclude parameter is set to not exclude anything. A popular option will probably be to set this to "rand" so that random bits of unassigned contigs are filtered out.
If BSParams
sets simplify = FALSE
, a GenomeData object is returned
containing the results generated using the remaining BSParams specifications.
If BSParams
sets simplify = TRUE
, an sapply
-like
simplification is used on the results.
Marc Carlson
BSParams-class, BSgenome-class, BSgenome-utils, GenomeData-class
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | ## Load the Worm genome:
library("BSgenome.Celegans.UCSC.ce2")
## Count the alphabet frequencies for every chromosome but exclude
## mitochrondrial ones:
params <- new("BSParams", X = Celegans, FUN = alphabetFrequency,
exclude = "M")
bsapply(params)
## Or we can do this same function with simplify = TRUE:
params <- new("BSParams", X = Celegans, FUN = alphabetFrequency,
exclude = "M", simplify = TRUE)
bsapply(params)
## Examples to show how we might look for a string (in this case an
## ebox motif) across the whole genome.
Ebox <- DNAStringSet("CACGTG")
pdict0 <- PDict(Ebox)
params <- new("BSParams", X = Celegans, FUN = countPDict, simplify = TRUE)
bsapply(params, pdict = pdict0)
params@FUN <- matchPDict
bsapply(params, pdict = pdict0)
## And since its really overkill to use matchPDict to find a single pattern:
params@FUN <- matchPattern
bsapply(params, pattern = "CACGTG")
## Examples on how to use the masks
library("BSgenome.Hsapiens.UCSC.hg19.masked")
genome <- BSgenome.Hsapiens.UCSC.hg19.masked
## I can make things verbose if I want to see the chromosomes getting processed.
options(verbose=TRUE)
## For the 1st example, lets use default masks
params <- new("BSParams", X = genome, FUN = alphabetFrequency,
exclude = c(1:8,"M","X","random","hap"), simplify = TRUE)
bsapply(params)
if (interactive()) {
## Set up the motifList to filter out all double T's and all double C's
params@motifList <-c("TT","CC")
bsapply(params)
## Get rid of the motifList
params@motifList=as.character()
}
##Enable all standard masks
params@maskList <- c("RM"=TRUE,"TRF"=TRUE)
bsapply(params)
##Disable all standard masks
params@maskList <- c("AGAPS"=FALSE,"AMB"=FALSE)
bsapply(params)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.