movViz: movViz generic

movVizR Documentation

movViz generic

Description

movViz(object) is a generic function for plotting PAC distributions of a gene across selected samples.

movViz(PACdataset) plots PAC distributions of a gene across selected samples from a PACdataset object. This function is actually used by many other movViz functions. PACs and conditions can be highlighted, average value will be shown. PAC value can be represented by ratios instead of counts. PACs can be linked by lines to show trend.

movViz(movRes) plots PAC distributions of a gene across selected samples from a movRes object. This function actually calls movViz(PACdataset) for plot.

movViz(movDEGeneRes) plots PAC distributions of a gene across selected samples from a movDEGeneRes object.

movViz(movDEPACRes) plots PAC distributions of a gene across selected samples from a movDEPACRes object. It uses additional options: [padjThd, showAllPA, showRatio].

movViz(movUTRTrendRes) plots PAC distributions of a gene across selected samples from a movUTRTrendRes object. The gene is not neccesary a significant gene, but just plot the gene.

movViz(movAPASwitchRes) plots PAC distributions of a gene across selected samples from a movAPASwitchRes object. Same as movViz(movUTRTrendRes).

Usage

movViz(object, ...)

## S4 method for signature 'PACdataset'
movViz(
  object,
  gene,
  txdb = NULL,
  group,
  conds = NULL,
  avg = FALSE,
  pool = FALSE,
  clearPAT = 0,
  showRatio = FALSE,
  linkPAs = FALSE,
  highlightConds = NULL,
  highlightPAs = NULL,
  collapseConds = FALSE,
  otrack = TRUE,
  geneHeight = 0.2,
  trackOrder = NULL,
  simple = FALSE,
  ylimits = c(NA, NA),
  showYaxis = TRUE,
  showBox = FALSE,
  boxWidth = 20,
  title = NULL
)

## S4 method for signature 'movRes'
movViz(
  object,
  gene,
  txdb = NULL,
  PACds,
  conds = NULL,
  avg = FALSE,
  pool = FALSE,
  clearPAT = 0,
  showRatio = FALSE,
  linkPAs = FALSE,
  highlightConds = NULL,
  collapseConds = FALSE
)

## S4 method for signature 'movDEGeneRes'
movViz(
  object,
  gene,
  txdb = NULL,
  PACds,
  conds = NULL,
  avg = FALSE,
  pool = FALSE,
  clearPAT = 0,
  padjThd = NULL,
  highlightConds = NULL,
  collapseConds = FALSE,
  showPV = TRUE
)

## S4 method for signature 'movDEPACRes'
movViz(
  object,
  gene,
  txdb = NULL,
  PACds,
  conds = NULL,
  avg = FALSE,
  pool = FALSE,
  clearPAT = 0,
  padjThd = NULL,
  highlightConds = NULL,
  collapseConds = FALSE,
  showPV = TRUE,
  showAllPA = TRUE,
  showRatio = FALSE
)

## S4 method for signature 'movUTRTrendRes'
movViz(
  object,
  gene,
  txdb = NULL,
  PACds,
  conds = NULL,
  avg = FALSE,
  pool = FALSE,
  clearPAT = 0,
  padjThd = NULL,
  highlightConds = NULL,
  collapseConds = FALSE,
  showPV = TRUE,
  showAllPA = TRUE,
  showRatio = FALSE,
  linkPAs = FALSE
)

## S4 method for signature 'movAPASwitchRes'
movViz(
  object,
  gene,
  txdb = NULL,
  PACds,
  conds = NULL,
  avg = FALSE,
  pool = FALSE,
  clearPAT = 0,
  padjThd = NULL,
  highlightConds = NULL,
  collapseConds = FALSE,
  showPV = TRUE,
  showAllPA = TRUE,
  showRatio = FALSE,
  linkPAs = TRUE
)

Arguments

object

a movRes or PACdataset object.

...

Dot arguments passing to other functions.

gene

a gene to plot.

txdb

GFF annotation, a character of file name for .gff3 or .rda, or a list. See parseGenomeAnnotation().

group

same as 'group' in subsetPACds.

conds

a data frame of (cond1 cond2), specifying the conditions to plot.

avg

used to subset PACds.

pool

used to subset PACds.

clearPAT

used to subset PACds.

showRatio

If TRUE then show PAC ratio instead of PAC count.

linkPAs

If TRUE, then plot lines to links PACs from the same sample.

highlightConds

a two column data frame, denoting the highlight condtions. Only used when collapseConds=TRUE.

highlightPAs

the PAids to be highlighted in the plot.

collapseConds

If TRUE, then collapse conds to one track, particularly useful for switching plot. If FALSE, then each condition is one track.

otrack

if FALSE, then return a list of plots otherwise return Tracks. Normally used for calling other movViz functions.

geneHeight

default is 0.2. Set height ratio for the gene model track, the height of other data tracks are of the same height ratio: 1-geneHeight.

trackOrder

a character vector to set the order of (part of) data tracks, which is useful to put some conditions at the top of the plot. For example, if there are four tracks: condA, condB, condC, condD, when trackOrder=c('condC','CondB'), then the C and B tracks will be shown fist, followed by other tracks (not ordered).

simple

if TRUE, then plot minimum elements: bar for avg; all tracks with the same Y limits; white background without grids.

ylimits

default is c(NA,NA), set manual range for Y axis. This is applied for all tracks, and both values should be set.

showYaxis

only valid when simple=TRUE. If showYaxis=FALSE, then do not show Y axis ticks, text, and line, and change X-axis color to grey. parameters simple, ylimits, and showYaxis are particularly useful for controlling the plot of many conditions (e.g., single cell data) with collapseConds=FALSE.

showBox

