Learn R Programming

motifStack (version 1.16.2)

motifCloud: plot a DNA sequence logo cloud

Description

Plot a DNA sequence logo cloud

Usage

motifCloud(motifSig, rcpostfix="(RC)", 
           layout=c("rectangles", "cloud", "tree"), 
           scale=c(6, .5), rot.per=.1,
           draw.box=TRUE, draw.freq=TRUE, 
           box.col="gray", freq.col="gray",
           group.col=NULL, groups=NULL, draw.legend=FALSE, 
           font="Helvetica-Bold", ic.scale=TRUE, fontsize=12)

Arguments

motifSig
an object of class motifSig
rcpostfix
postfix for reverse-complement motif names, default: (RC)
layout
layout of the logo cloud, rectangles, cloud or tree
scale
A vector of length 2 indicating the range of the size of the sequence logo.
rot.per
proportion sequence logo with 90 degree rotation. Only work for "cloud" layout
draw.box
draw box for each sequence logo or not
draw.freq
label frequency of each signature or not
box.col
color of box for each sequence logo
freq.col
color of frequency label
group.col
color setting for groups
groups
a named vectors of motif groups
draw.legend
draw group color legend or not
font
font of logo
ic.scale
logical If TRUE, the height of each column is proportional to its information content. Otherwise, all columns have the same height.
fontsize
font size of the template for grImport, default 12. Higher value make better quality figure, but also increase the file size.

Value

  • none

Examples

Run this code
if(interactive()){
    library("MotifDb")
    matrix.fly <- query(MotifDb, "Dmelanogaster")
    motifs <- as.list(matrix.fly)
    motifs <- motifs[grepl("Dmelanogaster-FlyFactorSurvey-", names(motifs), fixed=TRUE)]
    names(motifs) <- gsub("Dmelanogaster_FlyFactorSurvey_", "", 
                gsub("_FBgn[0-9]+$", "", 
                  gsub("[^a-zA-Z0-9]","_", 
                     gsub("(_[0-9]+)+$", "", names(motifs)))))
    motifs <- motifs[unique(names(motifs))]
    pfms <- sample(motifs, 50)
    jaspar.scores <- MotIV::readDBScores(file.path(find.package("MotIV"), 
                                    "extdata", "jaspar2010_PCC_SWU.scores"))
    d <- MotIV::motifDistances(lapply(pfms, pfm2pwm))
    hc <- MotIV::motifHclust(d, method="average")
    phylog <- hclust2phylog(hc)
    leaves <- names(phylog$leaves)
    pfms <- pfms[leaves]
    pfms <- lapply(names(pfms), function(.ele, pfms){new("pfm",mat=pfms[[.ele]], 
                                                     name=.ele)},pfms)
    motifSig <- motifSignature(pfms, phylog, groupDistance=0.1)
    motifCloud(motifSig)
  }

Run the code above in your browser using DataLab