create_motif | R Documentation |
Create a motif from a set of sequences, a matrix, or generate a random motif. See the "Motif import, export and manipulation" vignette for details.
create_motif(input, alphabet, type = "PPM", name = "motif",
pseudocount = 0, bkg, nsites, altname, family, organism, bkgsites, strand,
pval, qval, eval, extrainfo, add.multifreq)
## S4 method for signature 'missing'
create_motif(input, alphabet, type = "PPM",
name = "motif", pseudocount = 0, bkg, nsites, altname, family, organism,
bkgsites, strand, pval, qval, eval, extrainfo, add.multifreq)
## S4 method for signature 'numeric'
create_motif(input, alphabet, type = "PPM",
name = "motif", pseudocount = 0, bkg, nsites, altname, family, organism,
bkgsites, strand, pval, qval, eval, extrainfo, add.multifreq)
## S4 method for signature 'character'
create_motif(input, alphabet, type = "PPM",
name = "motif", pseudocount = 0, bkg, nsites, altname, family, organism,
bkgsites, strand, pval, qval, eval, extrainfo, add.multifreq)
## S4 method for signature 'matrix'
create_motif(input, alphabet, type = "PPM",
name = "motif", pseudocount = 0, bkg, nsites, altname, family, organism,
bkgsites, strand, pval, qval, eval, extrainfo, add.multifreq)
## S4 method for signature 'DNAStringSet'
create_motif(input, alphabet, type = "PPM",
name = "motif", pseudocount = 0, bkg, nsites, altname, family, organism,
bkgsites, strand, pval, qval, eval, extrainfo, add.multifreq)
## S4 method for signature 'RNAStringSet'
create_motif(input, alphabet, type = "PPM",
name = "motif", pseudocount = 0, bkg, nsites, altname, family, organism,
bkgsites, strand, pval, qval, eval, extrainfo, add.multifreq)
## S4 method for signature 'AAStringSet'
create_motif(input, alphabet, type = "PPM",
name = "motif", pseudocount = 0, bkg, nsites, altname, family, organism,
bkgsites, strand, pval, qval, eval, extrainfo, add.multifreq)
## S4 method for signature 'BStringSet'
create_motif(input, alphabet, type = "PPM",
name = "motif", pseudocount = 0, bkg, nsites, altname, family, organism,
bkgsites, strand, pval, qval, eval, extrainfo, add.multifreq)
input |
|
alphabet |
|
type |
|
name |
|
pseudocount |
|
bkg |
|
nsites |
|
altname |
|
family |
|
organism |
|
bkgsites |
|
strand |
|
pval |
|
qval |
|
eval |
|
extrainfo |
|
add.multifreq |
|
The aim of this function is provide an easy interface to creating
universalmotif motifs, as an alternative to the
default class constructor (i.e. new('universalmotif', name=...)
).
See examples for potential use cases.
Note: when generating random motifs, the nsites
slot is also given a
random value.
See the examples
section for more info on motif creation.
universalmotif object.
missing
: Create a random motif of length 10.
numeric
: Create a random motif with a specified length.
character
: Create motif from a consensus string.
matrix
: Create motif from a matrix.
DNAStringSet
: Create motif from a DNAStringSet
.
RNAStringSet
: Create motif from a RNAStringSet
.
AAStringSet
: Create motif from a AAStringSet
.
BStringSet
: Create motif from a BStringSet
.
Benjamin Jean-Marie Tremblay, benjamin.tremblay@uwaterloo.ca
convert_type()
, add_multifreq()
, create_sequences()
,
shuffle_motifs()
.
##### create motifs from a single string
# Motif is by default generated as a PPM: change final type as desired
DNA.motif <- create_motif("TATAWAW")
DNA.motif <- create_motif("TATAWAW", type = "PCM")
# Nsites will be set to the number of input sequences unless specified or
# a single string is used as input
DNA.motif <- create_motif("TTTTTTT", nsites = 10)
# Ambiguity letters can be used:
DNA.motif <- create_motif("TATAWAW")
DNA.motif <- create_motif("NNVVWWAAWWDDN")
# Be careful about setting nsites when using ambiguity letters!
DNA.motif <- create_motif("NNVVWWAAWWDDN", nsites = 1)
RNA.motif <- create_motif("UUUCCG")
# 'create_motif' will try to detect the alphabet type; this can be
# unreliable for AA and custom alphabets as DNA and RNA alphabets are
# detected first
AA.motif <- create_motif("AVLK", alphabet = "AA")
custom.motif <- create_motif("QWER", alphabet = "QWER")
# Specify custom alphabet
custom.motif <- create_motif("QWER", alphabet = "QWERASDF")
###### Create motifs from multiple strings of equal length
DNA.motif <- create_motif(c("TTTT", "AAAA", "AACC", "TTGG"), type = "PPM")
DNA.motif <- create_motif(c("TTTT", "AAAA", "AACC", "TTGG"), nsites = 20)
RNA.motif <- create_motif(c("UUUU", "AAAA", "AACC", "UUGG"), type = "PWM")
AA.motif <- create_motif(c("ARNDCQ", "EGHILK", "ARNDCQ"), alphabet = "AA")
custom.motif <- create_motif(c("POIU", "LKJH", "POIU", "CVBN"),
alphabet = "POIULKJHCVBN")
# Ambiguity letters are only allowed for single consensus strings: the
# following fails
## Not run:
create_motif(c("WWTT", "CCGG"))
create_motif(c("XXXX", "XXXX"), alphabet = "AA")
## End(Not run)
##### Create motifs from XStringSet objects
library(Biostrings)
DNA.set <- DNAStringSet(c("TTTT", "AAAA", "AACC", "TTGG"))
DNA.motif <- create_motif(DNA.set)
RNA.set <- RNAStringSet(c("UUUU", "AACC", "UUCC"))
RNA.motif <- create_motif(RNA.set)
AA.set <- AAStringSet(c("VVVLLL", "AAAIII"))
AA.motif <- create_motif(AA.set)
# Custom motifs can be created from BStringSet objects
B.set <- BStringSet(c("QWER", "ASDF", "ZXCV", "TYUI"))
custom.motif <- create_motif(B.set)
##### Create motifs with filled 'multifreq' slot
DNA.motif.k2 <- create_motif(DNA.set, add.multifreq = 2)
##### Create motifs from matrices
mat <- matrix(c(1, 1, 1, 1,
2, 0, 2, 0,
0, 2, 0, 2,
0, 0, 0, 0),
nrow = 4, byrow = TRUE)
DNA.motif <- create_motif(mat, alphabet = "DNA")
RNA.motif <- create_motif(mat, alphabet = "RNA", nsites = 20)
custom.motif <- create_motif(mat, alphabet = "QWER")
# Specify custom alphabet
custom.motif <- create_motif(mat, alphabet = "QWER")
# Alphabet can be detected from rownames
rownames(mat) <- DNA_BASES
DNA.motif <- create_motif(mat)
rownames(mat) <- c("Q", "W", "E", "R")
custom.motif <- create_motif(mat)
# Matrices can also be used as input
mat.ppm <- matrix(c(0.1, 0.1, 0.1, 0.1,
0.5, 0.5, 0.5, 0.5,
0.1, 0.1, 0.1, 0.1,
0.3, 0.3, 0.3, 0.3),
nrow = 4, byrow = TRUE)
DNA.motif <- create_motif(mat.ppm, alphabet = "DNA", type = "PPM")
##### Create random motifs
# These are generated as PPMs with 10 positions
DNA.motif <- create_motif()
RNA.motif <- create_motif(alphabet = "RNA")
AA.motif <- create_motif(alphabet = "AA")
custom.motif <- create_motif(alphabet = "QWER")
# The number of positions can be specified
DNA.motif <- create_motif(5)
# If the background frequencies are not provided, they are generated
# using `rpois`; positions are created using `rdirichlet(1, bkg)`.
# (calling `create_motif()` creates motifs with an average
# positional IC of 1)
DNA.motif <- create_motif(bkg = c(0.3, 0.2, 0.2, 0.3))
DNA.motif <- create_motif(10, bkg = c(0.1, 0.4, 0.4, 0.1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.