ap_agresults: Reactivity result plots

View source: R/ch_functions.R

ap_agresultsR Documentation

Reactivity result plots

Description

Plot beeswarm, density and frequency plots for each antigen. Based on output from Autoimmunity Profiling wrapper function ap_norm2().

Usage

ap_agresults(
  x,
  samplegroups = NULL,
  groupcolors = 2:6,
  agtoplot = NULL,
  percdec = 1,
  cofisher = 0.05,
  shouldpdf = TRUE,
  filename = "AntigenResults.pdf",
  height = 18,
  useDingbats = FALSE,
  check.names = FALSE
)

Arguments

x

list with at least nine elements, see Deatils for naming and content.

samplegroups

factor vector of groupings. NB! Do not include . (period) in names. Only samples with an assigned level are included in plots. If left as NULL (default), then all non-filtered if filtering has been done, otherwise all, will be assigned "Sample". Passed to ap_reactsummary2() to calculate frequencies.

groupcolors

A matrix or data.frame with a column named "group" with group names and a column named "color" with a color for each group (one row per group, ie. factor level). Alternatively, a vector with colors (will be assigned to the factor levels in order).

agtoplot

indices for which antigens to plot, default is all. Character vector with column names of what to plot also ok.

percdec

integer indicating the number of decimal places in percentage value.

cofisher

Cutoff in fisher plot.

shouldpdf

Logical, should it plot to pdf?

filename

string with filename and desired path, end with .pdf

height

height for pdf, see pdf().

useDingbats

logical, altered default from pdf().

check.names

logical, altered default from data.frame().

Details

the x list needs to include at least the element

MADs = assay MADs,

SCORE = scored data

BINARY = list with one data.frame per cutoff,

BINARY_CO = binary table based on antigen specific cutoffs.

ANTIGEN_CUTOFFS = calculated antigen specific cutoffs, translated into the descrete cutoff steps,

CUTOFF_KEY = cutoff key as data.frame with cutoff values, scores and colors.

SAMPLES = sample info. Including column "sample_name" with sample names, preferably LIMS-IDs, where replicates (named with one of pool|rep|mix|commercial) and blanks (named with one of empty|blank|buffer) are also stated, If any wells should be excluded then these should be annotated in a column called "Filtered". Any samples with no text (ie. "" or NA) in such column will be included.

BEADS = beads info, if any should be excluded then these should be annotated in a column called "Filtered". Any beads with no text (ie. "" or NA) will be included in the transformation.

DENS = Density output used for cutoff selection,

Note: The function plots to a layout containing up to 16 areas.

Value

A list with the elements (output from ap_reactsummary2())

SAMPLEGROUPS = annnotation of which group each sample has been assigned,

REACTSUM_AG = number of reactive samples per antigen and sample group,

REACTFREQ_AG = reactivity frequency per antigen and sample group,

REACTSUM_SAMP = number of reactive antigens per sample,

REACTFREQ_SAMP = reactivity frequency per sample,


cekehe/rappp documentation built on May 17, 2022, 8:54 a.m.