metamoRph
metamoRph.RdTakes in a count matrix (where genes (features) are rows and samples are
columns) as well as a named vector with the eigenvalues (see run_pca())
and pulls the gene (feature) information from the rotation vector and cuts down
the new_counts matrix to match the rotation vector gene (feature) names. Any
genes (features) missing from the input new_counts matrix will be replaced with zeros.
Usage
metamoRph(
new_counts,
rotation,
center_scale = NULL,
normalization = TRUE,
sample_scale = "cpm",
feature_scale = FALSE,
log1p = TRUE
)Arguments
- new_counts
raw gene count matrix (where genes are rows and samples are columns)
- rotation
matrix where the row names are genes and the col names are the principal components. If you used metamoRph::run_pca() then this would be in the output$PCA$rotation slot.
- center_scale
list object where the $center slot has the center values and the $scale slot has the scale value for the "scale" function. If you do not give a value here, then feature/gene scaling WILL NOT HAPPEN.
- normalization
Default is TRUE, if set to FALSE will override
sample_scaleandlog1pand not do any sample scaling- sample_scale
Options include
cpm,seurat,zscale, andnone. This MUST match the normalization used in the data forrun_pca(or where your rotation came from).- feature_scale
Default is FALSE, if TRUE will apply feature (gene) scaling to the input (query) data (if center_scale is left empty). VERY DANGEROUS as this will likely put the query data in a different scale than your reference data. Use with deliberate intent.
- log1p
Default is TRUE. Again, must match the normalization used in the data for
run_pca(or where your rotation came from).
Value
A matrix with the transformated eigenvalue matrix which should be equivalent to the original rotation matrix's eigenvalue/pattern matrix (The $x slot from the output of prcomp)
Details
The function will scale the new_counts matrix in the same manner as run_pca()
and matrix multiply by the rotation vector. The output is equivalent
to the prcomp "$x" matrix.