convert_motifs {universalmotif} | R Documentation

## Convert motif class.

### Description

Allows for easy transfer of motif information between different classes defined by other Bioconductor packages. This function is also used by nearly all other functions in this package; so any motifs of a compatible class can be used without needed to convert beforehand.

### Usage

    convert_motifs(motifs, class = "universalmotif-universalmotif")

    ## S4 method for signature 'list'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'universalmotif'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'MotifList'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'TFFMFirst'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'PFMatrix'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'PWMatrix'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'ICMatrix'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'XMatrixList'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'pwm'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'pcm'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'pfm'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'PWM'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'Motif'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

    ## S4 method for signature 'matrix'
    convert_motifs(motifs,
      class = "universalmotif-universalmotif")

### Arguments

`motifs` | Single motif object or list. See details.
`class` | `character(1)` Desired motif class. Input as 'package-class'. If left empty, defaults to 'universalmotif-universalmotif'. (See details.)

### Details

The following packge-class combinations can be used as input:

- MotifDb-MotifList

- TFBSTools-PFMatrix

- TFBSTools-PWMatrix

- TFBSTools-ICMatrix

- TFBSTools-PFMatrixList

- TFBSTools-PWMatrixList

- TFBSTools-ICMatrixList

- TFBSTools-TFFMFirst

- seqLogo-pwm

- motifStack-pcm

- motifStack-pfm

- PWMEnrich-PWM

- motifRG-Motif

- universalmotif-universalmotif

- matrix

The following package-class combinations can be output:

- MotIV-pwm2

- TFBSTools-PFMatrix

- TFBSTools-PWMatrix

- TFBSTools-ICMatrix

- TFBSTools-TFFMFirst

- seqLogo-pwm

- motifStack-pcm

- motifStack-pfm

- PWMEnrich-PWM

- Biostrings-PWM (`type = 'log2prob'`)

- rGADEM-motif

- universalmotif-universalmotif

### Value

Single motif object or list.

### Methods (by class)

- `list`: Convert a list of motifs.

- `universalmotif`: Convert a universalmotif object.

- `MotifList`: Convert MotifList motifs. (MotifDb)

- `TFFMFirst`: Convert TFFMFirst motifs. (TFBSTools)

- `PFMatrix`: Convert PFMatrix motifs. (TFBSTools)

- `PWMatrix`: Convert PWMatrix motifs. (TFBSTools)

- `ICMatrix`: Convert ICMatrix motifs. (TFBSTools)

- `XMatrixList`: Convert XMatrixList motifs. (TFBSTools)

- `pwm`: Convert pwm motifs. (seqLogo)

- `pcm`: Convert pcm motifs. (motifStack)

- `pfm`: Convert pfm motifs. (motifStack)

- `PWM`: Convert PWM motifs. (PWMEnrich)

- `Motif`: Convert Motif motifs. (motifRG)

- `matrix`: Create motif from matrices.

### Author(s)

Benjamin Jean-Marie Tremblay, b2tremblay@uwaterloo.ca

### References

Bembom O (2018). seqLogo: Sequence logos for DNA sequence alignments. R package version 1.46.0.

Droit A, Gottardo R, Robertson G, Li L (2014). rGADEM: de novo motif discovery. R package version 2.28.0.

Mercier E, Gottardo R (2014). MotIV: Motif Identification and Validation. R package version 1.36.0.

Ou J, Wolfe SA, Brodsky MH, Zhu LJ (2018). “motifStack for the analysis of transcription factor binding site evolution.” Nature Methods, 15, 8-9. doi: 10.1038/nmeth.4555, http://dx.doi.org/10.1038/nmeth.4555.

Shannon P, Richards M (2018). MotifDb: An Annotated Collection of Protein-DNA Binding Sequence Motifs. R package version 1.22.0.

Stojnic R, Diez D (2015). PWMEnrich: PWM enrichment analysis. R package version 4.16.0.

Tan G, Lenhard B (2016). “TFBSTools: an R/Bioconductor package for transcription factor binding site analysis.” Bioinformatics, 32, 1555-1556. doi: 10.1093/bioinformatics/btw024, http://bioinformatics.oxfordjournals.org/content/32/10/1555.

Yao Z (2012). motifRG: A package for discriminative motif discovery, designed for high throughput sequencing dataset. R package version 1.24.0.

### Examples

    # convert from universalmotif:
    jaspar <- read_jaspar(system.file("extdata", "jaspar.txt",
                                      package = "universalmotif"))
    if (requireNamespace("motifStack", quietly = TRUE)) {
      jaspar.motifstack.pfm <- convert_motifs(jaspar, "motifStack-pfm")
    }

    # convert from another class to universalmotif:
    if (requireNamespace("TFBSTools", quietly = TRUE)) {
    library(TFBSTools)
    data(MA0003.2)
    motif <- convert_motifs(MA0003.2)

    # convert from another class to another class
    if (requireNamespace("PWMEnrich", quietly = TRUE)) {
      motif <- convert_motifs(MA0003.2, "PWMEnrich-PWM")
    }

    # the 'convert_motifs' function is embedded in the rest of the universalmotif
    # functions; non-universalmotif class motifs can be used
    MA0003.2.trimmed <- trim_motifs(MA0003.2)
    # note: if the motif object going in has information that the
    # 'universalmotif' class can't hold, it will be lost
    }

[Package universalmotif version 1.4.10 Index]