Sylvain Mareschal, Ph.D.
Bioinformatics postdoc
December 20, 2013 at 13:59
Related entries:
This package implements the Linear Predictor Score defined by Wright et al. in PNAS, with variations and related graphical functions (heat maps, LPS plots ...). It can be downloaded on the CRAN website, or installed directly in R with install.packages("LPS").

The package is built around the LPS-class (S3 class system), whose objects are instantiated by a call to the LPS function. Such objects hold a model that can be plotted, or used for predictions using a dedicated method for the predict generic. Predictions can consist in final calls (factor), bayesian probabilities (numeric matrix) or raw scores (numeric vector), accompanied with suitable graphical representations based on heat maps.

It also provides an function similar to the stats' package one, offering several enhancements : multi-track annotation, custom layout, better control on margins and color scales. This comes with a legend plotter (heat.scale) and a palette generator (heat) that can prove especially useful to publish such figures.

Typical use

# Expression values for training group (features must be named)
expr = rbind(matrix(rnorm(1000), ncol=100), matrix(rnorm(2000), ncol=100)+2)
colnames(expr) = sprintf("gene_%i", 1:ncol(expr))

# Training group classification
group = c(rep("A",10), rep("B",20))

# Train model
coeff = LPS.coeff(data=expr, response=group)
model = LPS(data=expr, response=group, coeff=coeff, k=5)

# Predict from a new dataset
x = rbind(matrix(rnorm(500), ncol=100), matrix(rnorm(500), ncol=100)+2)
colnames(x) = sprintf("gene_%i", 1:ncol(x))
predict(model, newdata=x, type="class", plot=TRUE)
predict(model, newdata=x, type="probability", plot=TRUE)
predict(model, newdata=x, type="score", plot=TRUE)