| Type: | Package |
| Title: | Antigenic Cartography Macros |
| Version: | 1.2.9 |
| Date: | 2023-11-30 |
| Description: | A toolkit for making antigenic maps from immunological assay data, in order to quantify and visualize antigenic differences between different pathogen strains as described in Smith et al. (2004) <doi:10.1126/science.1097211> and used in the World Health Organization influenza vaccine strain selection process. Additional functions allow for the diagnostic evaluation of antigenic maps and an interactive viewer is provided to explore antigenic relationships amongst several strains and incorporate the visualization of associated genetic information. |
| Depends: | R (≥ 4.0) |
| Imports: | Rcpp, jsonlite, ks, brotli, shiny, shinyFiles, shinyjs,htmlwidgets, ggplot2 (≥ 3.0.0), htmltools, rmarchingcubes,shape, ellipsis, MASS, magrittr, igraph, dplyr, vctrs, rlang |
| Suggests: | testthat, r3js, knitr, rmarkdown, rstudioapi, plotly,geometry, readxl, stringr, tibble, tidyr, base64enc, lifecycle,MCMCpack, spelling |
| LinkingTo: | Rcpp, RcppArmadillo, RcppProgress, RcppEnsmallen, rapidjsonr |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.2.3 |
| VignetteBuilder: | knitr |
| URL: | https://acorg.github.io/Racmacs/,https://github.com/acorg/Racmacs/ |
| BugReports: | https://github.com/acorg/Racmacs/issues |
| License: | AGPL-3 |
| Language: | en-GB |
| NeedsCompilation: | yes |
| Packaged: | 2023-11-30 11:11:49 UTC; cambridge |
| Author: | Sam Wilks [aut, cre] |
| Maintainer: | Sam Wilks <sw463@cam.ac.uk> |
| Repository: | CRAN |
| Date/Publication: | 2023-11-30 11:40:02 UTC |
Racmacs: Antigenic Cartography Macros
Description
The acmap data object
The fundamental unit of the Racmacs package is theacmapobject, short for Antigenic Cartography MAP. This object contains all theinformation about an antigenic map. You can read in a new acmap object from afile with the functionread.acmap and create a new acmap object within anR session using theacmap function.
Key information associated with each acmap object is summarized in thesections below.
The titer table
Eachacmap object is built upon a table of data of measurements thereactivity of a set of different sera against a set of different antigens.Typically these measurements are HI assay measurements, but it is alsopossible to use other similar assays as input data.
For the table of data it is always assumed that sera form thecolumns andantigens form therows, as below. You can get and set titer data withtiterTable.
Optimizations
Another key component of theacmap object is a list of optimizations.While acmap objects only have one table of data, they can have manyoptimizations or none at all.
Each optimization has the following main attributes (see the vignette onoptimizing antigenic maps for more details on minimum column bases andstress):
Antigen coordinates, the coordinates of each antigen in thisoptimization.
Sera coordinates, the coordinates of each serum in this optimization.
Minimum column basis, the minimum column basis assumed when calculatingthis optimization.
Stress, the stress of this optimization.
Dimensions, the number of dimensions of this optimization.
Plotting styles
The final type of information that is contained in the acmap object isinformation on point styles when plotting. By altering these attributes youcan change the appearance of the antigen and serum points in any mapsplotted, the main ones include:
Size
Shape
Fill color
Outline color
Author(s)
Maintainer: Sam Wilkssw463@cam.ac.uk
See Also
Useful links:
Report bugs athttps://github.com/acorg/Racmacs/issues
Set acmap merge options
Description
This function facilitates setting options for the acmap titer merging process byreturning a list of option settings.
Usage
RacMerge.options(sd_limit = NULL, dilution_stepsize = 1, method = NULL)Arguments
sd_limit | When merging titers, titers that have a standard deviation ofthis amount or greater on the log2 scale will be set to "*" and excluded.Setting this to NA removes any limit. The default value will be NA, unlessthe titer merge method is specified as "lispmds" in which case the defaultis 1 and standard deviation is calculated by division by n, instead of n-1,in order to maintain backwards compatibility with previous approaches. |
dilution_stepsize | The dilution stepsize to assume when merging titers (see |
method | The titer merging method to use, either a string of "conservative" or "likelihood", or a user defined function. See details. |
Details
When merging measured titers, the general approach is to take the geometricmean and use that as the merged titer, however in particular when < valuesare present there are different options that can be employed. In olderversions of Racmacs, < values were converted to maximum possible numerictiter after accounting for the dilution_stepsize factor, then the geometricmean was taken. This approach can be used by specifying the method as"likelihood" since, this approach gives a very rough approximation of themost likely mean numeric value. In contrast, the "conservative" method andcurrent default returns the highest < value that satisfies all the valuesthat were measured. As an example merging <10 and 20, (assumingdilution_stepsize = 1) would return a value of 10 with the "likelihood"method and <40 with the "conservative" method.
Value
Returns a named list of merging options
See Also
Other map merging functions:htmlMergeReport(),mergeMaps(),mergeReport(),splitTiterLayers()
Set acmap optimization options
Description
This function facilitates setting options for the acmap optimizer process byreturning a list of option settings.
Usage
RacOptimizer.options( dim_annealing = FALSE, method = "L-BFGS", maxit = 1000, num_basis = 10, armijo_constant = 1e-04, wolfe = 0.9, min_gradient_norm = 1e-06, factr = 1e-15, max_line_search_trials = 50, min_step = 1e-20, max_step = 1e+20, num_cores = getOption("RacOptimizer.num_cores"), report_progress = NULL, ignore_disconnected = FALSE, progress_bar_length = options()$width)Arguments
dim_annealing | Should dimensional annealing be performed |
method | The optimization method to use |
maxit | The maximum number of iterations to use in the optimizer |
num_basis | Number of memory points to be stored (default 10). |
armijo_constant | Controls the accuracy of the line search routine for determining the Armijo condition. |
wolfe | Parameter for detecting the Wolfe condition. |
min_gradient_norm | Minimum gradient norm required to continue the optimization. |
factr | Minimum relative function value decrease to continue the optimization. |
max_line_search_trials | The maximum number of trials for the line search (before giving up). |
min_step | The minimum step of the line search. |
max_step | The maximum step of the line search. |
num_cores | The number of cores to run in parallel when running optimizations |
report_progress | Should progress be reported |
ignore_disconnected | Should the check for disconnected points be skipped |
progress_bar_length | Progress bar length when progress is reported |
Details
For more details, for example on "dimensional annealing" seevignette("intro-to-antigenic-cartography"). For details on optimizersettings likemaxit see the underlying optimizer documentation atensmallen.org.
Value
Returns a named list of optimizer options
See Also
Other map optimization functions:make.acmap(),moveTrappedPoints(),optimizeMap(),randomizeCoords(),relaxMapOneStep(),relaxMap()
Create a RacViewer widget
Description
This creates an html widget for viewing antigenic maps.
Usage
RacViewer( map, show_procrustes = FALSE, show_group_legend = FALSE, options = list(), width = NULL, height = NULL, elementId = NULL)Arguments
map | The map data object |
show_procrustes | should procrustes lines be shown |
show_group_legend | Show an interactive legend detailing differentgroups as set by |
options | A named list of viewer options supplied to |
width | Width of the widget |
height | Height of the widget |
elementId | DOM element ID |
Value
An object of class htmlwidget that will intelligently print itselfinto HTML in a variety of contexts including the R console, within RMarkdown documents, and within Shiny output bindings.
See Also
Other functions to view maps:RacViewer.options(),export_viewer(),ggplot.acmap(),mapGadget(),plot.acmap(),setLegend(),view.acmap(),view.default(),view()
Shiny bindings for RacViewer
Description
Output and render functions for using RacViewer within Shinyapplications and interactive Rmd documents.
Usage
RacViewerOutput(outputId, width = "100%", height = "100%")renderRacViewer(expr, env = parent.frame(), quoted = FALSE)Arguments
outputId | output variable to read from |
width,height | Must be a valid CSS unit (like |
expr | An expression that generates a RacViewer |
env | The environment in which to evaluate |
quoted | Is |
Value
An output or render function that enables the use of the widgetwithin Shiny applications.
See Also
Other shiny app functions:runGUI(),view.acmap()
Set viewer options
Description
This function facilitates setting racviewer options by returning a list ofoption settings.
Usage
RacViewer.options( point.opacity = NA, viewer.controls = "hidden", grid.display = "static", grid.col = "#cfcfcf", background.col = "#ffffff", show.names = FALSE, show.errorlines = FALSE, show.connectionlines = FALSE, show.titers = FALSE, xlim = NULL, ylim = NULL, translation = c(0, 0, 0), rotation = c(0, 0, 0), zoom = NULL)Arguments
point.opacity | Default opacity for unselected points, or "inherit" to takeopacity from the color values themselves. |
viewer.controls | Should viewer controls be shown or hidden by default? |
grid.display | For 3d maps, should the grid be fixed in the backgroundor enclose and rotate along with the map |
grid.col | Color to use for the grid shown behind the map |
background.col | Color for the viewer background |
show.names | Toggle name labels on, can be true or false or "antigens"or "sera" |
show.errorlines | Toggle error lines on |
show.connectionlines | Toggle connection lines on |
show.titers | Toggle titer labels on |
xlim | x limits to zoom the plot to |
ylim | y limits to zoom the plot to |
translation | Plot starting translation |
rotation | Plot starting rotation as an XYZ Euler rotation |
zoom | Plot starting zoom factor |
Value
Returns a named list of viewer options
See Also
Other functions to view maps:RacViewer(),export_viewer(),ggplot.acmap(),mapGadget(),plot.acmap(),setLegend(),view.acmap(),view.default(),view()
Generate a new acmap object
Description
This function generates a new acmap object, the base object for storing mapdata in the Racmacs package.
Usage
acmap( ag_names = NULL, sr_names = NULL, titer_table = NULL, ag_coords = NULL, sr_coords = NULL, check_duplicates = TRUE, ...)Arguments
ag_names | Antigen names |
sr_names | Sera names |
titer_table | Table of titer data |
ag_coords | Antigenic coordinates for an optimization run record(optional) |
sr_coords | Sera coordinates for an optimization run record (optional) |
check_duplicates | Issue a warning if duplicate antigen or sera namesare found |
... | Further arguments passed to |
Details
The fundamental unit of the Racmacs package is theacmap object,short for Antigenic Cartography MAP. This object contains all theinformation about an antigenic map. You can read in a new acmap object froma file with the functionread.acmap() and create a new acmap objectwithin an R session using theacmap() function.
Value
Returns the new acmap object
See Also
SeeoptimizeMap() for generating new optimizations estimatingantigen similarity from the acmap titer data.
Other functions for working with map data:addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Get acmap attributes
Description
Functions to get various attributes about an acmap object.
Usage
numAntigens(map)numSera(map)numSeraGroups(map)numPoints(map)numOptimizations(map)numLayers(map)Arguments
map | The acmap data object |
Value
A number relating to the attribute
See Also
Other map attribute functions:adjustedLogTiterTable(),adjustedTiterTable(),dilutionStepsize(),logtiterTableLayers(),mapDescription(),mapName(),titerTableFlat(),titerTableLayers(),titerTable()
Add a new optimization to an acmap object
Description
Function to add a new optimization to an acmap object, with specified values.
Usage
addOptimization( map, ag_coords = NULL, sr_coords = NULL, number_of_dimensions = NULL, minimum_column_basis = "none", fixed_column_bases = NULL, ag_reactivity_adjustments = NULL)Arguments
map | The acmap data object |
ag_coords | Antigen coordinates for the new optimization (0 if notspecified) |
sr_coords | Sera coordinates for the new optimization (0 if notspecified) |
number_of_dimensions | The number of dimensions of the new optimization |
minimum_column_basis | The minimum column basis to use for the newoptimization |
fixed_column_bases | A vector of fixed column bases with NA for serawhere the minimum column basis should be applied |
ag_reactivity_adjustments | A vector of antigen reactivity adjustments toapply to each antigen. Corresponding antigen titers will be adjusted by theseamounts when calculating column bases and table distances. |
Value
Returns the acmap data object with new optimization added (but notselected).
See Also
Other functions for working with map data:acmap(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Get the reactivity adjusted log titer table
Description
Return the log titer table plus any antigen reactivity adjustments.
Usage
adjustedLogTiterTable(map, optimization_number = 1)Arguments
map | An acmap object |
optimization_number | The optimization number from whichto take any antigen reactivity adjustments |
Value
A numeric matrix of adjusted log titers.
See Also
Other map attribute functions:acmapAttributes,adjustedTiterTable(),dilutionStepsize(),logtiterTableLayers(),mapDescription(),mapName(),titerTableFlat(),titerTableLayers(),titerTable()
Get the reactivity adjusted titer table
Description
Return the titer table plus any antigen reactivity adjustments.
Usage
adjustedTiterTable(map, optimization_number = 1)Arguments
map | An acmap object |
optimization_number | The optimization number from whichto take any antigen reactivity adjustments |
Value
A character matrix of titers.
See Also
Other map attribute functions:acmapAttributes,adjustedLogTiterTable(),dilutionStepsize(),logtiterTableLayers(),mapDescription(),mapName(),titerTableFlat(),titerTableLayers(),titerTable()
Getting and setting antigen attributes
Description
These functions get and set the antigen attributes for a map.
Usage
agIDs(map)agIDs(map) <- valueagDates(map)agDates(map) <- valueagReference(map)agReference(map) <- valueagNames(map)agNames(map) <- valueagExtra(map)agExtra(map) <- valueagPassage(map)agPassage(map) <- valueagLineage(map)agLineage(map) <- valueagReassortant(map)agReassortant(map) <- valueagStrings(map)agStrings(map) <- valueagContinent(map)agContinent(map) <- valueArguments
map | The acmap data object |
value | New value to set |
Value
Returns either the requested attribute when using a getter function or
the updated acmap object when using the setter function.
See Also
srAttributes()
Other antigen and sera attribute functions:agGroups(),agHomologousSr(),agLabIDs(),agSequences(),ptAnnotations,ptClades,srAttributes,srGroups(),srHomologousAgs(),srSequences()
Check map cohesion
Description
Checks the vertex connectivity of points in a map (the minimum number ofpoints needed to remove from the map to eliminate all paths from one point toanother point). This is for checking for example if after merging maps youonly have a small number of points in common between separate groups ofpoints, leading to a situation where groups of points cannot be robustlypositioned relative to each other. If the vertex connectivity is smaller thanthe number of map dimensions + 1 then this will certainly be occurring andwill lead to an unstable map solution.mapCohesion() returns the minimumvertex connectivity found between any given points, whileagCohesion() andsrCohesion() return the vertex connectivity between each pair of antigensand sera as a table helping to diagnose which antigens and sera are formingseparate groups. Note that for these purposes only detectable titers countas connections and non-detectable titers are ignored.
Usage
agCohesion(map)srCohesion(map)mapCohesion(map)Arguments
map | An acmap object |
Value
A scalar real value.
See Also
Other map diagnostic functions:bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Getting and setting antigen groups
Description
These functions get and set the antigen groupings for a map.
Usage
agGroups(map)agGroups(map) <- valueArguments
map | The acmap object |
value | A character or factor vector of groupings to apply to theantigens |
Value
A factor vector of groupings.
See Also
Other antigen and sera attribute functions:agAttributes,agHomologousSr(),agLabIDs(),agSequences(),ptAnnotations,ptClades,srAttributes,srGroups(),srHomologousAgs(),srSequences()
Get homologous sera for each antigen
Description
Gets the indices of homologous sera for each antigen in an antigenic map.See also the functionsrHomologousAgs() for getting and setting thehomologous antigens reciprocally.
Usage
agHomologousSr(map)Arguments
map | An acmap object |
Value
A list, where each entry is a vector of indices for homologoussera, or a length 0 vector where no homologous serum is present
See Also
Other antigen and sera attribute functions:agAttributes,agGroups(),agLabIDs(),agSequences(),ptAnnotations,ptClades,srAttributes,srGroups(),srHomologousAgs(),srSequences()
Getting and setting antigen lab id information
Description
Getting and setting antigen lab id information
Usage
agLabIDs(map)agLabIDs(map) <- valueArguments
map | The acmap data object |
value | A list of character vectors with lab ids information for eachpoint |
Value
A character vector of antigen laboratory IDs
See Also
Other antigen and sera attribute functions:agAttributes,agGroups(),agHomologousSr(),agSequences(),ptAnnotations,ptClades,srAttributes,srGroups(),srHomologousAgs(),srSequences()
Get and set antigen reactivity adjustments
Description
Get and set antigen reactivity adjustments
Usage
agReactivityAdjustments(map)agReactivityAdjustments(map) <- valueArguments
map | The acmap object |
value | A vector of antigen reactivity adjustments to apply |
Value
A numeric vector of antigen reactivity adjustments
See Also
Other functions for working with map data:acmap(),addOptimization(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Getting and setting antigen sequence information
Description
Getting and setting antigen sequence information
Usage
agSequences(map, missing_value = ".")agSequences(map) <- valueagNucleotideSequences(map, missing_value = ".")agNucleotideSequences(map) <- valueArguments
map | The acmap data object |
missing_value | Character to use to fill in portions of the sequence matrixwhere sequence data is missing. |
value | A character matrix of sequences with rows equal to the number ofantigens |
Value
A character matrix of sequences, where each row represents an antigen.
See Also
Other antigen and sera attribute functions:agAttributes,agGroups(),agHomologousSr(),agLabIDs(),ptAnnotations,ptClades,srAttributes,srGroups(),srHomologousAgs(),srSequences()
Apply the current map transformation
Description
Applies the map transformation associated with a selected optimization run toa set of coordinates.
Usage
applyMapTransform(coords, map, optimization_number = 1)Arguments
coords | Coordinates to transform |
map | The acmap object |
optimization_number | The optimization number |
Value
An acmap object with transformation applied
See Also
Other functions relating to map transformation:reflectMap(),rotateMap(),translateMap()
Apply a plotspec from another acmap
Description
Copy point style from matching antigens and sera in another acmap
Usage
applyPlotspec(map, source_map)Arguments
map | The acmap object |
source_map | An acmap object from which to copy point styles |
Value
Returns the acmap object with updated point styles (unmatched pointstyles unchanged)
See Also
Other map point style functions:ptDrawingOrder(),ptOpacity,ptStyles
Convert map to json format
Description
Convert map to json format
Usage
as.json(map, pretty = FALSE, round_titers = FALSE)Arguments
map | The map data object |
pretty | Should json be output prettily with new lines and indentation? |
round_titers | Should titers be rounded to the nearest integer before outputting |
Value
Returns map data as .ace json format
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Plot a blob object
Description
Plot a blob object such as that return fromagBootstrapBlob() using thepolygon() function.
Usage
blob(x, col, border, lwd, alpha = 1, ...)Arguments
x | The blob object to plot |
col | Color for the blob fill |
border | Color for the blob outline |
lwd | Line width for the blob outline |
alpha | Blob opacity |
... | Additional arguments to pass to |
Value
No return value, called for the side effect of plotting the blobs.
See Also
Other additional plotting functions:blobsize()
Calculate size of a blob object
Description
Returns either the area (for 2D blobs) or volume (for 3D blobs)
Usage
blobsize(blob)Arguments
blob | The blob object |
Value
A numeric vector
See Also
Other additional plotting functions:blob()
Calculate bootstrap blob data for an antigenic map
Description
This function takes a map for which the functionbootstrapMap() has alreadybeen applied and draws contour blobs for each point illustrating how pointposition varies in each bootstrap repeat. The blobs are calculated usingkernal density estimates according to these point distribution and drawnso as to encompass a given proportion of this variation according to theparameterconf.level. Aconf.level set at 0.95 for example will drawblobs that are calculated to encompass 95% of the positional variation seenin the bootstrap repeats. Note however that the accuracy of these estimateswill depend on the number of bootstrap repeats performed, for example whether100 or 1000 repeats were performed in the initial calculations usingbootstrapMap().
Usage
bootstrapBlobs( map, conf.level = 0.68, smoothing = 6, gridspacing = 0.25, antigens = TRUE, sera = TRUE, method = "ks")Arguments
map | The acmap data object |
conf.level | The proportion of positional variation captured by each blob |
smoothing | The amount of smoothing to perform when performing thekernel density estimate, larger equates to more smoothing |
gridspacing | grid spacing to use when calculating blobs, smaller valueswill produce more accurate blobs with smoother edges but will take longerto calculate. |
antigens | Should blobs be calculated for antigens |
sera | Should blobs be calculated for sera |
method | One of "MASS", the default, or "ks", specifying the algorithm touse when calculating blobs in 2D. 3D will always use ks::kde. |
Value
Returns an acmap object that will then show the corresponding bootstrapblobs when viewed or plotted.
See Also
Other map diagnostic functions:agCohesion(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Perform a bootstrap on a map
Description
This function takes the map and original titer table, and performs a versionofbootstrappingdefined by the method argument. For each bootstrap runthis process is performed and a record of the coordinates of points in thelowest stress solution is kept. See details for a description of the bootstrappingmethods you can apply.
Usage
bootstrapMap( map, method, bootstrap_repeats = 1000, bootstrap_ags = TRUE, bootstrap_sr = TRUE, reoptimize = TRUE, optimizations_per_repeat = 100, ag_noise_sd = 0.7, titer_noise_sd = 0.7, options = list())Arguments
map | The map object |
method | One of "resample", "bayesian" or "noisy" (see details) |
bootstrap_repeats | The number of bootstrap repeats to perform |
bootstrap_ags | For "resample" and "bayesian" methods, whether to apply bootstrapping across antigens |
bootstrap_sr | For "resample" and "bayesian" methods, whether to apply bootstrapping across sera |
reoptimize | Should the whole map be reoptimized with each bootstrap run. If FALSE,the map is simply relaxed from it's current optimization with each run. |
optimizations_per_repeat | When re-optimizing the map from scratch, thenumber of optimization runs to perform |
ag_noise_sd | The standard deviation (on the log titer scale) of measurement noiseapplied per antigen when using the "noisy" method |
titer_noise_sd | The standard deviation (on the log titer scale) of measurement noiseapplied per titer when using the "noisy" method |
options | Map optimizer options, see |
Details
Bootstrapping methods
"resample":Theresample bootstrapis the most standard bootstrap method, a random resample of the titer table data istakenwith replacement. Depending on your specification, resampling is applied acrosseither individual antigens, individual sera or both antigens and sera.In essence this method tries to let you see how robust the map is to inclusion ofparticular titer measurements or antigens or sera. Like most bootstrapping techniques itwill prove give more reliable results the more antigens and sera you have in your map. Itwon't work very well for a map of 5 sera and antigens for example, in this case a "noisy"bootstrap may be better.
"bayesian":Thebayesian bootstrapis akin to the resampling bootstrap, but rather than explicitly resampling data, weights areassigned to each part of the titer table data according to random draws from a dirichilet distribution.Under this scheme, every data point will play at least some role in making the map, even if onlyweighted slightly. Sometimes this is helpful, if you know for example that the points in your mapare highly dependent upon the presence of a few antigens / sera / titers to achieve reasonabletriangulation of point positions and you don't really want to risk removing them completely andending up with bootstrap runs that are under-constrained, you might want to consider this approach.On the other hand this might be exactly what you don't want and you want to know uncertainty thatcan be generated when certain subsets of the data are excluded completely, in that case you probablywant to stick with the "resample" method.
"noisy":The noisy bootstrap, sometimes termed asmooth bootstrapinvolved adding normally distributed noise to each observation. The distribution of this noise canbe parameterised through theag_noise_sd andtiter_noise_sd arguments.titer_noise_sd refers to thestandard deviation (on the log scale) of noise added to each individual titer measurement in the table,whileantigen_noise_sd refers to the standard deviation of noise applied to titers for each antigen.The reason for this distinction is that we have noticed with repeat measurements of influenza data thereis often both a random noise per titer and a random noise per antigen, i.e. in one repeat titers may allbe around one 2-fold higher on average, in addition to unbiased additional titer noise. If you wish to onlysimulate additional noise per titer and not a per antigen effect, simply setantigen_noise_sd to 0. Notethat in order to use this most effectively it is best to have an idea of the amount and type of measurementnoise you may expect in your data and set these parameters accordingly.
Value
Returns the map object updated with bootstrap information
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Check for hemisphering or trapped points
Description
Check for hemisphering or trapped points
Usage
checkHemisphering( map, optimization_number = 1, grid_spacing = 0.25, stress_lim = 0.1, options = list())Arguments
map | The acmap data object |
optimization_number | The map optimization number |
grid_spacing | When doing a grid search of more optimal point positionsthe grid spacing to use |
stress_lim | The stress difference to use when classifying a point as"hemisphering" or not |
options | A named list of options to pass to |
Value
Returns a data frame with information on any points that were foundto be hemisphering or trapped.
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Getting and setting column bases
Description
Functions to get and set column bases specified for an optimization run,either through the minimum column basis or through a vector of specifiedcolumn bases.
Usage
minColBasis(map, optimization_number = 1)minColBasis(map, optimization_number = 1) <- valuefixedColBases(map, optimization_number = 1)fixedColBases(map, optimization_number = 1) <- valueArguments
map | The acmap data object |
optimization_number | The optimization run from which to get / set the data |
value | New value to set |
Details
In general a map can have column bases that are specified eitherthrough a minimum column basis or a vector of fixed column bases for eachsera. When you callminColBasis(), it will return the minimum columnbasis if it has been set, or "fixed" if column bases have instead beenfixed directly. ThecolBases() function will return the column bases ascalculated for a given optimization run. Setting column bases through thisfunction withcolBases()<- will fix the column bases to the suppliedvector of values.
Note that although the output fromcolBases() might be the same in a casewhere a minimum column basis was set or a case where column bases were setexplicitly, when a minimum column basis is set, the column bases will stilldepend on the log titers recorded against a given sera, so changing thetiters may therefore change the actual column bases calculated. For fixedcolumn bases case, column bases will remain fixed at their valuesindependently of measured titers.
Value
Returns either the requested attribute when using a getter function or
the updated acmap object when using the setter function.
See Also
Other map optimization attribute functions:mapComment(),mapDimensions(),mapStress(),mapTransformation(),ptBaseCoords(),ptCoords()
Deprecated functions
Description
These functions still work but have been deprecated in favour of another function. Arguments will be passed onto the new function with a warning.
Usage
stressBlobs(...)Arguments
... | Arguments to pass to the new function |
Value
Values from the new function
Get or set the dilution stepsize associated with a map
Description
This defaults to 1 but can be changed using this function with knock-oneffects for how < values are treated when maps are optimized or relaxed andthe way stress is calculated, see details.
Usage
dilutionStepsize(map)dilutionStepsize(map) <- valueArguments
map | The acmap object from which to get or set the dilution stepsize |
value | The dilution stepsize value to set |
Details
Antigenic cartography was originally developed for HI titers whichtypically follow a 2-fold dilution series starting from 1/10, then 1/20,1/40 etc. This represents a "dilution stepsize" of 1 when converted to thelog2 scale. When no inhibition was recorded at the highest dilution, thevalue is typically recorded as <10 but the optimization regime effectivelytreats this as a <=5, the rationale being that, had the dilution series beencontinued to higher concentrations, the next lowest titer would have been a5. Over time the method has also been applied to other neutralizationassays that sometimes have a continuous read out with a lower end, in thesecases a <10 really means a <10 since any other values like 9.8 or 7.62would also be possible. To indicate these continuous cases, you can specifythe dilution stepsize as 0. Equally, if the dilution regime followed adifferent pattern, you can also set that here.
Value
A number giving the current dilution stepsize setting for a map.
See Also
Other map attribute functions:acmapAttributes,adjustedLogTiterTable(),adjustedTiterTable(),logtiterTableLayers(),mapDescription(),mapName(),titerTableFlat(),titerTableLayers(),titerTable()
Perform dimension testing on a map object
Description
Take a map object and perform cross-validation, seeing how well titers arepredicted when they are excluded from the map.
Usage
dimensionTestMap( map, dimensions_to_test = 1:5, test_proportion = 0.1, minimum_column_basis = "none", fixed_column_bases = rep(NA, numSera(map)), number_of_optimizations = 1000, replicates_per_dimension = 100, options = list())Arguments
map | The acmap data object |
dimensions_to_test | A numeric vector of dimensions to be tested |
test_proportion | The proportion of data to be used as the test set foreach test run |
minimum_column_basis | The minimum column basis to use |
fixed_column_bases | A vector of fixed column bases with NA for serawhere the minimum column basis should be applied |
number_of_optimizations | The number of optimizations to perform whencreating each map for the dimension test |
replicates_per_dimension | The number of tests to perform per dimensiontested |
options | Map optimizer options, see |
Details
For each run, the ag-sr titers that were randomly excluded arepredicted according to their relative positions in the map trained withoutthem. An RMSE is then calculated by comparing predicted titers inferredfrom the map on the log scale to the actual log titers. This is doneseparately for detectable titers (e.g. 40) and non-detectable titers (e.g.<10). For non-detectable titers, if the predicted titer is the same orlower than the log-titer threshold, the error is set to 0.
Value
Returns a data frame with the following columns. "dimensions" : thedimension tested, "mean_rmse_detectable" : mean prediction rmse fordetectable titers across all runs. "var_rmse_detectable" the variance ofthe prediction rmse for detectable titers across all runs, useful forestimating confidence intervals. "mean_rmse_nondetectable" and"var_rmse_nondetectable" the equivalent for non-detectable titers
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Edit antigen names in an acmap
Description
Edit antigen names in an acmap
Usage
edit_agNames(map, old_names, new_names)Arguments
map | The map data object to be updated |
old_names | Old names to be replaced |
new_names | Replacement for old names |
Value
Returns the acmap object with antigen names updated.
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Edit sera names in an acmap
Description
Edit sera names in an acmap
Usage
edit_srNames(map, old_names, new_names)Arguments
map | The map data object to be updated |
old_names | Old names to be replaced |
new_names | Replacement for old names |
Value
Returns the acmap object with sera names updated.
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Export the map viewer
Description
Export a map in a standalone html viewer
Usage
export_viewer(map, file, selfcontained = TRUE, ...)Arguments
map | The acmap object |
file | File to save HTML into |
selfcontained | Whether to save the HTML as a single self-contained file(with external resources base64 encoded) or a file with external resourcesplaced in an adjacent directory. |
... | Further parameters to |
Value
Called for the side effect of saving the viewer to an html file butinvisibly returns the map viewer htmlwidget.
See Also
Other functions to view maps:RacViewer.options(),RacViewer(),ggplot.acmap(),mapGadget(),plot.acmap(),setLegend(),view.acmap(),view.default(),view()
Get optimization details from an acmap object
Description
Gets the details associated with the currently selected or specified acmapoptimization as a list.
Usage
getOptimization(map, optimization_number = 1)Arguments
map | The acmap data object |
optimization_number | The optimization data to access |
Value
Returns a list with information about the optimization
See Also
SeelistOptimizations() for getting information about alloptimizations.
Plot an antigenic map using ggplot
Description
Method for plotting an antigenic map as a ggplot object
Usage
## S3 method for class 'acmap'ggplot( data = NULL, mapping = NULL, optimization_number = 1, xlim = NULL, ylim = NULL, plot_ags = TRUE, plot_sr = TRUE, plot_blobs = TRUE, plot_hemisphering = TRUE, show_procrustes = TRUE, show_error_lines = FALSE, plot_stress = FALSE, indicate_outliers = "arrowheads", grid.col = "grey90", grid.lwd = 0.5, grid.margin.col = "grey50", grid.margin.lwd = grid.lwd, fill.alpha = 0.8, outline.alpha = 0.8, padding = 1, arrow_angle = 25, arrow_length = 0.2, margins = rep(0.5, 4), ..., environment = NULL)Arguments
data | The acmap to plot |
mapping | Default list of aesthetic mappings to use for plot, not currently used |
optimization_number | The optimization number to plot |
xlim | optional x axis limits |
ylim | optional y axis limits |
plot_ags | logical, should antigens be plotted |
plot_sr | logical, should antigens be plotted |
plot_blobs | logical, should stress blobs be plotted if present |
plot_hemisphering | logical, should hemisphering points be indicated, iftested for already with |
show_procrustes | logical, should procrustes lines be shown, if present |
show_error_lines | logical, should error lines be drawn |
plot_stress | logical, should map stress be plotted in lower left corner |
indicate_outliers | how should points outside the plotting region beindicated, either FALSE, for not shown, or "arrowheads" for small arrowheadslike in the viewer. |
grid.col | grid line color |
grid.lwd | grid line width |
grid.margin.col | grid margin color |
grid.margin.lwd | grid margin line width |
fill.alpha | alpha for point fill |
outline.alpha | alpha for point outline |
padding | padding at limits of the antigenic map, ignored if xlim orylim set explicitly |
arrow_angle | angle of arrow heads drawn for procrustes lines |
arrow_length | length of arrow heads drawn for procrustes lines in cm |
margins | margins in inches for the plot |
... | additional arguments, not used |
environment | not used |
Value
Returns the ggplot plot
See Also
Other functions to view maps:RacViewer.options(),RacViewer(),export_viewer(),mapGadget(),plot.acmap(),setLegend(),view.acmap(),view.default(),view()
Return an html formatted titer table with antigen reactivity adjustments applied
Description
Prints an html formatted titer table, visualisingwith colors things like which titers are the maximum for each sera.
Usage
htmlAdjustedTiterTable(map, optimization_number = 1)Arguments
map | An acmap object |
optimization_number | The optimization number from which to take theantigen reactivity adjustments. |
Value
A list() with a Rac_html_merge_report and shiny.tag class that canbe converted into an HTML string via as.character() and saved to a filewith save_html().
Return an html formatted merge report
Description
Prints an html formatted table merge report of a set of merged maps, visualisingwith colors how different titers have been merged together.
Usage
htmlMergeReport(map)Arguments
map | An acmap object that was the result of merging several maps |
Value
A list() with a Rac_html_merge_report and shiny.tag class that canbe converted into an HTML string via as.character() and saved to a filewith save_html().
See Also
Other map merging functions:RacMerge.options(),mergeMaps(),mergeReport(),splitTiterLayers()
Return an html formatted titer table
Description
Prints an html formatted titer table, visualisingwith colors things like which titers are the maximum for each sera.
Usage
htmlTiterTable(map)Arguments
map | An acmap object |
Value
A list() with a Rac_html_merge_report and shiny.tag class that canbe converted into an HTML string via as.character() and saved to a filewith save_html().
See Also
htmlAdjustedTiterTable
Keep only the lowest stress map optimization
Description
Keep only the lowest stress map optimization
Usage
keepBestOptimization(map)Arguments
map | The acmap object |
Value
An acmap object with only the lowest stress optimization kept
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Keep specified optimization runs
Description
Keep only data from specified optimization runs.
Usage
keepOptimizations(map, optimization_numbers)Arguments
map | The acmap object |
optimization_numbers | Optimizations to keep |
Value
Returns the updated acmap object
See Also
Other functions to work with map optimizations:optimizationProperties,removeOptimizations(),sortOptimizations()
Keep only a single optimization run
Description
Keep only a single optimization run
Usage
keepSingleOptimization(map, optimization_number = 1)Arguments
map | The acmap object |
optimization_number | The optimization run to keep |
Value
An acmap object with only one optimization kept
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Get and set map layer names
Description
Get and set map layer names
Usage
layerNames(map)layerNames(map) <- valueArguments
map | The acmap object |
value | A vector of new layer names to apply to the map |
Value
A character vector of layer names
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Get all optimization details from an acmap object
Description
Gets the details associated with the all the optimizations of an acmap objectas a list.
Usage
listOptimizations(map)Arguments
map | The acmap data object |
Value
Returns a list of lists with information about the optimizations
See Also
SeegetOptimization() for getting information about a singleoptimization.
Get the log titers from an acmap
Description
Converts titers to the log scale via via the transformation$log2(x/10)$, lessthan values are reduced by 1 on the log scale and greaterthan values are increased by 1, hence <10 => -1 and >1280 => 8
Usage
logtiterTable(map)Arguments
map | The acmap object |
Value
Returns a matrix of titers converted to the log scale
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Other functions relating to map stress calculation:mapDistances(),mapResiduals(),pointStress,recalculateStress(),stressTable(),tableColbases(),tableDistances()
Return a list of logtiter table layers
Description
Return a list of logtiter table layers
Usage
logtiterTableLayers(map)Arguments
map | An acmap data object |
Value
A list of numeric matrices with logtiter values
See Also
Other map attribute functions:acmapAttributes,adjustedLogTiterTable(),adjustedTiterTable(),dilutionStepsize(),mapDescription(),mapName(),titerTableFlat(),titerTableLayers(),titerTable()
Make an antigenic map from scratch
Description
This is a wrapper function for first making a map with table data then,running optimizations to make the map otherwise done withacmap()followed byoptimizeMap().
Usage
make.acmap( titer_table = NULL, ag_names = NULL, sr_names = NULL, number_of_dimensions = 2, number_of_optimizations = 100, minimum_column_basis = "none", fixed_column_bases = NULL, sort_optimizations = TRUE, check_convergence = TRUE, verbose = TRUE, options = list(), ...)Arguments
titer_table | A table of titer data |
ag_names | A vector of antigen names |
sr_names | A vector of sera names |
number_of_dimensions | The number of dimensions in the map |
number_of_optimizations | The number of optimization runs to perform |
minimum_column_basis | The minimum column basis for the map |
fixed_column_bases | A vector of fixed values to use as column basesdirectly, rather than calculating them from the titer table. |
sort_optimizations | Should optimizations be sorted by stressafterwards? |
check_convergence | Should a basic check for convergence of lowest stressoptimization runs onto a similar solution be performed. |
verbose | Should progress messages be reported, see also |
options | List of named optimizer options, see |
... | Further arguments to pass to |
Value
Returns an acmap object that has optimization run results.
See Also
Other map optimization functions:RacOptimizer.options(),moveTrappedPoints(),optimizeMap(),randomizeCoords(),relaxMapOneStep(),relaxMap()
Plot map vs table distances
Description
Plot map vs table distances
Usage
plot_map_table_distance( map, optimization_number = 1, xlim, ylim, line_of_equality = TRUE)plotly_map_table_distance( map, optimization_number = 1, xlim, ylim, line_of_equality = TRUE)Arguments
map | The acmap data object |
optimization_number | The optimization number from which to take map andtable distances |
xlim | The x limits of the plot |
ylim | The y limits of the plot |
line_of_equality | Should the line x=y be added |
Value
Returns the ggplot2 object
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Get bootstrap coordinates associated with a map
Description
This can be used to get information about the bootstrap run resultsafterbootstrapMap() has been run.
Usage
mapBootstrap_ptBaseCoords(map)mapBootstrap_agCoords(map)mapBootstrap_srCoords(map)Arguments
map | The map object |
Value
Returns a list of coordinate matrices for the points in each ofthe bootstrap runs
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Get or set an optimization run comment
Description
Get or set an optimization run comment
Usage
mapComment(map, optimization_number = 1)mapComment(map, optimization_number = 1) <- valueArguments
map | The acmap data object |
optimization_number | The optimization run from which to get / set the data |
value | New value to set |
Value
Gets or sets map comments for the optimization run.
See Also
Other map optimization attribute functions:colBases(),mapDimensions(),mapStress(),mapTransformation(),ptBaseCoords(),ptCoords()
Getting and setting the map description
Description
Getting and setting the map description
Usage
mapDescription(map)mapDescription(map) <- valueArguments
map | The acmap data object |
value | New value to set |
Value
Returns either the requested attribute when using a getter function or
the updated acmap object when using the setter function.
See Also
Other map attribute functions:acmapAttributes,adjustedLogTiterTable(),adjustedTiterTable(),dilutionStepsize(),logtiterTableLayers(),mapName(),titerTableFlat(),titerTableLayers(),titerTable()
Get the current map dimensions
Description
Get the current map dimensions
Usage
mapDimensions(map, optimization_number = 1)Arguments
map | The acmap data object |
optimization_number | The optimization run from which to get / set the data |
Value
Returns the number of dimensions for the optimization run.
See Also
Other map optimization attribute functions:colBases(),mapComment(),mapStress(),mapTransformation(),ptBaseCoords(),ptCoords()
Return calculated map distances for an acmap
Description
Takes the acmap object and calculates euclidean distances between antigensand sera for the currently selected or specified optimization.
Usage
mapDistances(map, optimization_number = 1)Arguments
map | The acmap data object |
optimization_number | The optimization number |
Value
Returns a matrix of map distances with antigens as rows and sera ascolumns.
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Other functions relating to map stress calculation:logtiterTable(),mapResiduals(),pointStress,recalculateStress(),stressTable(),tableColbases(),tableDistances()
Open a shiny gadget to view the map
Description
This function is equivalent to runningrunGUI() and loading a map file, but thistakes the acmap object to open as an input argument.
Usage
mapGadget(map)Arguments
map | The acmap object to open in the GUI |
Value
No value returned, called for the side effect of starting the gadget.
See Also
Other functions to view maps:RacViewer.options(),RacViewer(),export_viewer(),ggplot.acmap(),plot.acmap(),setLegend(),view.acmap(),view.default(),view()
Getting and setting the map name
Description
Getting and setting the map name
Usage
mapName(map)mapName(map) <- valueArguments
map | The acmap data object |
value | New value to set |
Value
Returns either the requested attribute when using a getter function or
the updated acmap object when using the setter function.
See Also
Other map attribute functions:acmapAttributes,adjustedLogTiterTable(),adjustedTiterTable(),dilutionStepsize(),logtiterTableLayers(),mapDescription(),titerTableFlat(),titerTableLayers(),titerTable()
Check if a map has been fully relaxed
Description
Checks if the map optimization run can be relaxed further.
Usage
mapRelaxed(map, optimization_number = 1, options = list())Arguments
map | The acmap data object |
optimization_number | The map optimization number |
options | List of named optimizer options, see |
Value
Returns TRUE or FALSE
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Get a table of residuals from an acmap
Description
This is the difference between the table distance and the map distance
Usage
mapResiduals(map, exclude_nd = FALSE, optimization_number = 1)Arguments
map | The acmap object |
exclude_nd | Should values associated with non-detectable measurementslike <10 be set to NA |
optimization_number | The optimization number |
Value
Returns a matrix of residuals, showing the residual error betweenmap distance and table distance for each antigen-sera pair.
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Other functions relating to map stress calculation:logtiterTable(),mapDistances(),pointStress,recalculateStress(),stressTable(),tableColbases(),tableDistances()
Calculate the current map stress
Description
Calculate the current map stress
Usage
mapStress(map, optimization_number = 1)Arguments
map | The acmap object |
optimization_number | The optimization number for which to calculate stress |
Value
A number giving the map stress
See Also
Other map optimization attribute functions:colBases(),mapComment(),mapDimensions(),mapTransformation(),ptBaseCoords(),ptCoords()
Reading map transformation data
Description
These functions can be used to query and if necessary set the maptransformation and map translation attributes for a given optimization run.
Usage
mapTransformation(map, optimization_number = 1)mapTransformation(map, optimization_number = 1) <- valuemapTranslation(map, optimization_number = 1)mapTranslation(map, optimization_number = 1) <- valueArguments
map | The acmap data object |
optimization_number | The optimization run from which to get / set the data |
value | New value to set |
Value
Returns either the requested attribute when using a getter function or
the updated acmap object when using the setter function.
See Also
Other map optimization attribute functions:colBases(),mapComment(),mapDimensions(),mapStress(),ptBaseCoords(),ptCoords()
Find matching antigens or sera between 2 maps
Description
Find matching antigens or sera between 2 maps
Usage
match_mapAntigens(map1, map2)match_mapSera(map1, map2)Arguments
map1 | The map to match names from. |
map2 | The map to match names to. |
Value
Returns the indices of matching strains in map 2, or NA in theposition of strains not found.
See Also
Other functions to compare maps:procrustesData(),procrustesMap(),realignMap(),realignOptimizations()
Merging maps
Description
Functions to merge together two tables or maps.
Usage
mergeMaps( ..., method = "table", number_of_dimensions, number_of_optimizations, minimum_column_basis = "none", optimizer_options = list(), merge_options = list(), verbose = TRUE)Arguments
... | acmaps to merge provided as either a list, or a series of separate arguments |
method | The merge method to use, see details. |
number_of_dimensions | For merging that generates new optimization runs,the number of dimensions. |
number_of_optimizations | For merging that generates new optimizationruns, the number of optimization runs to do. |
minimum_column_basis | For merging that generates new optimization runs,the minimum column basis to use. |
optimizer_options | For merging that generates new optimization runs, optimizersettings (see |
merge_options | Options to use when merging titers (see |
verbose | Should progress messages be output? |
Details
Maps can be merged in a number of ways depending upon the desiredresult.
Method 'table'
As you would expect, this merges the tables ofthe two maps but does not attempt to create any new optimizations and anyexisting optimizations are lost.
Method 'reoptimized-merge'
This merges the tables and thendoes a specified number of fresh optimizations from random startingcoordinates, ignoring any pre-existing optimization runs. It's exactly thesame as doing a 'table' merge and runningoptimizeMap() on the mergedtable.
Method 'incremental-merge'
This takes the currently selectedoptimization in the first map and then merges in the additional maps inturn. Each time any points not already found in the first map (or the lastmap in the incremental merge chain) are randomised and everything isrelaxed, this is repeated the specified number of times and the process isrepeated.
Method 'frozen-overlay'
This fixes the positions of points ineach map and tries to best match them simply through re-orientation. Oncethe best re-orientation is found, points that are in common between themaps are moved to the average position.
Method 'relaxed-overlay'
This is the same as thefrozen-overlay but points in the resulting map are then allowed to relax.
Method 'frozen-merge'
In this version, positions of allpoints in the first map are fixed and remain fixed, so the original mapdoes not change. The second map is then realigned to the first as closelyas possible and then all the new points appearing in the second map areallowed to relax into their new positions. This is a way to merge in newantigens and sera into a map without affecting the first one at all (andwas first implemented in lisp).
Value
Returns the merged map object
See Also
Other map merging functions:RacMerge.options(),htmlMergeReport(),mergeReport(),splitTiterLayers()
Return a merge report
Description
Prints a raw text merge report from merging two map tables.
Usage
mergeReport(map)Arguments
map | An acmap object that was the result of merging several maps |
Value
Returns a character matrix of information on merged titers.
See Also
Other map merging functions:RacMerge.options(),htmlMergeReport(),mergeMaps(),splitTiterLayers()
Move trapped points
Description
Sometimes points in a map optimization run get trapped in local optima, thisfunction tries to combat this by doing a grid search for each pointindividually moving points if a better optima is found. Note that this onlyperforms grid searches individually so won't find cases where a group ofpoints are trapped together in a local optima.
Usage
moveTrappedPoints( map, optimization_number = 1, grid_spacing = 0.25, max_iterations = 10, options = list())Arguments
map | The acmap data object |
optimization_number | The map optimization number to apply it to |
grid_spacing | Grid spacing in antigenic units of the search grid to usewhen searching for more optimal positions |
max_iterations | The maximum number of iterations of searching fortrapped points then relaxing the map to be performed |
options | List of named optimizer options, see |
Details
The search is iterative, searching for and moving points that are found to betrapped before relaxing the map and searching again, stopping either when nomore trapped points are found ormax_iterations is reached.
Value
Returns the acmap object with updated coordinates (if any trappedpoints found)
See Also
Other map optimization functions:RacOptimizer.options(),make.acmap(),optimizeMap(),randomizeCoords(),relaxMapOneStep(),relaxMap()
Get optimization properties
Description
Utility functions to get a vector of all the map optimizationproperties.
Usage
allMapStresses(map)allMapDimensions(map)Arguments
map | The acmap object |
Value
A numeric vector of values
See Also
Other functions to work with map optimizations:keepOptimizations(),removeOptimizations(),sortOptimizations()
Optimize antigen reactivity adjustments
Description
Usage
optimizeAgReactivity( map, optimization_number = 1, reactivity_stress_weighting = 1, fixed_ag_reactivities = rep(NA, numAntigens(map)), start_pars = rep(0, numAntigens(map)), reoptimize = FALSE, number_of_optimizations = 100, options = list())Arguments
map | The acmap object |
optimization_number | The optimization number for which to optimizeantigen reactivity adjustments |
reactivity_stress_weighting | The weighting to apply when calculatinghow much antigen reactivity changes should additionally contribute tostress in the optimization regime (see details). |
fixed_ag_reactivities | A vector of fixed antigen reactivities,use NA values to distinguish the positions you would still like tobe optimized. |
start_pars | A vector of starting parameters to use for the optimizer,you can still supply starting parameters for antigens listed in |
reoptimize | Should the map be reoptimized from scratch (slower butmore likely to explore other optima) when testing each reactivity adjustmentor simply relaxed from it's current coordinates (default) |
number_of_optimizations | If reoptimizing from scratch, how many optimizationruns should be performed each time. |
options | A named list of additional options to pass to |
Value
The acmap object is returned with antigen reactivity adjustmentsset to the value calculated in the optimizer. This can be queried withagReactivityAdjustments().
Optimize an acmap
Description
Take an acmap object with a table of titer data and perform optimization runsto try and find the best arrangement of antigens and sera to represent theirantigenic similarity. Optimizations generated from each run with differentrandom starting conditions will be added to the acmap object.
Usage
optimizeMap( map, number_of_dimensions, number_of_optimizations, minimum_column_basis = "none", fixed_column_bases = NULL, titer_weights = NULL, sort_optimizations = TRUE, check_convergence = TRUE, verbose = TRUE, options = list())Arguments
map | The acmap data object |
number_of_dimensions | The number of dimensions for the new map |
number_of_optimizations | The number of optimization runs to perform |
minimum_column_basis | The minimum column basis to use (see details) |
fixed_column_bases | A vector of fixed values to use as column basesdirectly, rather than calculating them from the titer table. |
titer_weights | An optional matrix of weights to assign each titer when optimizing |
sort_optimizations | Should optimizations be sorted by stressafterwards? |
check_convergence | Should a basic check for convergence of lowest stressoptimization runs onto a similar solution be performed. |
verbose | Should progress messages be reported, see also |
options | List of named optimizer options, see |
Details
This is the core function to run map optimizations. In essence, foreach optimization run, points are randomly distributed in n-dimensionalspace, the L-BFGS gradient-based optimization algorithm is applied to movepoints into an optimal position. Depending on the map, this may not be atrivial optimization process and results will depend upon the startingconditions so multiple optimization runs may be required. For a fullexplanation seevignette("intro-to-antigenic-cartography").
Minimum column basis and fixed column bases
Fixed column bases is a vector of fixed column bases for each sera, whereNA is specified (the default) column bases will be calculated according totheminimum_column_basis setting. Again for a full explanation of columnbases and what they mean seevignette("intro-to-antigenic-cartography").
Value
Returns the acmap object updated with new optimizations.
See Also
SeerelaxMap() for optimizing a given optimization starting fromits current coordinates.
Other map optimization functions:RacOptimizer.options(),make.acmap(),moveTrappedPoints(),randomizeCoords(),relaxMapOneStep(),relaxMap()
Order antigens and sera
Description
Functions to change the order of antigens and sera in a map
Usage
orderAntigens(map, order)orderSera(map, order)Arguments
map | The map data object |
order | The new order of points |
Value
An acmap object with points reordered
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Plot an antigenic map
Description
Method for plotting an antigenic map in two dimensions
Usage
## S3 method for class 'acmap'plot( x, optimization_number = 1, xlim = NULL, ylim = NULL, plot_ags = TRUE, plot_sr = TRUE, plot_labels = FALSE, plot_blobs = TRUE, point_opacity = "automatic", show_procrustes = TRUE, show_error_lines = FALSE, plot_stress = FALSE, indicate_outliers = "arrowheads", grid.col = "grey90", grid.margin.col = "grey50", outlier.arrow.col = grid.col, fill.alpha = 0.8, outline.alpha = 0.8, procrustes.lwd = 2, procrustes.col = "black", procrustes.arr.type = "triangle", procrustes.arr.length = 0.2, procrustes.arr.width = 0.15, label.offset = 0, padding = 1, cex = 1, margins = rep(0.5, 4), ...)Arguments
x | The acmap to plot |
optimization_number | The optimization number to plot |
xlim | optional x axis limits |
ylim | optional y axis limits |
plot_ags | logical, should antigens be plotted |
plot_sr | logical, should antigens be plotted |
plot_labels | should point labels be plotted, can be true, false or"antigens" or "sera" |
plot_blobs | logical, should stress blobs be plotted if present |
point_opacity | Either "automatic" or "fixed". "fixed" fixes pointopacity to match those in |
show_procrustes | logical, should procrustes lines be shown, if present |
show_error_lines | logical, should error lines be drawn |
plot_stress | logical, should map stress be plotted in lower left corner |
indicate_outliers | how should points outside the plotting region beindicated, either FALSE, for not shown, "arrowheads" for small arrowheadslike in the viewer, or "arrows" for arrows pointing from the edge of theplot margin, default is "arrowheads". |
grid.col | grid line color |
grid.margin.col | grid margin color |
outlier.arrow.col | outlier arrow color |
fill.alpha | alpha for point fill |
outline.alpha | alpha for point outline |
procrustes.lwd | procrustes arrow line width |
procrustes.col | procrustes arrow color |
procrustes.arr.type | procrustes arrow type (see |
procrustes.arr.length | procrustes arrow length (see |
procrustes.arr.width | procrustes arrow width (see |
label.offset | amount by which any point labels should be offset frompoint coordinates in fractions of a character width |
padding | padding at limits of the antigenic map, ignored if xlim orylim set explicitly |
cex | point size expansion factor |
margins | margins in inches for the plot, use |
... | additional arguments, not used |
Value
Called for the side effect of plotting the map but invisiblyreturns the map object.
See Also
Other functions to view maps:RacViewer.options(),RacViewer(),export_viewer(),ggplot.acmap(),mapGadget(),setLegend(),view.acmap(),view.default(),view()
Get individual point stress
Description
Functions to get stress associated with individual points in a map.
Usage
agStress(map, antigens = TRUE, optimization_number = 1)srStress(map, sera = TRUE, optimization_number = 1)srStressPerTiter(map, sera = TRUE, optimization_number = 1)agStressPerTiter(map, antigens = TRUE, optimization_number = 1)Arguments
map | The acmap data object |
antigens | Which antigens to check stress for, specified by index orname (defaults to all antigens). |
optimization_number | The optimization number |
sera | Which sera to check stress for, specified by index or name(defaults to all sera). |
Value
A numeric vector of point stresses
See Also
SeemapStress() for getting the total map stress directly.
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Other functions relating to map stress calculation:logtiterTable(),mapDistances(),mapResiduals(),recalculateStress(),stressTable(),tableColbases(),tableDistances()
Return procrustes data on a map comparison
Description
Returns information about how similar point positions are in two maps,to get an idea of how similar antigenic positions are in for examplemaps made from two different datasets.
Usage
procrustesData( map, comparison_map, optimization_number = 1, comparison_optimization_number = 1, antigens = TRUE, sera = TRUE, translation = TRUE, scaling = FALSE)Arguments
map | The acmap data object |
comparison_map | The acmap data object to procrustes against |
optimization_number | The map optimization to use in the procrustescalculation (other optimization runs are discarded) |
comparison_optimization_number | The optimization run int the comparisonmap to compare against |
antigens | Antigens to include (specified by name or index or TRUE/FALSEfor all/none) |
sera | Sera to include (specified by name or index or TRUE/FALSE forall/none) |
translation | Should translation be allowed |
scaling | Should scaling be allowed (generally not recommended unlesscomparing maps made with different assays) |
Value
Returns a list with information on antigenic distances between thealigned maps, and the rmsd of the point differences split by antigenpoints, serum points and total, or all points. The distances are a vectormatching the number of points in the main map, with NA in the position ofany points not found in the comparison map.
See Also
Other functions to compare maps:matchStrains,procrustesMap(),realignMap(),realignOptimizations()
Return procrustes information
Description
Returns information from one map procrusted to another.
Usage
procrustesMap( map, comparison_map, optimization_number = 1, comparison_optimization_number = 1, antigens = TRUE, sera = TRUE, translation = TRUE, scaling = FALSE, keep_optimizations = FALSE)Arguments
map | The acmap data object |
comparison_map | The acmap data object to procrustes against |
optimization_number | The map optimization to use in the procrustescalculation (other optimization runs are discarded) |
comparison_optimization_number | The optimization run int the comparisonmap to compare against |
antigens | Antigens to include (specified by name or index or TRUE/FALSEfor all/none) |
sera | Sera to include (specified by name or index or TRUE/FALSE forall/none) |
translation | Should translation be allowed |
scaling | Should scaling be allowed (generally not recommended unlesscomparing maps made with different assays) |
keep_optimizations | Should all optimization runs be kept or only theone to which the procrustes was applied. |
Value
Returns an acmap object with procrustes information added, which willbe shown when the map is plotted. To avoid ambiguity about whichoptimization run the procrustes was applied to, only the optimization runspecified byoptimization_number is kept in the map returned.
See Also
Other functions to compare maps:matchStrains,procrustesData(),realignMap(),realignOptimizations()
Getting and setting point annotation information
Description
Getting and setting point annotation information
Usage
agAnnotations(map)srAnnotations(map)agAnnotations(map) <- valuesrAnnotations(map) <- valueArguments
map | The acmap data object |
value | A list of character vectors with annotations information for eachpoint |
Value
A character vector of point annotations.
See Also
Other antigen and sera attribute functions:agAttributes,agGroups(),agHomologousSr(),agLabIDs(),agSequences(),ptClades,srAttributes,srGroups(),srHomologousAgs(),srSequences()
Getting and setting base coordinates
Description
These functions get and set the base coordinates for a given optimizationrun.
Usage
ptBaseCoords(map, optimization_number = 1)agBaseCoords(map, optimization_number = 1)agBaseCoords(map, optimization_number = 1) <- valuesrBaseCoords(map, optimization_number = 1)srBaseCoords(map, optimization_number = 1) <- valueArguments
map | The acmap data object |
optimization_number | The optimization run from which to get / set the data |
value | New value to set |
Value
Returns either the requested attribute when using a getter function or
the updated acmap object when using the setter function.
See Also
agCoords()srCoords()
Other map optimization attribute functions:colBases(),mapComment(),mapDimensions(),mapStress(),mapTransformation(),ptCoords()
Get antigen or serum bootstrap blob information
Description
Get antigen or serum bootstrap blob information for plotting with theblob() function.
Usage
agBootstrapBlob(map, antigen, optimization_number = 1)srBootstrapBlob(map, serum, optimization_number = 1)agBootstrapBlobs(map, optimization_number = 1)srBootstrapBlobs(map, optimization_number = 1)ptBootstrapBlobs(map, optimization_number = 1)Arguments
map | An acmap object |
antigen | The antigen to get the blob for |
optimization_number | Optimization number from which to get blob information |
serum | The serum to get the blob for |
Value
Returns an object of class "blob" that can be plotted using theblob() function.
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Get antigen or serum bootstrap coordinates information
Description
Get antigen or serum bootstrap coordinates information
Usage
ptBootstrapCoords(map, point)agBootstrapCoords(map, antigen)srBootstrapCoords(map, serum)Arguments
map | An acmap object |
point | The point from which to get the bootstrap coords (numberedantigens then sera) |
antigen | The antigen to get the bootstrap coords |
serum | The serum from which to get the bootstrap coords |
Value
Returns a matrix of coordinates for the point in each of thebootstrap runs
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Getting and setting point clade information
Description
Getting and setting point clade information
Usage
agClades(map)srClades(map)agClades(map) <- valuesrClades(map) <- valueArguments
map | The acmap data object |
value | A list of character vectors with clade information for eachpoint |
Value
A character vector of clade information.
See Also
Other antigen and sera attribute functions:agAttributes,agGroups(),agHomologousSr(),agLabIDs(),agSequences(),ptAnnotations,srAttributes,srGroups(),srHomologousAgs(),srSequences()
Getting and setting point coordinates
Description
Getting and setting of antigen and serum coordinates in a map optimizationrun (by default the currently selected one).
Usage
agCoords(map, optimization_number = 1)srCoords(map, optimization_number = 1)ptCoords(map, optimization_number = 1)ptCoords(map, optimization_number = 1) <- valueagCoords(map, optimization_number = 1) <- valuesrCoords(map, optimization_number = 1) <- valueArguments
map | The acmap object |
optimization_number | The optimization number from which to get / setthe coordinates |
value | A matrix of new coordinates to set |
Details
These functions get and set point coordinates in a map. By defaultthese coordinates refer to the currently selected optimization run, unlessotherwise specified through theoptimization_number argument.
99\want to use but you should note that the outputs are actually the map basecoordinates after the transformation and translation associated with theoptimization run has been applied (seemapTransformation() andmapTranslation() for more details). When you set the antigen or serumcoordinates through these functions, the transformed coordinates are"baked" in and the map transformation and translation are reset.Consequently if you want to apply a transformation to all coordinatesgenerally, you are better off modifying the map translation andtransformation directly, as is done by functions likerotateMap() andtranslateMap().
Value
Returns a matrix of point coordinates.
See Also
agBaseCoords()srBaseCoords()mapTransformation()mapTranslation()
Other map optimization attribute functions:colBases(),mapComment(),mapDimensions(),mapStress(),mapTransformation(),ptBaseCoords()
Get and set point drawing order in map
Description
Point drawing order is a vector of indices defining the order inwhich points should be draw when plotting or viewing a map. Pointsare indexed in the same order as antigens then followed bysera.
Usage
ptDrawingOrder(map)ptDrawingOrder(map) <- valueArguments
map | An acmap object |
value | The point drawing order |
Value
A numeric vector of point drawing order information
See Also
Other map point style functions:applyPlotspec(),ptOpacity,ptStyles
Calculate point leverage
Description
These functions attempt to estimate leverage of each antigen, sera or titerby removing it from the data, relaxing the map, then calculating the rmsd ofthe procrustes comparison between the original and newly relaxed map. Columnbases will be recalculated unless you have specified them as fixed withfixedColBases().
Usage
agLeverage(map, antigens = TRUE, sera = TRUE)srLeverage(map, antigens = TRUE, sera = TRUE)titerLeverage(map, antigens = TRUE, sera = TRUE)Arguments
map | An acmap object |
antigens | Antigens to include when calculating the rmsd of theprocrustes (specified by name or index or TRUE/FALSE for all/none) |
sera | Sera to include when calculating the rmsd of the procrustes(specified by name or index or TRUE/FALSE for all/none) |
Value
Returns a numeric vector of the leverage calculated for each of thepoints.
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Set point opacity in a map
Description
These are helper functions to quickly set the opacity of points in a map,they set both the fill and outline color opacity by modifying the filland outline colors to include an alpha channel for opacity. If you needmore control, for example different opacities for the fill and outlinecolors, you alter the fill and outline opacities yourself, for examplewith thegrDevices::adjustcolor() function.
Usage
agOpacity(map) <- valuesrOpacity(map) <- valueArguments
map | An acmap object |
value | A vector of opacities |
Value
A numeric vector of point opacities.
See Also
Other map point style functions:applyPlotspec(),ptDrawingOrder(),ptStyles
Getting and setting point plotting styles
Description
These functions get and set the styles to use for each point when plotting.
Usage
agShown(map)srShown(map)agShown(map) <- valuesrShown(map) <- valueagSize(map)srSize(map)agSize(map) <- valuesrSize(map) <- valueagFill(map)srFill(map)agFill(map) <- valuesrFill(map) <- valueagOutline(map)srOutline(map)agOutline(map) <- valuesrOutline(map) <- valueagOutlineWidth(map)srOutlineWidth(map)agOutlineWidth(map) <- valuesrOutlineWidth(map) <- valueagRotation(map)srRotation(map)agRotation(map) <- valuesrRotation(map) <- valueagAspect(map)srAspect(map)agAspect(map) <- valuesrAspect(map) <- valueagShape(map)srShape(map)agShape(map) <- valuesrShape(map) <- valueArguments
map | The acmap data object |
value | New value to set |
Value
Returns either the requested attribute when using a getter function or
the updated acmap object when using the setter function.
See Also
Other map point style functions:applyPlotspec(),ptDrawingOrder(),ptOpacity
Get antigen or serum triangulation blob information
Description
Get antigen or serum triangulation blob information for plotting with theblob() function.
Usage
agTriangulationBlob(map, antigen, optimization_number = 1)srTriangulationBlob(map, serum, optimization_number = 1)agTriangulationBlobs(map, optimization_number = 1)srTriangulationBlobs(map, optimization_number = 1)ptTriangulationBlobs(map, optimization_number = 1)Arguments
map | An acmap object |
antigen | The antigen to get the blob for |
optimization_number | Optimization number from which to get blob information |
serum | The serum to get the blob for |
Value
Returns an object of class "blob" that can be plotted using theblob() function.
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Randomize map coordinates
Description
Moves map coordinates back into random starting conditions, as performedbefore each optimization run. The maximum table distance is calculatedthen points are randomized in a box with side length equal to maximumtable distance multiplied bytable_dist_factor
Usage
randomizeCoords(map, optimization_number = 1, table_dist_factor = 2)Arguments
map | The acmap data object |
optimization_number | The map optimization number to randomize |
table_dist_factor | The expansion factor for the box size in whichpoints are randomized. |
Value
Returns an updated map object
See Also
Other map optimization functions:RacOptimizer.options(),make.acmap(),moveTrappedPoints(),optimizeMap(),relaxMapOneStep(),relaxMap()
Read in acmap data from a file
Description
Reads an antigenic map file and converts it into an acmap data object.
Usage
read.acmap( filename, optimization_number = NULL, sort_optimizations = FALSE, align_optimizations = FALSE)Arguments
filename | Path to the file. |
optimization_number | Numeric vector of optimization runs to keep, thedefault, NULL, keeps information on all optimization runs |
sort_optimizations | Should optimizations be sorted in order of stresswhen the map data is read? |
align_optimizations | Should optimizations be rotated and translated tomatch the orientation of the first optimization as closely as possible? |
Value
Returns the acmap data object.
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Read in a table of titer data
Description
Reads in a table of titer data, converting it to a matrix of titers withlabelled column and row names. Missing titers should be represented by anasterisk character.
Usage
read.titerTable(filepath)Arguments
filepath | Path to the table of titer data |
Details
Currently supported file formats are .csv and .xls and .txt
Value
Returns a matrix of titers.
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Realign map to match another
Description
Realigns the coordinates of a map to match a target map as closely aspossible, based on aprocrustes analysis.Note that all optimization runs will be separately aligned to match asclosely as possible the first optimization run of the target map.
Usage
realignMap(map, target_map, translation = TRUE, scaling = FALSE)Arguments
map | The acmap to realign. |
target_map | The acmap to realign to. |
translation | Should translation be allowed |
scaling | Should scaling be allowed (generally not recommended unlesscomparing maps made with different assays) |
Value
Returns a map object aligned to the target map
See Also
Other functions to compare maps:matchStrains,procrustesData(),procrustesMap(),realignOptimizations()
Realigns optimizations in the map
Description
Realigns all map optimizations through rotation and translation to matchpoint positions as closely as possible to the first optimization run. Thisis done by default when optimizing a map and makes comparing point positionsin each optimization run much easier to do by eye.
Usage
realignOptimizations(map)Arguments
map | The acmap data object |
Value
Returns the map with realigned optimizations
See Also
Other functions to compare maps:matchStrains,procrustesData(),procrustesMap(),realignMap()
Recalculate the stress associated with an acmap optimization
Description
Recalculates the stress associated with the currently selected oruser-specified optimization.
Usage
recalculateStress(map, optimization_number = 1)Arguments
map | The acmap data object |
optimization_number | The optimization number |
Value
Returns the recalculated map stress for a given optimization
See Also
SeepointStress() for getting the stress of individual points.
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,stressTable(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Other functions relating to map stress calculation:logtiterTable(),mapDistances(),mapResiduals(),pointStress,stressTable(),tableColbases(),tableDistances()
Reflect a map
Description
Reflects map coordinates
Usage
reflectMap(map, axis = "x", optimization_number = NULL)Arguments
map | The acmap object |
axis | Axis of reflection |
optimization_number | The optimization number (or NULL to apply to alloptimizations) |
Value
An acmap object with reflection applied
See Also
Other functions relating to map transformation:applyMapTransform(),rotateMap(),translateMap()
Relax a map
Description
Optimize antigen and serum positions starting from their current coordinatesin the selected or specified optimization.
Usage
relaxMap( map, optimization_number = 1, fixed_antigens = FALSE, fixed_sera = FALSE, titer_weights = NULL, options = list())Arguments
map | The acmap object |
optimization_number | The optimization number to relax |
fixed_antigens | Antigens to set fixed positions for when relaxing |
fixed_sera | Sera to set fixed positions for when relaxing |
titer_weights | An optional matrix of weights to assign each titer when optimizing |
options | List of named optimizer options, see |
Value
Returns an acmap object with the optimization relaxed.
See Also
SeeoptimizeMap() for performing new optimization runs from randomstarting coordinates.
Other map optimization functions:RacOptimizer.options(),make.acmap(),moveTrappedPoints(),optimizeMap(),randomizeCoords(),relaxMapOneStep()
Relax a map one step in the optimiser
Description
Relax a map one step in the optimiser
Usage
relaxMapOneStep( map, optimization_number = 1, fixed_antigens = FALSE, fixed_sera = FALSE, options = list())Arguments
map | The acmap data object |
optimization_number | The map optimization number |
fixed_antigens | Antigens to set fixed positions for when relaxing |
fixed_sera | Sera to set fixed positions for when relaxing |
options | List of named optimizer options, see |
Value
Returns an updated map object
See Also
Other map optimization functions:RacOptimizer.options(),make.acmap(),moveTrappedPoints(),optimizeMap(),randomizeCoords(),relaxMap()
Remove map optimizations
Description
Remove all optimization run data from a map object
Usage
removeOptimizations(map)Arguments
map | The acmap object |
Value
An acmap object with all optimizations removed
See Also
Other functions to work with map optimizations:keepOptimizations(),optimizationProperties,sortOptimizations()
Remove antigens and sera
Description
Functions to remove antigens and sera from a map
Usage
removeAntigens(map, antigens)removeSera(map, sera)Arguments
map | The map data object |
antigens | Antigens to remove (specified by name or index) |
sera | Sera to remove (specified by name or index) |
Value
An acmap object with points removed
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Rotate a map
Description
Apply a rotation to an antigenic map
Usage
rotateMap(map, degrees, axis = NULL, optimization_number = NULL)Arguments
map | The acmap object |
degrees | Degrees of rotation |
axis | Axis of rotation (if 3D), specified as "x", "y", or "z" |
optimization_number | The optimization number (or NULL to apply to alloptimizations) |
Value
An acmap object with rotation applied
See Also
Other functions relating to map transformation:applyMapTransform(),reflectMap(),translateMap()
Open the Racmacs GUI
Description
This function opens the Racmacs GUI in a new window
Usage
runGUI()Value
Nothing returned, called only for the side effect of starting the viewer.
See Also
Other shiny app functions:RacViewer-shiny,view.acmap()
Save acmap data to a file
Description
Save acmap data to a file. The preferred extension is ".ace", althoughthe format of the file will be a json file of map data compressed using'xz' compression.
Usage
save.acmap( map, filename, compress = FALSE, pretty = !compress, round_titers = FALSE)Arguments
map | The acmap data object. |
filename | Path to the file. |
compress | Should the file be xz compressed |
pretty | Should json be output prettily with new lines and indentation |
round_titers | Should titers be rounded when outputted (this is neededfor acmacs web and lispmds compatibility) |
Value
No return value, called for the side effect of saving the map datato the file.
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.coords(),save.titerTable(),subsetCommonPoints,subsetMap()
Save acmap coordinate data to a file
Description
Saves acmap coordinate data of all or specified antigens and sera to a .csvfile.
Usage
save.coords( map, filename, optimization_number = 1, antigens = TRUE, sera = TRUE)Arguments
map | The acmap data object. |
filename | Path to the file. |
optimization_number | Optimization number from which to take coordinates |
antigens | Antigens to include, either as a numeric vector of indices orcharacter vector of names. |
sera | Sera to include, either as a numeric vector of indices orcharacter vector of names. |
Value
No return value, called for the side effect of saving thecoordinate data.
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.titerTable(),subsetCommonPoints,subsetMap()
Save titer data to a file
Description
Saves titer data of all or specified antigens and sera to a .csv file.
Usage
save.titerTable(map, filename, antigens = TRUE, sera = TRUE)Arguments
map | The acmap data object. |
filename | Path to the file. |
antigens | Antigens to include, either as a numeric vector of indices orcharacter vector of names. |
sera | Sera to include, either as a numeric vector of indices orcharacter vector of names. |
Value
No return value, called for the side effect of saving the titerdata to the file.
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),subsetCommonPoints,subsetMap()
Set acmap legend
Description
This sets the acmap legend used when viewing a map for example.
Usage
setLegend(map, legend, fill, style.bottom = "8px", style.right = "8px")Arguments
map | The acmap object |
legend | A character vector of legend labels |
fill | The fill color to be used with the boxes that appear alongsidethe legend labels |
style.bottom | "bottom" style of the div, specifying how far from thebottom of the viewport the bottom of the legend is spaced. |
style.right | "right" style of the div, specifying how far from theright of the viewport the bottom of the legend is spaced. |
Value
Returns the updated acmap object
See Also
Other functions to view maps:RacViewer.options(),RacViewer(),export_viewer(),ggplot.acmap(),mapGadget(),plot.acmap(),view.acmap(),view.default(),view()
Sort optimizations by stress
Description
Sorts all the optimization runs for a given map object by stress(lowest to highest). Note that this is done by default when runningoptimizeMap().
Usage
sortOptimizations(map)Arguments
map | The acmap object |
Value
An acmap object with optimizations sorted by stress.
See Also
Other functions to work with map optimizations:keepOptimizations(),optimizationProperties,removeOptimizations()
Split a map made up from titer layers into a list of separate maps each with a titer tablecorresponding to one of the layers
Description
Split a map made up from titer layers into a list of separate maps each with a titer tablecorresponding to one of the layers
Usage
splitTiterLayers(map)Arguments
map | An acmap object with titer table layers |
Value
A list of acmap objects
See Also
Other map merging functions:RacMerge.options(),htmlMergeReport(),mergeMaps(),mergeReport()
Getting and setting sera attributes
Description
These functions get and set the sera attributes for a map.
Usage
srIDs(map)srIDs(map) <- valuesrDates(map)srDates(map) <- valuesrReference(map)srReference(map) <- valuesrNames(map)srNames(map) <- valuesrExtra(map)srExtra(map) <- valuesrPassage(map)srPassage(map) <- valuesrLineage(map)srLineage(map) <- valuesrReassortant(map)srReassortant(map) <- valuesrStrings(map)srStrings(map) <- valuesrSpecies(map)srSpecies(map) <- valueArguments
map | The acmap data object |
value | New value to set |
Value
Returns either the requested attribute when using a getter function or
the updated acmap object when using the setter function.
See Also
agAttributes()
Other antigen and sera attribute functions:agAttributes,agGroups(),agHomologousSr(),agLabIDs(),agSequences(),ptAnnotations,ptClades,srGroups(),srHomologousAgs(),srSequences()
Getting and setting sera groups
Description
These functions get and set the sera groupings for a map.
Usage
srGroups(map)srGroups(map) <- valueArguments
map | The acmap object |
value | A character or factor vector of groupings to apply to the sera |
Value
A factor vector of serum groups
See Also
Other antigen and sera attribute functions:agAttributes,agGroups(),agHomologousSr(),agLabIDs(),agSequences(),ptAnnotations,ptClades,srAttributes,srHomologousAgs(),srSequences()
Get and set homologous antigens for sera
Description
Get and set indices of homologous antigens to sera in an antigenic map
Usage
srHomologousAgs(map)srHomologousAgs(map) <- valueArguments
map | An acmap object |
value | A list, where each entry is a vector of indices for homologousantigens, or a length 0 vector where no homologous antigen is present |
Value
A list, where each entry is a vector of indices for homologousantigens, or a length 0 vector where no homologous antigen is present.
See Also
Other antigen and sera attribute functions:agAttributes,agGroups(),agHomologousSr(),agLabIDs(),agSequences(),ptAnnotations,ptClades,srAttributes,srGroups(),srSequences()
Getting and setting sera sequence information
Description
Getting and setting sera sequence information
Usage
srSequences(map, missing_value = ".")srSequences(map) <- valuesrNucleotideSequences(map, missing_value = ".")srNucleotideSequences(map) <- valueArguments
map | The acmap data object |
missing_value | Character to use to fill in portions of the sequence matrixwhere sequence data is missing. |
value | A character matrix of sequences with rows equal to the number ofsera |
Value
A character matrix of sequences with rows equal to the number ofsera.
See Also
Other antigen and sera attribute functions:agAttributes,agGroups(),agHomologousSr(),agLabIDs(),agSequences(),ptAnnotations,ptClades,srAttributes,srGroups(),srHomologousAgs()
Standardize strain names
Description
This is a utility function to help standardise antigen names into a moreconsistent format, also attempting to break apart different componentsof the name.
Usage
standardizeStrainNames( names, default_species = NA, default_virus_type = "A", default_virus_subtype = "HXNX")Arguments
names | Strain names to be standardised |
default_species | Are the strains isolated from a particular species? |
default_virus_type | Default virus type to be used (if no type found inname) |
default_virus_subtype | Default virus subtype to be used (if no subtypefound in name) |
Value
Returns a tibble of standardised names and extracted information
Get a stress table from an acmap
Description
Get a stress table from an acmap
Usage
stressTable(map, optimization_number = 1)Arguments
map | The acmap object |
optimization_number | The optimization number for which to calculatestresses |
Value
Returns a matrix of stresses, showing how much each antigen and serameasurement contributes to stress in the selected or specifiedoptimization.
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),tableColbases(),tableDistances(),triangulationBlobs(),unstableMaps
Other functions relating to map stress calculation:logtiterTable(),mapDistances(),mapResiduals(),pointStress,recalculateStress(),tableColbases(),tableDistances()
Remove antigens and sera
Description
Functions to subset a list of maps to include only antigens, antigen groups, seraor serum groups that are in common between them.
Usage
subsetCommonAgs(maps)subsetCommonSrGroups(maps)Arguments
maps | A list of map data objects |
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetMap()
Subset an antigenic map
Description
Subset an antigenic map to contain only specified antigens and sera
Usage
subsetMap(map, antigens = TRUE, sera = TRUE)Arguments
map | The antigenic map object |
antigens | Antigens to keep, defaults to all. |
sera | Sera to keep, defaults to all. |
Value
Returns a new antigenic map containing only match antigens and sera
See Also
Other functions for working with map data:acmap(),addOptimization(),agReactivityAdjustments(),as.json(),edit_agNames(),edit_srNames(),keepBestOptimization(),keepSingleOptimization(),layerNames(),orderPoints,read.acmap(),read.titerTable(),removePoints,save.acmap(),save.coords(),save.titerTable(),subsetCommonPoints
Calculate column bases for a titer table
Description
For more information on column bases, what they mean and how they arecalculated seevignette("intro-to-antigenic-cartography")
Usage
tableColbases( titer_table, minimum_column_basis = "none", fixed_column_bases = rep(NA, ncol(titer_table)), ag_reactivity_adjustments = rep(0, nrow(titer_table)))Arguments
titer_table | The titer table |
minimum_column_basis | The minimum column basis to assume |
fixed_column_bases | Fixed column bases to apply |
ag_reactivity_adjustments | Reactivity adjustments to apply on a per-antigen basis |
Value
Returns a numeric vector of the log-converted column bases for thetable
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableDistances(),triangulationBlobs(),unstableMaps
Other functions relating to map stress calculation:logtiterTable(),mapDistances(),mapResiduals(),pointStress,recalculateStress(),stressTable(),tableDistances()
Return calculated table distances for an acmap
Description
Takes the acmap object and, assuming the column bases associated with thecurrently selected or specified optimization, returns the table distancescalculated from the titer data. For more information on column bases andtheir role in antigenic cartography seevignette("intro-to-antigenic-cartography")
Usage
tableDistances(map, optimization_number = 1)Arguments
map | The acmap data object |
optimization_number | The optimization number |
Value
Returns a matrix of numeric table distances
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),triangulationBlobs(),unstableMaps
Other functions relating to map stress calculation:logtiterTable(),mapDistances(),mapResiduals(),pointStress,recalculateStress(),stressTable(),tableColbases()
Getting and setting map titers
Description
Functions to get and set the map titer table. Note that when setting thetiter table like this any titer table layer information is lost, this isnormally not a problem unless the map is a result of merging two titer tablestogether previously and you then go on the merge the titers again.
Usage
titerTable(map)titerTable(map) <- valueArguments
map | The acmap object |
value | A character matrix of titers to set |
Value
Returns a character matrix of titers.
See Also
adjustedTiterTable(),htmlTiterTable()
Other map attribute functions:acmapAttributes,adjustedLogTiterTable(),adjustedTiterTable(),dilutionStepsize(),logtiterTableLayers(),mapDescription(),mapName(),titerTableFlat(),titerTableLayers()
Getting and setting the flat titer table
Description
These are underlying functions to get and set the "flat" version of the titertable only. When a map is merged, the titer tables are merged but a record ofthe original titers associated with each map are kept as titer table layersso that information on the original set of titers that made up the merge isnot lost. At the same time, the merged titer version of the titer table iscreated and saved as the titer_table_flat attribute. When you access titersthrough thetiterTable() function, the flat version of the titer table isretrieved (only really a relevant distinction for merged maps). When you settiters throughtiterTable<-() titer table layers are lost. These functionsallow you to manipulate the flat version without affecting the titer tablelayers information.
Usage
titerTableFlat(map)titerTableFlat(map) <- valueArguments
map | The acmap object |
value | A character matrix of titers to set |
Value
Returns a character matrix of titers.
See Also
Other map attribute functions:acmapAttributes,adjustedLogTiterTable(),adjustedTiterTable(),dilutionStepsize(),logtiterTableLayers(),mapDescription(),mapName(),titerTableLayers(),titerTable()
Getting and setting titer table layers
Description
Functions to get and set the underlying titer table layers of a map (seedetails).
Usage
titerTableLayers(map)titerTableLayers(map) <- valueArguments
map | The acmap object |
value | A list of titer table character vectors to set |
Details
When you merge maps withmergeMaps() repeated antigen - serumtiters are merged to create a new titer table but information on theoriginal titers is not lost. The original titer tables, aligned to theirnew positions in the merged table, are kept as separate layers that can beaccessed with these functions. If you have merged a whole bunch ofdifferent maps, these functions can be useful to check for example,variation in titer seen between a single antigen and serum pair.
Value
A list of character matrices of titers.
See Also
Other map attribute functions:acmapAttributes,adjustedLogTiterTable(),adjustedTiterTable(),dilutionStepsize(),logtiterTableLayers(),mapDescription(),mapName(),titerTableFlat(),titerTable()
Translate a map
Description
Translates map coordinates
Usage
translateMap(map, translation, optimization_number = NULL)Arguments
map | The acmap object |
translation | Translation to apply (as vector or n x 1 matrix) |
optimization_number | The optimization number (or NULL to apply to alloptimizations) |
Value
An acmap object with transformation applied
See Also
Other functions relating to map transformation:applyMapTransform(),reflectMap(),rotateMap()
Calculate triangulation blobs data for an antigenic map
Description
This function is to help give an idea of how well coordinated each point isin a map, and to give some idea of uncertainty in it's position. It worksby moving each point in a grid search and seeing how the total map stresschanges, see details.
Usage
triangulationBlobs( map, optimization_number = 1, stress_lim = 1, grid_spacing = 0.25, antigens = TRUE, sera = TRUE, .check_relaxation = TRUE, .options = list())Arguments
map | The acmap data object |
optimization_number | The optimization number to check |
stress_lim | The blob stress limit |
grid_spacing | Grid spacing to use when searching map space andinferring the blob |
antigens | Should triangulation blobs be calculated for antigens |
sera | Should triangulation blobs be calculated for sera |
.check_relaxation | Should a check be performed that the map is fullyrelaxed (all points in a local optima) before the search is performed |
.options | List of named optimizer options to use when checking maprelaxation, see |
Details
The region or regions of the plot where total map stress is notincreased above a certain threshold (stress_lim) are shown when the mapis plotted. This function is really to check whether point positions areclearly very uncertain, for example the underlying titers may support anantigen being a certain distance away from a group of other points but dueto the positions of the sera against which it was titrated the directionwould be unclear, and you might see a blob that forms an arc or "banana"that represents this. Note that it is not really a confidence intervalsince a point may be well coordinated in terms of the optimization butit's position may still be defined by perhaps only one particular titerwhich is itself uncertain. For something more akin to confidence intervalsyou can use other diagnostic functions likebootstrapMap().
Value
Returns the acmap data object with triangulation blob information added,which will be shown when the map is plotted
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),unstableMaps
Notes on unstable maps
Description
Tips for exploring maps that are difficult to find a consistent optimal solution for.
Details
Maps may be difficult to optimize or unstable for a variety of reasons, a commonone with larger maps being simply that it is difficult to find a global optimaand so many different local optima are found each time.
One approach that can sometimeshelp is to consider running the optimizer withoptions = list(dim_annealing = TRUE)(see seevignette("intro-to-antigenic-cartography") for an explanation of thedimensional annealing approach). However be wary that in our experience, while applyingdimensional annealing can sometimes significantly speed up finding a better minima, itcan also sometimes be more prone to getting stuck in worse local optima.
If there are many missing or non-detectable titers it is alsopossible that points in map are too poorly connected to find a robustsolution, to check this seemapCohesion().
See Also
Other map diagnostic functions:agCohesion(),bootstrapBlobs(),bootstrapMap(),checkHemisphering(),dimensionTestMap(),logtiterTable(),map-table-distances,mapBootstrapCoords,mapDistances(),mapRelaxed(),mapResiduals(),pointStress,ptBootstrapBlob,ptBootstrapCoords(),ptLeverage,ptTriangulationBlob,recalculateStress(),stressTable(),tableColbases(),tableDistances(),triangulationBlobs()
Update the ferret serum names to match antigens
Description
Update the ferret serum names to match antigens
Usage
update_ferret_seraNames(map, dictionary_file = NULL)Arguments
map | The map data object |
dictionary_file | The path to the dictionary file you want to use(should be .csv). If not supplied then the default dictionary that comeswith Racmacs will be used. |
Value
Returns the updated map data object
S3 method for viewing objects
Description
S3 method for viewing objects
Usage
view(x, ...)Arguments
x | The object to view |
... | Additional arguments, not used. |
Value
When called on an acmap object, returns an htmlwidget object thatcan be used to interactively view the map. Otherwise by default itsimply calls the print method of the respective object with no returnvalue.
See Also
Other functions to view maps:RacViewer.options(),RacViewer(),export_viewer(),ggplot.acmap(),mapGadget(),plot.acmap(),setLegend(),view.acmap(),view.default()
Viewing racmap objects
Description
View a racmap object in the interactive viewer.
Usage
## S3 method for class 'acmap'view( x, optimization_number = 1, ..., .jsCode = NULL, .jsData = NULL, select_ags = NULL, select_sr = NULL, show_procrustes = NULL, show_diagnostics = NULL, num_optimizations = 1, options = list())Arguments
x | The acmap data object |
optimization_number | The optimization number to view |
... | Additional arguments to be passed to |
.jsCode | Additional javascript code to be run after map has been loadedand rendered |
.jsData | Any data to supply to the .jsCode function |
select_ags | A vector of antigen indices to select in the plot |
select_sr | A vector of serum indices to select in the plot |
show_procrustes | If the map contains procrustes information, shouldprocrustes lines be shown by default? |
show_diagnostics | If the map contains diagnostics information likestress blobs or hemisphering, should it be shown by default? |
num_optimizations | Number of optimization runs to send to the viewerfor inclusion in the "optimizations" pane. |
options | A named list of viewer options to pass to |
Value
Returns an htmlwidget object
See Also
Other functions to view maps:RacViewer.options(),RacViewer(),export_viewer(),ggplot.acmap(),mapGadget(),plot.acmap(),setLegend(),view.default(),view()
Other shiny app functions:RacViewer-shiny,runGUI()
Default method for viewing objects
Description
Default method for viewing objects
Usage
## Default S3 method:view(x, ...)Arguments
x | The object to view |
... | Additional arguments, passed to print. |
Value
No value returned, simply calls the print method on the object
See Also
Other functions to view maps:RacViewer.options(),RacViewer(),export_viewer(),ggplot.acmap(),mapGadget(),plot.acmap(),setLegend(),view.acmap(),view()