convert_motifs: Convert motif class.

convert_motifsR Documentation

Convert motif class.

Description

Allows for easy transfer of motif information between different classes as 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 needing to be converted beforehand.

Usage

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

## S4 method for signature 'AsIs'
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

Input

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

Output

The following package-class combinations can be output:

  • MotifDb-MotifList

  • TFBSTools-PFMatrix

  • TFBSTools-PWMatrix

  • TFBSTools-ICMatrix

  • TFBSTools-TFFMFirst

  • seqLogo-pwm

  • motifStack-pcm

  • motifStack-pfm

  • PWMEnrich-PWM

  • Biostrings-PWM (type = 'log2prob')

  • rGADEM-motif

  • universalmotif-universalmotif (the default, no need to specify this)

Note: MotifDb-MotifList output was a later addition to convert_motifs(). As a result, to stay consistent with previous behaviour most functions will always convert MotifDb-MotifList objects to a list of universalmotif motifs, even if other formats would be simply returned as is (e.g. for other formats, filter_motifs() will return the input format; for MotifDb-MotifList, a list of universalmotif objects will be returned).

Value

Single motif object or list.

Methods (by class)

  • AsIs: Generate an error to remind users to run to_list() instead of using the column from to_df() directly.

  • 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, benjamin.tremblay@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.

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.

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
}


bjmt/universalmotif documentation built on March 18, 2024, 8:32 a.m.