reconByUnsupervised: Reconstruct stage-2 data by PCA

View source: R/BioMM.R

reconByUnsupervisedR Documentation

Reconstruct stage-2 data by PCA

Description

Stage-2 data reconstruction by regular or sparse constrained principal component analysis (PCA).

Usage

reconByUnsupervised(
  trainDataList,
  testDataList,
  typeMode = "regular",
  topPC = 1,
  innerCore = MulticoreParam(),
  outFileA = NULL,
  outFileB = NULL
)

Arguments

trainDataList

The input training data list containing ordered collections of matrices.

testDataList

The input test data list containing ordered collections of matrices.

typeMode

The type of PCA prediction mode. Available options are c('regular', 'sparse'). (Default: regular)

topPC

The number of top PCs selected. The default is 1, i.e. the first PC.

innerCore

The number of cores used for computation.

outFileA

The file name of stage-2 training data with the '.rds' file extension. If it's provided, then the result will be saved in this file. The default is NULL.

outFileB

The file name of stage-2 training data with the '.rds' file extension. If it's provided, then the result will be saved in this file. The default is NULL.

Value

The predicted stage-2 training data and also stage-2 test data if 'testDataList' provided. If outFileA and outFileB are provided then the results will be stored in the files.

Author(s)

Junfang Chen

Examples

 
## Load data  
methylfile <- system.file('extdata', 'methylData.rds', package='BioMM')  
methylData <- readRDS(methylfile)    
## Annotation file   
probeAnnoFile <- system.file('extdata', 'cpgAnno.rds', package='BioMM')  
## Mapping CpGs into Pathways
featureAnno <- readRDS(file=probeAnnoFile)  
## Mapping CpGs into Pathways
featureAnno <- readRDS(system.file("extdata", "cpgAnno.rds", package="BioMM")) 
pathlistDB <- readRDS(system.file("extdata", "goDB.rds", package="BioMM")) 
head(featureAnno)   
dataList <- omics2pathlist(data=methylData, pathlistDB, featureAnno, 
                           restrictUp=100, restrictDown=10, minPathSize=10) 
length(dataList) 
library(BiocParallel)
param <- MulticoreParam(workers = 10) 
stage2data <- reconByUnsupervised(trainDataList=dataList, testDataList=NULL, 
                             typeMode='regular', topPC=1,  
                             innerCore=param, outFileA=NULL, outFileB=NULL) 
print(dim(stage2data))
print(head(stage2data[,1:5]))

transbioZI/BioMMex documentation built on Jan. 27, 2023, 4:14 a.m.