SFfigure {SigFuge} | R Documentation

## Plot expression as curves

### Description

Function for producing various figures corresponding to the SigFuge functional data approach to studying RNA-seq data as expression curves along base positions. The primary input for the function is a read count matrix and `GRanges`. The default behavior is to identify clusters based on applying `SFlabels` to a normalized version of the data produced by `SFnormalize`. If specified, the function will compute a p-value for the significance of the labels by calling the `SFpval` function.

### Usage

      SFfigure(data, locusname, annot = c(), flip.fig = 1,
               label.exon = 1, print.n = 1, data.labels = 0,
               label.colors = c(), flag = 1, lplots = 2,
               log10 = 1, summary.type = "median",
               savestr = c(), titlestr = c(), pval = 1)

### Arguments

`data` | a d x n matrix or data.frame of read counts at d base positions for n samples.
`locusname` | a character string specifying gene or locus name to be used in figure title.
`annot` | a `GRanges` object or `data.frame` including annotation information for locus, including: `start` start of contiguous genomic regions `end` end of contiguous genomic regions `seqname` chromosome name for genomic region `strand` strandedness of sequence
`flip.fig` | an indicator whether to flip the plotting direction of the locus if `strand == "-"` when annotation information is provided.
`label.exon` | an indicator whether to print the exon boundaries to the figure.
`print.n` | an indicator whether to print cluster sizes.
`data.labels` | a n x 1 vector of class labels to use instead of calcuating SigFuge labels
`label.colors` | a K x 3 matrix of RBG colors specifying cluster colors for K clusters. `ggplot2` default colors are used if not specified. If using SigFuge default labels, K=3 even if no low expression samples are flagged.
`flag` | a n x 1 logical vector of samples flagged as low expression. If `flag == 1`, default low expression cutoffs are used. If `flag == 0`, no samples are flagged as low expression (equivalent to setting flag = rep(0, n)).
`lplots` | a specification of which figures to output `1`: curves in single panel, random colors `2`: curves in single panel, colored by cluster `3`: curves in K panels, separated and colored by cluster `4`: curves in n panels, colored by cluster (single sample per panel) `5`: cluster medians in single panel, colored by cluster
`log10` | an indicator whether the y-axis (read depth) should be log10 transformed. Default is to plot on log-scale.
`summary.type` | a character string specifying which summary statistic should be used when plotting clusters in lplots == 2, 3, and 5. Options: "median" (default) or "mean".
`savestr` | a string specifying the file name for resulting figures. Extensions can also be specified in `savestr`. If no extension is specified figures will be saved as pdfs. If `length(lplots) > 1`, figures will be saved as `paste0(savestr,"_x")` for `x` in `lplots` with the appropirate extension. If no `savestr` is specified, function will return a list containing the created `ggplot` objects.
`titlestr` | a string specifying figure title. If unspecified, default is `titlestr=``paste(locusname," locus, SigFuge analysis")`.
`pval` | an indicator whether the `SFpval` should be computed. If `pval == 1`, the p-value is added to the title, i.e. (`titlestr=paste0(titlestr, ", p-value = ", p)`).

### Value

`SFfigure` returns a figure that is saved to the current working directory if a `savestr` is specified. Else, a list containing the plots is returned.

### Author(s)

Patrick Kimes <pkimes@live.unc.edu>

### Examples

    # load data
    data(geneAnnot)
    data(geneDepth)

    # only use first 50 samples
    mdata <- geneDepth[,1:50]

    # make plot
    locusname <- "CDKN2A"
    SFfigure(mdata, locusname, geneAnnot, flag=1,
     lplots=3, savestr=paste0(locusname,".pdf"), titlestr="CDKN2A locus, LUSC samples",
     pval=1)

    mySFs <- SFfigure(mdata, locusname, geneAnnot, flag=1,
                lplots=1, savestr=c(), titlestr="CDKN2A locus, LUSC samples not saved",
                pval=0)
    mySFs$plot1

[Package SigFuge version 1.24.0 Index]