dist_to_titer_table {topolow} | R Documentation |
Convert Distance Matrix to Titer Panel Format
Description
Converts a distance matrix to a titer panel format, handling threshold measurements and logarithmic transformations common in antigenic cartography. The function identifies reference points (typically antisera) and challenge points (typically antigens) based on row/column name prefixes.
Usage
dist_to_titer_table(input_matrix, base = exp(1), tens = 1)
Arguments
input_matrix |
Matrix of distances, with row/column names prefixed with "V/" for antigens and "S/" for sera |
base |
Numeric. Base for logarithmic transformation. Default exp(1). For HI Assay 2 |
tens |
Numeric. Scaling factor for final titers. Default 1. For HI Assay 10 |
Details
The function:
Identifies antigen and serum entries from matrix row/column names
Creates titer table from antigen-serum pairs
Handles threshold indicators (< and >) in distance values
Applies appropriate transformations to convert distances to titers
Transformation steps:
Extract numeric values from thresholded measurements
Convert distances to titers via logarithmic transformation
Apply scaling factor
Reapply threshold indicators to transformed values
Value
A matrix
of titers with:
Rows corresponding to antigen strains (without "V/" prefix)
Columns corresponding to antisera (without "S/" prefix)
Values as character strings including threshold indicators where applicable
-
NA
values replaced with "*"
Examples
# Create sample distance matrix
dist_mat <- matrix(c(0, 2, ">3", 2, 0, 4, "3", 4, 0), nrow=3)
rownames(dist_mat) <- c("V/strain1", "V/strain2", "S/serum1")
colnames(dist_mat) <- c("V/strain1", "V/strain2", "S/serum1")
# Convert to titer panel
titer_panel <- dist_to_titer_table(dist_mat)