plotauc: Plot AUC Comparison Between Conditions

View source: R/plotauc.R

plotaucR Documentation

Plot AUC Comparison Between Conditions

Description

This function generates scatterplots comparing the area under the curve (AUC) for control and stress conditions, with an option to highlight specific genes or groups. The plot can be saved as a file or displayed interactively.

Usage

plotauc(tab, expdf, genevec = NA, auc_ctrlname = "AUC_ctrl",
auc_stressname = "AUC_HS",
pvalkstestcolname = "adjFDR_p_dAUC_Diff_meanFx_HS_ctrl",
labelx = "AUC in Control", labely = "AUC in Stress", axismin_x = -10,
axismax_x = 100, axismin_y = -10, axismax_y = 100, maintitle = "",
subtitle = "", legendpos = "bottom", formatname = "pdf", outfold = tempdir(),
outfile = "AUCcompare_pval", plottype = "pval", plot = FALSE,
universename = "Universe", groupname = "Group", verbose = TRUE)

Arguments

tab

A data frame containing the AUC values for control and stress conditions, and other columns required for plotting (e.g., p-values or group memberships, see allauc).

expdf

A data frame containing experiment data that should have columns named 'condition', 'replicate', 'strand', and 'path'.

genevec

A vector of gene names to highlight on the plot, applicable when plottype is set to "pval". Default is NA.

auc_ctrlname

The column name in tab for the AUC under control conditions. Default is "AUC_ctrl".

auc_stressname

The column name in tab for the AUC under stress conditions. Default is "AUC_HS".

pvalkstestcolname

The column name in tab for the adjusted FDR p-values from the KS test. Default is "adjFDR_p_dAUC_Diff_meanFx_HS_ctrl".

labelx

Label for the x-axis. Default is "AUC in Control".

labely

Label for the y-axis. Default is "AUC in Stress".

axismin_x

Minimum value for the x-axis. Default is -10.

axismax_x

Maximum value for the x-axis. Default is 100.

axismin_y

Minimum value for the y-axis. Default is -10.

axismax_y

Maximum value for the y-axis. Default is 100.

maintitle

Main title of the plot. Default is an empty string.

subtitle

Subtitle of the plot. Default is an empty string.

legendpos

Position of the legend. Default is "bottom".

formatname

Format of the saved plot (e.g., "pdf", "png"). Default is "pdf".

outfold

Output folder where the plot will be saved. Default is tempdir().

outfile

Name of the output file. Default is "AUCcompare_pval".

plottype

Type of plot to generate. Can be "pval" for p-value based plots or "groups" for group-based plots. Default is "pval".

plot

A logical flag indicating whether to display the plot interactively (TRUE) or save it to a file (FALSE). Default is FALSE.

universename

Column name in tab representing the universe group in group-based plots. Default is "Universe".

groupname

Column name in tab representing specific groups in group-based plots. Default is "Group".

verbose

A logical flag indicating whether to display detailed messages about the function's progress. Default is TRUE.

Details

The function supports two plot types:

  • "pval": The plot highlights genes based on adjusted FDR p-values and can highlight specific genes provided in genevec.

  • "groups": The plot highlights predefined groups, such as "Attenuated" and "Outgroup", within the data.

If plot = TRUE, the plot is displayed interactively. If plot = FALSE, the plot is saved to a file in the specified format and output folder.

Value

A plot comparing AUC values between control and stress conditions, either displayed or saved to a file.

See Also

[allauc]

Examples

exppath <-  system.file("extdata", "exptab.csv", package="tepr")
transpath <- system.file("extdata", "cugusi_6.tsv", package="tepr")
expthres <- 0.1

## Calculating necessary results
expdf <- read.csv(exppath)
transdf <- read.delim(transpath, header = FALSE)
avfilt <- averageandfilterexprs(expdf, transdf, expthres,
       showtime = FALSE, verbose = FALSE)
rescountna <- countna(avfilt, expdf, nbcpu = 1, verbose = FALSE)
ecdf <- genesECDF(avfilt, expdf, verbose = FALSE)
resecdf <- ecdf[[1]]
nbwindows <- ecdf[[2]]
resmeandiff <- meandifference(resecdf, expdf, nbwindows,
   verbose = FALSE)
bytranslistmean <- split(resmeandiff, factor(resmeandiff$transcript))
resknee <- kneeid(bytranslistmean, expdf, verbose = FALSE)
resauc <- allauc(bytranslistmean, expdf, nbwindows, verbose = FALSE)
resatt <- attenuation(resauc, resknee, rescountna, bytranslistmean, expdf,
       resmeandiff, verbose = FALSE)
resug <- universegroup(resatt, expdf, verbose = FALSE)

## Testing plotauc
plotauc(resug, expdf, plottype = "groups", plot = TRUE)


tepr documentation built on June 8, 2025, 10:46 a.m.