universalmotif-class {universalmotif} | R Documentation

## universalmotif: Motif class.

### Description

Container for motif objects. See `create_motif()` for creating motifs as well as a more detailed description of the slots. For a brief description of available methods, see `examples`.

### Usage

    ## S4 method for signature 'universalmotif'
    x[i]

    ## S4 replacement method for signature 'universalmotif'
    x[i] <- value

    ## S4 method for signature 'universalmotif'
    initialize(.Object, name, altname, family, organism,
      motif, alphabet = "DNA", type, icscore, nsites, pseudocount = 1, bkg,
      bkgsites, consensus, strand = "+-", pval, qval, eval, multifreq, extrainfo,
      gapinfo)

    ## S4 method for signature 'universalmotif'
    show(object)

    ## S4 method for signature 'universalmotif'
    as.data.frame(x)

    ## S4 method for signature 'universalmotif'
    subset(x, select)

    ## S4 method for signature 'universalmotif'
    normalize(object)

    ## S4 method for signature 'universalmotif'
    rowMeans(x)

    ## S4 method for signature 'universalmotif'
    colMeans(x)

    ## S4 method for signature 'universalmotif'
    colSums(x)

    ## S4 method for signature 'universalmotif'
    rowSums(x)

    ## S4 method for signature 'universalmotif'
    nrow(x)

    ## S4 method for signature 'universalmotif'
    ncol(x)

    ## S4 method for signature 'universalmotif'
    colnames(x)

    ## S4 method for signature 'universalmotif'
    rownames(x)

    ## S4 method for signature 'universalmotif'
    cbind(..., deparse.level = 0)

### Arguments

`x` | universalmotif Motif.
`i` | `character` Slot.
`value` | Object to replace slot with.
`.Object` | universalmotif Final motif.
`name` | `character(1)` Motif name.
`altname` | `character(1)` Alternate motif name.
`family` | `character(1)` Transcription factor family.
`organism` | `character(1)` Species of origin.
`motif` | `matrix` Each column represents a position in the motif.
`alphabet` | `character(1)` One of `c('DNA', 'RNA', 'AA')`, or a combined string representing the letters.
`type` | `character(1)` One of `c('PCM', 'PPM', 'PWM', 'ICM')`.
`icscore` | `numeric(1)` Total information content. Automatically generated.
`nsites` | `numeric(1)` Number of sites the motif was constructed from.
`pseudocount` | `numeric(1)` Correction to be applied to prevent `-Inf` from appearing in PWM matrices.
`bkg` | `numeric` A vector of probabilities, each between 0 and 1. If higher order backgrounds are provided, then the elements of the vector must be named.
`bkgsites` | `numeric(1)` Total number of sites used to find the motif.
`consensus` | `character(1)` Consensus string. Automatically generated for 'DNA', 'RNA', and 'AA' alphabets.
`strand` | `character(1)` Whether the motif is specific to a certain strand.
`pval` | `numeric(1)` P-value associated with motif.
`qval` | `numeric(1)` Adjusted P-value associated with motif.
`eval` | `numeric(1)` E-value associated with motif.
`multifreq` | `list` See `add_multifreq()`.
`extrainfo` | `character` Any other extra information, represented as a named character vector.
`gapinfo` | `universalmotif_gapped(1)` Gapped motif information.
`object` | universalmotif Motif.
`select` | `numeric` Columns to keep.
`...` | universalmotif Motifs.
`deparse.level` | Unused.

### Value

A motif object of class universalmotif.

### Slots

`name`

  `character(1)`

`altname`

  `character(1)`

`family`

  `character(1)`

`organism`

  `character(1)`

`motif`

  `matrix`

`alphabet`

  `character(1)`

`type`

  `character(1)`

`icscore`

  `numeric(1)` Generated automatically.

`nsites`

  `numeric(1)`

`pseudocount`

  `numeric(1)`

`bkg`

  `numeric` 0-order probabilities must be provided for all letters.

`bkgsites`

  `numeric(1)`

`consensus`

  `character` Generated automatically.

`strand`

  `character(1)`

`pval`

  `numeric(1)`

`qval`

  `numeric(1)`

`eval`

  `numeric(1)`

`multifreq`

  `list`

`extrainfo`

  `character`

`gapinfo`

  `universalmotif_gapped(1)`

### Author(s)

Benjamin Jean-Marie Tremblay, b2tremblay@uwaterloo.ca

### Examples

    ## [
    ## Access the slots.
    motif <- create_motif()
    motif["motif"]
    # you can also access multiple slots at once, released as a list
    motif[c("motif", "name")]

    ## [<-
    ## Replace the slots.
    motif["name"] <- "new name"
    # some slots are protected
    # motif["consensus"] <- "AAAA"  # not allowed

    ## c
    ## Assemble a list of motifs.
    c(motif, motif)

    ## as.data.frame
    ## Represent a motif as a data.frame. The actual motif matrix is lost.
    ## Necessary for `summarise_motifs`.
    as.data.frame(motif)

    ## subset
    ## Subset a motif matrix by column.
    subset(motif, 3:7)  # extract motif core

    ## normalize
    ## Apply the pseudocount slot (or `1`, if the slot is set to zero) to the
    ## motif matrix.
    motif2 <- create_motif("AAAAA", nsites = 100, pseudocount = 1)
    normalize(motif2)

    ## rowMeans
    ## Calculate motif rowMeans.
    rowMeans(motif)

    ## colMeans
    ## Calculate motif colMeans.
    colMeans(motif)

    ## colSums
    ## Calculate motif colSums
    colSums(motif)

    ## rowSums
    ## Calculate motif rowSums.
    rowSums(motif)

    ## nrow
    ## Count motif rows.
    nrow(motif)

    ## ncol
    ## Count motif columns.
    ncol(motif)

    ## colnames
    ## Get motif colnames.
    colnames(motif)

    ## rownames
    ## Get motif rownames.
    rownames(motif)

    ## cbind
    ## Bind motifs together to create a new motif.
    cbind(motif, motif2)

[Package universalmotif version 1.5.36 Index]