Skip to contents

plotAnansi generates a standard dissociation plot from the output of getAnansi() in the table format. It provides a convenient way to visually assess relevant results from the anansi analysis.

Usage

plotAnansi(x, ...)

plotAnansi(x, ...)

# S4 method for class 'data.frame'
plotAnansi(
  x,
  association.type = NULL,
  model.var = NULL,
  signif.threshold = NULL,
  colour_by = NULL,
  color_by = colour_by,
  fill_by = "group",
  size_by = NULL,
  shape_by = NULL,
  y_position = "right",
  x_lab = "cor",
  y_lab = ""
)

Arguments

x

a data.frame object output of getAnansi() in the table format.

...

additional arguments

association.type

Character scalar. Specifies the type of association to show in the plot. One of "disjointed", "emergent" and "full". (Default: NULL)

model.var

Character scalar. Specifies the name of a variable in the anansi model. It is relevant only when association.type is "disjointed" or "emergent". (Default: NULL)

signif.threshold

Numeric scalar. Specifies the threshold to mark the significance of association.type. (Default: NULL)

colour_by

Character scalar. Specifies one of the groups terms used in the original anansi call, x by which points should be coloured. (Default: NULL)

color_by

Character scalar. Alias to colour_by.

fill_by

Character scalar. Specifies one of the groups terms used in the original anansi call, x by which points should be filled (Default: "group")

size_by

Character scalar. Specifies one of the groups terms used in the original anansi call, x by which points should be sized. (Default: NULL)

shape_by

Character scalar. Specifies one of the groups terms used in the original anansi call, x by which points should be shaped. (Default: NULL)

y_position

Character scalar. Specifies the position of the y labels. It should be either "left" or "right". (Default: "right")

x_lab

Character scalar. Specifies the label of the x axis. (Default: "cor")

y_lab

Character scalar. Specifies the label of the y axis. (Default: "")

Value

A ggplot2 object.

Details

plotAnansi provides a standardised method to visualise the results of anansi by means of a differential association plot. The input for this function should be generated from getAnansi() or anansi(), with return.format = "table"

Examples

# Import libraries
library(mia)
library(TreeSummarizedExperiment)
library(MultiAssayExperiment)

web <- randomWeb(n_samples = 100)
mae <- as(web, "MultiAssayExperiment")

# Perform anansi analysis
out <- getAnansi(mae,
    tableY = "y", tableX = "x",
    formula = ~group_ab
)
#> Fitting least-squares for following model:
#> ~ x + group_ab + x:group_ab 
#> Running correlations for the following groups:
#>  a, b

# Select significant interactions
out <- out[out$full_p.values < 0.05, ]

# Visualise disjointed associations filled by group
plotAnansi(out,
    association.type = "disjointed",
    model.var = "group_ab",
    signif.threshold = 0.05,
    fill_by = "group"
)


# Visualise full associations filled by group
plotAnansi(out,
    association.type = "full",
    signif.threshold = 0.05,
    fill_by = "group"
)