An object of class "pcm" represents the position count matrix of a DNA/RNA/amino-acid sequence motif. The entry stores a matrix, which in row i, column j gives the counts of observing nucleotide/or amino acid i in position j of the motif.

methods for pcm objects.

# S4 method for pcm
$(x, name)

# S4 method for pcm,ANY
plot(x, y = "missing", ...)

trimMotif(x, t)

matrixReverseComplement(x)

addBlank(x, n, b)

getIC(x, p)

pcm2pfm(x, background)

pcm2pssm(x, background)

# S4 method for pcm
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

# S4 method for pcm
format(x, ...)

Arguments

x

An object of class pcm. For getIC, if parameter p is followed, x should be an object of matrix. For pcm2pfm, x also could be an object of matrix.

name

slot name of pcm object.

y

Not use.

...

Further potential arguments passed to plotMotifLogo.

t

numeric value of information content threshold for trimming.

n

how many spaces should be added.

b

logical value to indicate where the space should be added.

p

p is the background frequency.

background

a "numeric" vector. The background frequency.

row.names, optional

see as.data.frame

Objects from the Class

Objects can be created by calls of the form new("pcm", mat, name, alphabet, color, background).

Methods

addBlank

signature(x="pcm", n="numeric", b="logical") add space into the position count matrix for alignment. b is a bool value, if TRUE, add space to the 3' end, else add space to the 5' end. n indicates how many spaces should be added.

coerce

signature(from = "pcm", to = "matrix"): convert object pcm to matrix

getIC

signature(x = "pcm",) Calculate information content profile for position frequency matrix.

matrixReverseComplement

signature(x = "pcm") get the reverse complement of position frequency matrix.

plot

signature(x = "pcm") Plots the sequence logo of the position count matrix.

trimMotif

signature(x = "pcm", t= "numeric") trim motif by information content.

$, $<-

Get or set the slot of pcm-class

as.data.frame

convert pcm-class to a data.frame

format

return the name_pcm of pcm-class

Examples

pcm <- read.table(file.path(find.package("motifStack"), "extdata", "bin_SOLEXA.pcm")) pcm <- pcm[,3:ncol(pcm)] rownames(pcm) <- c("A","C","G","T") motif <- new("pcm", mat=as.matrix(pcm), name="bin_SOLEXA") plot(motif)
pcm2pfm(pcm)
#> V3 V4 V5 V6 V7 V8 V9 #> A 0.43258427 0.00000000 1 0.95973783 1 0.00000000 0.95411985 #> C 0.06647940 0.05617978 0 0.02247191 0 0.92977528 0.00000000 #> G 0.47191011 0.00000000 0 0.00000000 0 0.01123596 0.00000000 #> T 0.02902622 0.94382022 0 0.01779026 0 0.05898876 0.04588015
pcm2pssm(pcm)
#> V3 V4 V5 V6 V7 V8 V9 #> A 0.7910522 -18.000000 2 1.940713 2 -18.000000 1.932243 #> C -1.9109575 -2.153800 -18 -3.475728 -18 1.894954 -18.000000 #> G 0.9165836 -18.000000 -18 -18.000000 -18 -4.475728 -18.000000 #> T -3.1065104 1.916584 -18 -3.812790 -18 -2.083410 -2.445991
pcm <- read.table(file.path(find.package("motifStack"), "extdata", "bin_SOLEXA.pcm")) pcm <- pcm[,3:ncol(pcm)] rownames(pcm) <- c("A","C","G","T") motif <- new("pcm", mat=as.matrix(pcm), name="bin_SOLEXA") getIC(motif)
#> V3 V4 V5 V6 V7 V8 V9 #> 0.5575323 1.6879104 2.0000000 1.7166385 2.0000000 1.5886941 1.7313686
matrixReverseComplement(motif)
#> An object of class "pcm" #> Slot "mat": #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] #> A 49 63 0 19 0 1008 31 #> C 0 12 0 0 0 0 504 #> G 0 993 0 24 0 60 71 #> T 1019 0 1068 1025 1068 0 462 #> #> Slot "name": #> [1] "bin_SOLEXA" #> #> Slot "alphabet": #> [1] "DNA" #> #> Slot "color": #> A C G T #> "#00811B" "#2000C7" "#FFB32C" "#D00001" #> #> Slot "background": #> A C G T #> 0.25 0.25 0.25 0.25 #> #> Slot "tags": #> list() #> #> Slot "markers": #> list() #>
as(motif,"matrix")
#> V3 V4 V5 V6 V7 V8 V9 #> A 462 0 1068 1025 1068 0 1019 #> C 71 60 0 24 0 993 0 #> G 504 0 0 0 0 12 0 #> T 31 1008 0 19 0 63 49
pcm2pfm(motif)
#> An object of class "pfm" #> Slot "mat": #> V3 V4 V5 V6 V7 V8 V9 #> A 0.43258427 0.00000000 1 0.95973783 1 0.00000000 0.95411985 #> C 0.06647940 0.05617978 0 0.02247191 0 0.92977528 0.00000000 #> G 0.47191011 0.00000000 0 0.00000000 0 0.01123596 0.00000000 #> T 0.02902622 0.94382022 0 0.01779026 0 0.05898876 0.04588015 #> #> Slot "name": #> [1] "bin_SOLEXA" #> #> Slot "alphabet": #> [1] "DNA" #> #> Slot "color": #> A C G T #> "#00811B" "#2000C7" "#FFB32C" "#D00001" #> #> Slot "background": #> A C G T #> 0.25 0.25 0.25 0.25 #> #> Slot "tags": #> list() #> #> Slot "markers": #> list() #>
#> V3 V4 V5 V6 V7 V8 V9 #> A 462 0 1068 1025 1068 0 1019 #> C 71 60 0 24 0 993 0 #> G 504 0 0 0 0 12 0 #> T 31 1008 0 19 0 63 49
format(motif)
#> [1] "bin_SOLEXA_pcm"