plotKM: Plot Kaplan-Meier curves for a gene set

Description Usage Arguments Value See Also Examples

Description

Plots Kaplan-Meier survival curves for a given gene set using the cluster labels generated during the computation of p_pure to stratify patients into two survival groups. The function is a wrapper for km.coxph.plot in the survcomp package.

Usage

1
2
plotKM(geneset, survivalTimes, followup, title = NA, y.label = NA,
  x.label = NA, p.text = NA, ...)

Arguments

geneset

A geneset as returned by saps.

survivalTimes

A vector of survival times, as used in a call to saps.

followup

A vector of 0 or 1 values, indicating whether the patient was lost to followup (0) or not (1), as used in a call to saps.

title

The plot title. Defaults to "Kaplan-Meier curves for geneset [geneset["name"]]".

y.label

The y-axis label. Defaults to "Probability of survival".

x.label

The x-axis label. Defaults to "Overall survival".

p.text

Text to display in the lower left hand corner. Defaults to displaying p_pure and p_pure_adj.

...

Additional arguments to be passed to km.coxph.plot

Value

The function is used for side-effects (drawing a plot). No value is returned.

See Also

saps calculatePPure km.coxph.plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 25 patients, none lost to followup
followup <- rep(1, 25)

# first 5 patients have good survival (in days)
time <- c(25, 27, 24, 21, 26, sample(1:3, 20, TRUE))*365

# create data for 100 genes, 25 patients
dat <- matrix(rnorm(25*100), nrow=25, ncol=100)
colnames(dat) <- as.character(1:100)

# create two random genesets of 5 genes each
set1 <- sample(colnames(dat), 5)
set2 <- sample(colnames(dat), 5)

genesets <- rbind(set1, set2)

# run saps
results <- saps(genesets, dat, time, followup, random.samples=100)

set <- results$genesets[["set1"]]

# KM plots should not seperate at this point
plotKM(set, time/365, followup, x.label="Overall survival (years)")

# increase expression levels for set1 for first 5 patients
dat[1:5, set1] <- dat[1:5, set1]+10

# run saps again
results <- saps(genesets, dat, time, followup, random.samples=100)

set <- results$genesets[["set1"]]

# KM plots should now seperate
plotKM(set, time/365, followup, x.label="Overall survival (years)")

saps documentation built on Oct. 5, 2016, 4:32 a.m.