plotMotifs {circRNAprofiler} | R Documentation

## Plot motifs analysis results

### Description

The function plotMotifs() generates 2 bar charts showing the log2FC and the number of occurences of each motif found in the target sequences (e.g detected Vs randomly selected).

### Usage

    plotMotifs(mergedMotifsFTS, mergedMotifsBTS, log2FC = 1, nf1 = 1,
      nf2 = 1, df1Name = "foreground", df2Name = "background")

### Arguments

`mergedMotifsFTS` | A data frame containing the number of occurences of each motif found in foreground target sequences (e.g from detected back-spliced junctions). It can be generated with the `mergeMotifs`.
`mergedMotifsBTS` | A data frame containing the number of occurences of each motif found in the background target sequences (e.g. from random back-spliced junctions). It can be generated with the `mergeMotifs`.
`log2FC` | An integer specifying the log2FC cut-off. Default value is 1.
`nf1` | An integer specifying the normalization factor for the first data frame mergedMotifsFTS. The occurrences of each motif are divided by nf1. The normalized values are then used for fold-change calculation. Set this to the number of target sequences (e.g from detected back-spliced junctions) where the motifs were extracted from. Default value is 1.
`nf2` | An integer specifying the normalization factor for the second data frame mergedMotifsBTS. The occurrences of each motif are divided by nf2. The normalized values are then used for fold-change calculation. Set this to the number of target sequences (e.g from random back-spliced junctions) where the motifs were extracted from. Default value is 1. NOTE: By setting nf1 and nf2 equals to 1 the number of target sequences (e.g detected Vs randomly selected) where the motifs were extrated from, is supposed to be the same.
`df1Name` | A string specifying the name of the first data frame. This will be displayed in the legend of the plot. Deafult value is "foreground".
`df2Name` | A string specifying the name of the first data frame. This will be displayed in the legend of the plot. Deafult value is "background".

### Value

A ggplot object.

### Examples

    # Load data frame containing detected back-spliced junctions
    data("mergedBSJunctions")

    # Load short version of the gencode v19 annotation file
    data("gtf")

    # Annotate the first back-spliced junctions
    annotatedFBSJs <- annotateBSJs(mergedBSJunctions[1, ], gtf)

    # Get random back-spliced junctions
    randomBSJunctions <- getRandomBSJunctions(gtf, n = 1, f = 10)

    # Annotate random back-spliced junctions
    annotatedBBSJs <- annotateBSJs(randomBSJunctions, gtf, isRandom = TRUE)

    # Get genome
    genome <- BSgenome::getBSgenome("BSgenome.Hsapiens.UCSC.hg19")

    # Retrieve target sequences from detected back-spliced junctions
    targetsFTS <- getSeqsFromGRs(
       annotatedFBSJs,
       genome,
       lIntron = 200,
       lExon = 10,
       type = "ie"
       )

    # Retrieve target sequences from random back-spliced junctions
    targetsBTS <- getSeqsFromGRs(
       annotatedBBSJs,
       genome,
       lIntron = 200,
       lExon = 10,
       type = "ie"
       )

    # Get motifs
     motifsFTS <- getMotifs(
         targetsFTS,
         width = 6,
         species = "Hsapiens",
         rbp = TRUE,
         reverse = FALSE)

    motifsBTS <- getMotifs(
         targetsBTS,
         width = 6,
         species = "Hsapiens",
         rbp = TRUE,
         reverse = FALSE)

    # Merge motifs
     mergedMotifsFTS <- mergeMotifs(motifsFTS)
     mergedMotifsBTS <- mergeMotifs(motifsBTS)

    # Plot
     p <- plotMotifs(
         mergedMotifsFTS,
         mergedMotifsBTS,
         log2FC = 2,
         nf1 = nrow(annotatedFBSJs),
         nf2 = nrow(annotatedBBSJs),
         df1Name = "foreground",
         df2Name = "background")

[Package circRNAprofiler version 1.1.0 Index]