SCFA.class: SCFA.class

Description Usage Arguments Value Examples

View source: R/SCFA.R

Description

Perform risk score prediction on input data. This function requires training data with survival information. The output is the risk scores of patients in testing set.

Usage

1
SCFA.class(dataListTrain, trainLabel, dataListTest, ncores = 10L, seed = NULL)

Arguments

dataListTrain

List of training data matrices. In each matrix, rows represent samples and columns represent genes/features.

trainLabel

Survival information of patient in training set in form of Surv object.

dataListTest

List of testing data matrices. In each matrix, rows represent samples and columns represent genes/features.

ncores

Number of processor cores to use.

seed

Seed for reproducibility, you still need to use set.seed function for full reproducibility.

Value

A vector of risk score predictions for patient in test set.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#Load example data (GBM dataset)
data("GBM")
#List of one matrix (microRNA data)
dataList <- GBM$data
#Survival information
survival <- GBM$survival
library(survival)
#Split data to train and test
set.seed(1)
idx <- sample.int(nrow(dataList[[1]]), round(nrow(dataList[[1]])/2) )
survival$Survival <- survival$Survival - min(survival$Survival) + 1 # Survival time must be positive
trainList <- lapply(dataList, function(x) x[idx, ] )
trainSurvival <- Surv(time = survival[idx,]$Survival, event =  survival[idx,]$Death)
testList <- lapply(dataList, function(x) x[-idx, ] )
testSurvival <- Surv(time = survival[-idx,]$Survival, event =  survival[-idx,]$Death)
#Perform risk prediction
result <- SCFA.class(trainList, trainSurvival, testList, seed = 1, ncores = 2L)
#Validation using concordance index
c.index <- concordance(coxph(testSurvival ~ result))$concordance
print(c.index)

SCFA documentation built on Nov. 8, 2020, 6:58 p.m.