ExtractAESPCs {pathwayPCA} | R Documentation

## Extract AES-PCs from recorded pathway-subsets of a mass spectrometry or bio-assay data frame

### Description

Given a clean `OmicsPath` object (cleaned by the `IntersectOmicsPwyCollct` function), extract the first principal components (PCs) from each pathway with features recorded in the assay design matrix.

### Usage

    ExtractAESPCs(
      object,
      numPCs = 1,
      parallel = FALSE,
      numCores = NULL,
      standardPCA = FALSE,
      ...
    )

    ## S4 method for signature 'OmicsPathway'
    ExtractAESPCs(
      object,
      numPCs = 1,
      parallel = FALSE,
      numCores = NULL,
      standardPCA = FALSE,
      ...
    )

### Arguments

`object` | An object of class `OmicsPathway`.
`numPCs` | The number of PCs to extract from each pathway. Defaults to 1.
`parallel` | Should the computation be completed in parallel? Defaults to `FALSE`.
`numCores` | If `parallel = TRUE`, how many cores should be used for computation? Internally defaults to the number of available cores minus 2.
`standardPCA` | Should the function return the AES-PCA PCs and loadings (`FALSE`) or the standard PCA PCs and loadings (`TRUE`)? Defaults to `FALSE`.
`...` | Dots for additional internal arguments (currently unused).

### Details

This function takes in a data frame with named columns and a pathway list as an `OmicsPathway` object which has had unrecorded -Omes removed from the corresponding pathway collection by the `IntersectOmicsPwyCollct` function. This function will then iterate over the list of pathways, extracting columns from the assay design matrix which match the genes listed in that pathway as a sub-matrix (as a `data.frame` object). This function will then call the `aespca` on each data frame in the list of pathway-specific design matrices, extracting the first `numPCs` AES principal components from each pathway data frame. These PC matrices are returned as a named list.

NOTE: some genes will be included in more than one pathway, so these pathways are not mutually exclusive. Further note that there may be many genes in the assay design matrix that are not included in the pathways, so these will not be extracted to the list. It is then vitally important to use either a very broad and generic list of pathways or a pathways list that is compatible to the assay data supplied.

### Value

Two lists of matrices: `PCs` and `loadings`. Each element of both lists will be named by its pathway. The elements of the `PCs` list will be N \times `numPCs` matrices containing the first `numPCs` principal components from each pathway. The elements of the `loadings` list will be `numPCs` \times p projection matrices containing the loadings corresponding to the first `numPCs` principal components from each pathway. See "Details" for more information.

### See Also

`CreateOmicsPath`; `aespca` `IntersectOmicsPwyCollct`

### Examples

      # DO NOT CALL THIS FUNCTION DIRECTLY.
      # Use AESPCA_pVals() instead

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

      ###  Create an OmicsSurv Object  ###
      colon_Omics <- CreateOmics(
        assayData_df = colonSurv_df[, -(2:3)],
        pathwayCollection_ls = colon_pathwayCollection,
        response = colonSurv_df[, 1:3],
        respType = "surv"
      )

      ###  Extract Pathway PCs and Loadings  ###
      ExtractAESPCs(
        object = colon_Omics,
        parallel = TRUE,
        numCores = 2
      )

[Package pathwayPCA version 1.6.3 Index]