LoadOntoPCs.Rd
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"))
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 |
sampleID | Are the sample IDs in the first column of |
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
.
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.
### 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 )#> # 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>