utils-motif {universalmotif} | R Documentation |
Motif-related utility functions.
consensus_to_ppm(letter) consensus_to_ppmAA(letter) get_consensus(position, alphabet = "DNA", type = "PPM", pseudocount = 1) get_consensusAA(position, type = "PPM", pseudocount = 0) get_matches(motif, score) icm_to_ppm(position) make_DBscores(db.motifs, method, shuffle.db = TRUE, shuffle.k = 3, shuffle.method = "linear", shuffle.leftovers = "asis", rand.tries = 1000, normalise.scores = TRUE, min.overlap = 6, min.mean.ic = 0, progress = TRUE, BP = FALSE) motif_score(motif, threshold = c(0, 1)) pcm_to_ppm(position, pseudocount = 0) position_icscore(position, bkg = 0, type = "PPM", pseudocount = 1, nsites = 100, relative_entropy = FALSE) ppm_to_icm(position, bkg, schneider_correction = FALSE, nsites = 100, relative_entropy = FALSE) ppm_to_pcm(position, nsites = 100) ppm_to_pwm(position, bkg, pseudocount = 1, nsites = 100, smooth = TRUE) pwm_to_ppm(position, bkg) score_match(motif, match) summarise_motifs(motifs, na.rm = TRUE)
letter |
|
position |
|
alphabet |
|
type |
|
pseudocount |
|
motif |
Motif object to calculate scores from. |
score |
|
db.motifs |
|
method |
|
shuffle.db |
|
shuffle.k |
|
shuffle.method |
|
shuffle.leftovers |
|
rand.tries |
|
normalise.scores |
|
min.overlap |
|
min.mean.ic |
|
progress |
|
BP |
|
threshold |
|
bkg |
|
nsites |
|
relative_entropy |
|
schneider_correction |
|
smooth |
|
match |
|
motifs |
|
na.rm |
|
For consensus_to_ppm()
and consensus_to_ppmAA()
: a numeric
vector of length 4 and 20, respectively.
For get_consensus()
and get_consensusAA()
: a character vector
of length 1.
For get_matches()
: a character
vector of motif matches.
For make_DBscores()
: a data.frame
with score distributions for the
input database.
For motif_score()
: a named numeric
vector of motif scores.
For position_icscore()
: a numeric
vector of length 1.
For ppm_to_icm()
, icm_to_ppm()
, pcm_to_ppm()
,
ppm_to_pcm()
, ppm_to_pwm()
, and pwm_to_ppm()
: a numeric
vector with length equal to input numeric
vector.
For score_match()
: a numeric
vector with the match motif score.
For summarise_motifs()
: a data.frame
with columns representing
the universalmotif slots.
Benjamin Jean-Marie Tremblay, b2tremblay@uwaterloo.ca
####################################################################### ## Setting up some variables data(examplemotif) m <- normalize(examplemotif) motif <- create_motif(nsites = 100, pseudocount = 0.8)["motif"] motif.icm <- apply(motif, 2, ppm_to_icm, nsites = 100, bkg = c(0.25, 0.25, 0.25, 0.25)) motif.ppm <- apply(motif.icm, 2, icm_to_ppm) motif.consensus <- apply(motif.ppm, 2, get_consensus) motif.aa <- create_motif(alphabet = "AA")["motif"] motif.aa.consensus <- apply(motif.aa, 2, get_consensusAA, type = "PPM") ####################################################################### ####################################################################### ## consensus_to_ppm ## Do the opposite of get_consensus. Note that loss of information is ## inevitable. motif.ppm4 <- sapply(motif.consensus, consensus_to_ppm) ####################################################################### ## consensus_to_ppmAA ## Do the opposite of get_consensusAA. motif.aa2 <- sapply(motif.aa.consensus, consensus_to_ppmAA) ####################################################################### ## get_consensus ## Get a consensus string from a DNA/RNA motif. motif.consensus <- apply(motif.ppm, 2, get_consensus) ####################################################################### ## get_consensusAA ## Get a consensus string from an amino acid motif. Unless each position ## is clearly dominated by a single amino acid, the resulting string will ## likely be useless. motif.aa <- create_motif(alphabet = "AA")["motif"] motif.aa.consensus <- apply(motif.aa, 2, get_consensusAA, type = "PPM") ####################################################################### ## get_match ## Get all possible motif matches above input score get_matches(m, 10) ####################################################################### ## icm_to_ppm ## Do the opposite of ppm_to_icm. motif.ppm <- apply(motif.icm, 2, icm_to_ppm) ####################################################################### ## make_DBscores ## Generate P-value database for use with compare_motifs. Note that these ## must be created individually for all combinations of methods and ## normalisation. ## Not run: library(MotifDb) motifs <- convert_motifs(MotifDb[1:100]) make_DBscores(motifs, method = "PCC") ## End(Not run) ####################################################################### ## motif_score ## Calculate motif score from different thresholds data(examplemotif) m <- normalize(examplemotif) motif_score(m, c(0, 0.8, 1)) ####################################################################### ## pcm_to_ppm ## Go from a count type motif to a probability type motif. motif.pcm <- create_motif(type = "PCM", nsites = 50)["motif"] motif.ppm2 <- apply(motif.pcm, 2, pcm_to_ppm, pseudocount = 1) ####################################################################### ## position_icscore ## Similar to ppm_to_icm, except this calculates a sum for the position. ic.scores <- apply(motif.ppm, 2, position_icscore, type = "PPM", bkg = c(0.25, 0.25, 0.25, 0.25)) ####################################################################### ## ppm_to_icm ## Convert one column from a probability type motif to an information ## content type motif. motif <- create_motif(nsites = 100, pseudocount = 0.8)["motif"] motif.icm <- apply(motif, 2, ppm_to_icm, nsites = 100, bkg = c(0.25, 0.25, 0.25, 0.25)) ####################################################################### ## ppm_to_pcm ## Do the opposite of pcm_to_ppm. motif.pcm2 <- apply(motif.ppm2, 2, ppm_to_pcm, nsites = 50) ####################################################################### ## ppm_to_pwm ## Go from a probability type motif to a weight type motif. motif.pwm <- apply(motif.ppm, 2, ppm_to_pwm, nsites = 100, bkg = c(0.25, 0.25, 0.25, 0.25)) ####################################################################### ## pwm_to_ppm ## Do the opposite of ppm_to_pwm. motif.ppm3 <- apply(motif.pwm, 2, pwm_to_ppm, bkg = c(0.25, 0.25, 0.25, 0.25)) ####################################################################### ## Note that not all type conversions can be done directly; for those ## type conversions which are unavailable, universalmotif just chains ## together others (i.e. from PCM -> ICM => pcm_to_ppm -> ppm_to_icm) ####################################################################### ## score_match ## Calculate score of a particular match score_match(m, "TATATAT") score_match(m, "TATATAG") ####################################################################### ## summarise_motifs ## Create a data.frame of information based on a list of motifs. m1 <- create_motif() m2 <- create_motif() m3 <- create_motif() summarise_motifs(list(m1, m2, m3))