View source: R/5-selectReference.R
selectReference | R Documentation |
This function selects the optimal reference component from the log-ratio
transformed data matrix based on the provided ivar
(index variable)
and alpha
values.
selectReference(counts, ivar, alpha)
counts |
A data matrix representing counts. It is assumed that the matrix contains numerical values only. |
ivar |
An indicator specifying the method for log-ratio transformation. It can take the following values: - "clr" (default): Centered log-ratio transformation. - "alr": Additive log-ratio transformation ("pcor.bshrink" metric only). - "iqlr": Inter-quartile log-ratio transformation from ALDEx2. - The explicit name(s) or index(es) of variable(s) to use as a reference. - Use NA to skip log-ratio transformation and any other pre-processing, like zero replacement. This is useful when the input data is already pre-processed. |
alpha |
The alpha parameter used in the alpha log-ratio transformation. |
The function transforms the input counts
matrix into log space using
the logratio
function. Then, it calculates the variance of each
component and identifies the component with the minimum variance,
which is considered the optimal reference.
The column name or index of the optimal reference component.
# Sample counts matrix
counts_matrix <- matrix(c(10, 20, 30, 40, 0, 50, 60, 70, 0), nrow = 3, byrow = TRUE)
colnames(counts_matrix) <- c("A", "B", "C")
rownames(counts_matrix) <- c("Sample1", "Sample2", "Sample3")
# Select optimal reference component
selectReference(counts_matrix, ivar = "A", alpha = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.