LoadOntoPCs {pathwayPCA} | R Documentation

## Calculate Test Data PCs from Training-Data Estimated Loadings

### Description

Given a list of loading vectors from a training data set, calculate the PCs of the test data set.

### Usage

    LoadOntoPCs(design_df, loadings_ls, sampleID = c("firstCol", "rowNames"))

### Arguments

`design_df` | A test data frame with rows as samples and named features as columns
`loadings_ls` | A list of p \times d loading vectors or matrices as returned by either the `SuperPCA_pVals`, `AESPCA_pVals`, or `ExtractAESPCs` functions. These lists of loadings will have feature names as their row names. Such feature names must match a subset of the column names of `design_df` exactly, as pathway-specific test-data subsetting is performed by column name.
`sampleID` | Are the sample IDs in the first column of `design_df` or in accessible by `rownames(design_df)`? Defaults to the first column. If your data does not have sample IDs for some reason, set this to `rowNames`.

### Details

This function takes in a list of loadings and a training-centered test data set, applies over the list of loadings, subsets the columns of the test data by the row names of the loading vectors, right-multiplies the test-data subset matrix by the loading vector / matrix, and returns a data frame of the test-data PCs for each loading vector.

### Value

A data frame with the PCs from each pathway concatenated by column. If you have the `tidyverse` loaded, this object will display as a `tibble`.

### Examples

      ###  Load the Data  ###
      data("colonSurv_df")
      data("colon_pathwayCollection")

      ###  Create -Omics Container  ###
      colon_Omics <- CreateOmics(
        assayData_df = colonSurv_df[, -(2:3)],
        pathwayCollection_ls = colon_pathwayCollection,
        response = colonSurv_df[, 1:3],
        respType = "survival"
      )

      ###  Extract AESPCs  ###
      colonSurv_aespc <- AESPCA_pVals(
        object = colon_Omics,
        numReps = 0,
        parallel = TRUE,
        numCores = 2,
        adjustpValues = TRUE,
        adjustment = c("Hoch", "SidakSD")
      )

      ###  Project Data onto Pathway First PCs  ###
      LoadOntoPCs(
        design_df = colonSurv_df,
        loadings_ls = colonSurv_aespc$loadings_ls
      )

[Package pathwayPCA version 1.4.0 Index]