utils-motif | R Documentation |
Motif-related utility functions.
add_gap(motif, gaploc = ncol(motif)%/%2, mingap = 1, maxgap = 5)
average_ic(motifs, average = c("a.mean", "g.mean", "median", "fzt"))
compare_columns(x, y, method, bkg1 = rep(1/length(x), length(x)),
bkg2 = rep(1/length(y), length(y)), nsites1 = 100, nsites2 = 100)
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, allow.nonfinite = FALSE)
get_scores(motif, allow.nonfinite = FALSE)
icm_to_ppm(position)
motif_range(motif, use.freq = 1, allow.nonfinite = FALSE)
motif_score(motif, threshold = c(0, 1), use.freq = 1,
allow.nonfinite = FALSE, threshold.type = c("total", "fromzero"))
log_string_pval(pval)
pcm_to_ppm(position, pseudocount = 0)
position_icscore(position, bkg = numeric(), type = "PPM",
pseudocount = 1, nsites = 100, relative_entropy = FALSE,
schneider_correction = FALSE)
ppm_to_icm(position, bkg = numeric(), schneider_correction = FALSE,
nsites = 100, relative_entropy = FALSE)
ppm_to_pcm(position, nsites = 100)
ppm_to_pwm(position, bkg = numeric(), pseudocount = 1, nsites = 100,
smooth = TRUE)
prob_match(motif, match, allow.zero = TRUE)
prob_match_bkg(bkg, match)
pwm_to_ppm(position, bkg = numeric())
round_motif(motif, pct.tolerance = 0.05)
score_match(motif, match, allow.nonfinite = FALSE)
summarise_motifs(motifs, na.rm = TRUE)
ungap(motif, delete = FALSE)
motif |
Motif object to calculate scores from, or add/remove gap, or round. |
gaploc |
|
mingap |
|
maxgap |
|
motifs |
|
average |
|
x |
|
y |
|
method |
|
bkg1 |
|
bkg2 |
|
nsites1 |
|
nsites2 |
|
letter |
|
position |
|
alphabet |
|
type |
|
pseudocount |
|
score |
|
allow.nonfinite |
|
use.freq |
|
threshold |
|
threshold.type |
|
pval |
|
bkg |
|
nsites |
|
relative_entropy |
|
schneider_correction |
|
smooth |
|
match |
|
allow.zero |
|
pct.tolerance |
|
na.rm |
|
delete |
|
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 motif_range()
: a named numeric
vector of motif scores.
For motif_score()
: a named numeric
vector of motif scores.
For log_string_pval()
: a numeric
vector of length 1.
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 prob_match()
: a numeric
vector of probabilities.
For round_motif()
: the input motif, rounded.
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, benjamin.tremblay@uwaterloo.ca
create_motif()
data(examplemotif)
examplemotif0 <- examplemotif
examplemotif0["pseudocount"] <- 0
#######################################################################
## add_gap
## Add gap information to a motif.
m <- create_motif()
# Add a gap size 5-8 between positions 4 and 5:
m <- add_gap(m, gaploc = 4, mingap = 5, maxgap = 8)
#######################################################################
## average_ic
## Calculate the average information content for a list of motifs.
m <- create_motif()
average_ic(m, "fzt")
#######################################################################
## compare_columns
## Compare two numeric vectors using the metrics from compare_motifs()
compare_columns(c(0.5, 0.1, 0.1, 0.2), c(0.7, 0.1, 0.1, 0.1), "PCC")
#######################################################################
## consensus_to_ppm
## Do the opposite of get_consensus. Note that loss of information is
## inevitable. Generates a sequence matrix.
sapply(c("A", "G", "T", "B"), consensus_to_ppm)
#######################################################################
## consensus_to_ppmAA
## Do the opposite of get_consensusAA and generate a motif matrix.
sapply(c("V", "A", "L"), consensus_to_ppmAA)
#######################################################################
## get_consensus
## Get a consensus string from a DNA/RNA motif.
m <- create_motif()["motif"]
apply(m, 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.
m <- create_motif(alphabet = "AA")["motif"]
apply(m, 2, get_consensusAA, type = "PPM")
#######################################################################
## get_match
## Get all possible motif matches above input score
get_matches(examplemotif, 0)
get_matches(examplemotif0, 0, allow.nonfinite = TRUE)
#######################################################################
## get_scores
## Get all possible scores for a motif
length(get_scores(examplemotif))
get_scores(examplemotif)
get_scores(examplemotif0, allow.nonfinite = TRUE)
#######################################################################
## icm_to_ppm
## Do the opposite of ppm_to_icm.
m <- create_motif(type = "ICM")["motif"]
apply(m, 2, icm_to_ppm)
#######################################################################
## motif_range
## Calculate the range of possible logodds scores for a motif
motif_range(examplemotif)
motif_range(examplemotif, allow.nonfinite = TRUE)
#######################################################################
## motif_score
## Calculate motif score from different thresholds
m <- normalize(examplemotif)
motif_score(m, c(0, 0.8, 1))
motif_score(examplemotif0, c(0, 0.8, 1), allow.nonfinite = TRUE,
threshold.type = "fromzero")
#######################################################################
## log_string_pval
## Get the log of a string-formatted p-value
log_string_pval("1e-200")
#######################################################################
## pcm_to_ppm
## Go from a count type motif to a probability type motif.
m <- create_motif(type = "PCM", nsites = 50)["motif"]
apply(m, 2, pcm_to_ppm, pseudocount = 1)
#######################################################################
## position_icscore
## Similar to ppm_to_icm, except this calculates the position sum.
m <- create_motif()["motif"]
apply(m, 2, position_icscore, type = "PPM", bkg = rep(0.25, 4))
#######################################################################
## ppm_to_icm
## Convert one column from a probability type motif to an information
## content type motif.
m <- create_motif(nsites = 100, pseudocount = 0.8)["motif"]
apply(m, 2, ppm_to_icm, nsites = 100, bkg = rep(0.25, 4))
#######################################################################
## ppm_to_pcm
## Do the opposite of pcm_to_ppm.
m <- create_motif()["motif"]
apply(m, 2, ppm_to_pcm, nsites = 50)
#######################################################################
## ppm_to_pwm
## Go from a probability type motif to a weight type motif.
m <- create_motif()["motif"]
apply(m, 2, ppm_to_pwm, nsites = 100, bkg = rep(0.25, 4))
#######################################################################
## prob_match, prob_match_bkg
## Calculate probability of a particular match based on background
## frequencies
prob_match(examplemotif, "TATATAT")
## Since this motif has a uniform background, the probability of
## finding any motif hit within the sequence is equal
prob_match(examplemotif, "TATATAG")
m <- examplemotif
m["bkg"] <- c(0.3, 0.2, 0.2, 0.3)
prob_match(m, "TATATAT")
## The prob_match_bkg alternative allows you to simply pass along the
## background frequencies
prob_match_bkg(c(A=0.3, C=0.2, G=0.2, T=0.3), c("TATATAT", "TATATAG"))
#######################################################################
## pwm_to_ppm
## Do the opposite of ppm_to_pwm.
m <- create_motif(type = "PWM")["motif"]
apply(m, 2, pwm_to_ppm, bkg = rep(0.25, 4))
#######################################################################
## 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)
#######################################################################
## round_motif
## Round down letter scores to 0
m <- create_motif()
## Remove letters from positions which are less than 5% of the total
## position:
round_motif(m, pct.tolerance = 0.05)
#######################################################################
## score_match
## Calculate score of a particular match
score_match(examplemotif, "TATATAT")
score_match(examplemotif, "TATATAG")
score_match(examplemotif0, "TATATAT", allow.nonfinite = TRUE)
score_match(examplemotif0, "TATATAG", allow.nonfinite = TRUE)
#######################################################################
## 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))
#######################################################################
## ungap
## Unset motif's gap status. Does not delete actual gap data unless
## delete = TRUE.
m <- create_motif()
m <- add_gap(m, 3, 2, 4)
m <- ungap(m)
# Restore gap data:
m <- add_gap(m)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.