only valid when simple=TRUE; if simple=TRUE and showBox=TRUE, then show avg expression level of each PA as colored rectangle. The width of rectangle can be UPA_start~UPA_end or setted boxWidth.

boxWidth

default is 20. When showBox=TRUE, boxwidth sets the width of the rectangle. If boxWidth=NA and UPA_start/_end are in PACds@anno, then will use PAC range as xmin and xmax of the rectangle. If boxWidth=NA and UPA_start/_end are not in PACds@anno, then will set boxWidth=20.

title

add title to the plot at the top-left of the gene model track. If null, then no title.

PACds

A PACdataset.

padjThd

for object of movDEPACRes, if a PAC's padj<padjThd then highlight or only show (if showAllPA=FALSE) the PACs.

showPV

show gene's pvalue in the left-top of the track. Only shown when collapse=TRUE, and it is irrelevent with padjThd.

showAllPA

If TRUE, then show all PACs including non-DE ones. Otherwise only show DEPACs with padj<padjThd.

Details

movViz(movDEPACRes) is Similar to movViz(DEGene), but can control PACs. Use padjThd to filter DEPACs and highlight DEPACs. All DEPACs's pvalue and logFC of a condpair are shown on the track.

Value

A list or ggbio's Tracks. If PACds is empty, return NULL. The first track is the gene model track and the height can be set by the geneHeight parameter. If txdb is provided, then all transcripts in the gene model are plot. If there are only intergenic PACs, then plot the intergenic; otherwise will remove intergenic PACs and only retain genomic PACs.

A ggbio's Tracks.

Methods (by class)

  • movViz(PACdataset): for a movRes object.

  • movViz(movRes): for a movRes object.

  • movViz(movDEGeneRes): for a movRes object.

  • movViz(movDEPACRes): for a movDEPACRes object.

  • movViz(movUTRTrendRes): for a movUTRTrendRes object.

  • movViz(movAPASwitchRes): for movAPASwitchRes and movUTRTrendRes object.

See Also

Other visualization functions: outputHeatStat(), plotHeatmap()

Examples

## Not run: 
data(PACds)
load('Oryza_sativa.IRGSP-1.0.42.gff.rda')

## Visualize gene with PACs ##
gene='Os05g0451900'
PACds[PACds@anno$gene==gene, ]@anno
movViz(object=PACds, gene=gene, txdb=NULL, group='group', geneHeight=0.1)
movViz(object=PACds, gene=gene, txdb=gff, group='group', geneHeight=0.1)

## Visualize gene with DE PACs ##
## Detect DE PACs using chisq-PACdsPAS method.
DEqPAC=movDEPAC(PACds, method='chisq', group='group', minSumPAT=20)
## Visualize PACs of this gene in individual conditions.
## Here the Y-axis is read count, the scale of which is different among conditions.
movViz(object=DEqPAC, gene=gene, txdb=gff, PACds=PACds, conds=NULL)
movViz(object=DEqPAC, gene=gene, txdb=NULL, PACds=PACds, conds=NULL)

## Only show DE PACs with padj<padjThd.
movViz(object=DEPAC, gene=gene, txdb=gff, PACds=PACds, collapseConds=FALSE, padjThd=0.01,
       showRatio=FALSE, showAllPA=TRUE)

## Show condition pairs in individual tracks.
## If padjThd is given, then the DE PACs (padj<padjThd) will be highlighted (dashed yellow line).
movViz(object=DEqPAC, gene=gene, txdb=NULL, PACds=PACds,
       collapseConds=TRUE, padjThd=0.01, showRatio=T)
movViz(object=DEXPAC, gene=gene, txdb=gff, PACds=PACds,
       collapseConds=TRUE, padjThd=0.01, showPV=TRUE, showAllPA=TRUE)
movViz(object=DEPAC, gene=gene, txdb=gff, PACds=PACds,
     collapseConds=TRUE, padjThd=0.01, showPV=TRUE, showAllPA=TRUE, showRatio=F)

movViz(object=DEPAC, gene=gene, txdb=gff, PACds=PACds, collapseConds=TRUE,
       padjThd=0.01, showPV=TRUE, showAllPA=FALSE, showRatio=F,
       conds=DEPAC@conds[c(1,3), ], highlightConds=DEPAC@conds[c(3), ], )

## End(Not run)


## Visualize DE gene
## First get DE gene results.
DEgene=movDEGene(PACds=PACds, method='DESeq2', group='group', minSumPAT=10, norm=TRUE)
gene=rownames(DEgene@pairwise$padj[order(DEgene@pairwise$padj[,1]), ,drop=F])[1]
DEgene@pairwise$padj[gene, ]

## Show a DE gene without gene model.
movViz(object=DEgene, gene=gene, txdb=NULL, PACds=PACds)
## Show a DE gene with the gene model.
movViz(object=DEgene, gene=gene, txdb=gff, PACds=PACds)

## Show each condition pair in one track and show the pvalues.
movViz(object=DEgene, gene=gene, txdb=NULL, PACds=PACds, collapseConds=TRUE)
movViz(object=DEgene, gene=gene, txdb=NULL, PACds=PACds, collapseConds=TRUE, showPV=FALSE)

## Highlight specific conditions in blue.
movViz(object=DEgene, gene=gene, txdb=NULL, PACds=PACds,
     collapseConds=TRUE, conds=DEgene@conds[1:3, ], highlightConds=DEgene@conds[2, ])
## Highlight conditions with padj<0.01.
movViz(object=DEgene, gene=gene, txdb=NULL, PACds=PACds, collapseConds=TRUE, padjThd=0.01)


BMILAB/movAPA documentation built on Jan. 3, 2024, 11:09 p.m.