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

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.

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.

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.

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" )
#> #> ====== Creating object of class OmicsSurv =======
#> The input pathway database included 676 unique features.
#> The input assay dataset included 656 features.
#> Only pathways with at least 3 or more features included in the assay dataset are #> tested (specified by minPathSize parameter). There are 15 pathways which meet #> this criterion.
#> Because pathwayPCA is a self-contained test (PMID: 17303618), only features in #> both assay data and pathway database are considered for analysis. There are 615 #> such features shared by the input assay and pathway database.
### Extract AESPCs ### colonSurv_aespc <- AESPCA_pVals( object = colon_Omics, numReps = 0, parallel = TRUE, numCores = 2, adjustpValues = TRUE, adjustment = c("Hoch", "SidakSD") )
#> Part 1: Calculate Pathway AES-PCs
#> Initializing Computing Cluster:
#> DONE
#> Extracting Pathway PCs in Parallel:
#> DONE
#>
#> Part 2: Calculate Pathway p-Values
#> Initializing Computing Cluster:
#> DONE
#> Extracting Pathway p-Values in Parallel:
#> DONE
#>
#> Part 3: Adjusting p-Values and Sorting Pathway p-Value Data Frame
#> DONE
### Project Data onto Pathway First PCs ### LoadOntoPCs( design_df = colonSurv_df, loadings_ls = colonSurv_aespc$loadings_ls )
#> # A tibble: 250 x 16 #> SampleID pathway757 pathway491 pathway781 pathway1211 pathway536 pathway60 #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 subj1 3.82 -21.0 15.3 1.86 15.6 26.9 #> 2 subj2 3.00 -20.8 15.8 0.814 16.0 27.8 #> 3 subj3 2.84 -21.7 17.5 0.896 17.1 25.4 #> 4 subj4 4.68 -19.2 12.1 2.77 14.4 28.0 #> 5 subj5 4.12 -21.4 15.6 2.24 16.9 27.6 #> 6 subj6 3.92 -20.0 14.6 1.85 16.1 26.1 #> 7 subj7 4.50 -19.7 13.9 2.47 14.3 26.8 #> 8 subj8 3.65 -21.2 16.2 1.83 16.1 26.0 #> 9 subj9 3.35 -20.8 15.3 1.39 15.3 25.6 #> 10 subj10 4.58 -20.0 15.4 2.64 15.2 26.2 #> # … with 240 more rows, and 9 more variables: pathway87 <dbl>, pathway3 <dbl>, #> # pathway187 <dbl>, pathway120 <dbl>, pathway413 <dbl>, pathway390 <dbl>, #> # pathway266 <dbl>, pathway176 <dbl>, pathway177 <dbl>