





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Due Date: March 14, 2006
Objective
We will use the data set presented in Golub et al. (1999) and available in an online repository from the authors ( http://www-genome.wi.mit.edu/mpr/data set ALL AML.html) and were included in a R data package, golubEsets in Bioconductor. The expres- sion data in this dataset are from the study of gene expression in two types of acute leukemias: acute lympho lasic leukemia (ALL) and acute myeloid leukemia (AML). Gene expression levels were measure using Affymetrix high-density oligonucleotide arrays (HU6800 chip) containing probes for 6,817 human genes and ESTs. The chip actually contains 7,129 different probe sets; some of these map to the sample genes and others are there for quality control purposes. The data comprise of 38 samples of ALL (38 B-cell ALL and 9 T-cell ALL) and 25 samples of AML. These samples are further divided into a training set (golubTrain) with 38 observations and a test set (golubTest) of 34 observations. We will use 38 samples in the training set golubTrain (27 ALL and 11 AML) for clustering analysis.
library(Biobase) library(cluster) library(genefilter) library(stats) library(golubEsets)
If you encounter any error, you may have to download the individual package and install it manually (Search CRAN network to find the package).
In this lab we assume that the packages have been successfully loaded. We will walk through the steps for data preprocessing and clustering. Remember to save your results and findings as they will be handed in after the exercise.
2 Data
We can obtain the expression measures in the form of exprSets by using the data function:
data(golubTrain)
Let us take a closer look at the object golubTrain:
class(golubTrain) [1] "exprSet" slotNames(golubTrain) [1] "exprs" "se.exprs" "description" "annotation" "notes" "reporterInfo" "phenoData" golubTrain Expression Set (exprSet) with 7129 genes 38 samples phenoData object with 11 variables and 38 cases varLabels Samples: Sample index ALL.AML: Factor, indicating ALL or AML BM.PB: Factor, sample from marrow or peripheral blood T.B.cell: Factor, T cell or B cell leuk. FAB: Factor, FAB classification Date: Date sample obtained Gender: Factor, gender of patient pctBlasts: pct of cells that are blasts
Gender: Factor, gender of patient pctBlasts: pct of cells that are blasts Treatment: response to treatment PS: Prediction strength Source: Source of sample
The matrix of expression measures can be accessed using either the general @ operator or the slot function from the methods package. It can also be accessed through the accessor function exprs provided in Biobase.
X <- golubTrain@exprs X <- slot(golubTrain, "exprs") X <- exprs(golubTrain) dim(X) [1] 7129 38
3 Genefilter
One of the tasks before carrying out the analysis is to exclude those genes that are unlikely to be of interest. The approach taken in genefilter is to separate the task of specifying the filters that will be used from the task of applying them. We first specify which filtering functions we want to use, assemble them using filterfun, and then apply them using genefilter.
We will apply four pre-processing steps to the normalized matrices of intensity values:
Now all values in matrix X that were less than 100 are replaced by 100 and all values that were larger than 16,000 are replaced by 16,000.
mmfilt <- function(r=5, d=500, na.rm=TRUE) { function(x) { minval <- min(x, na.rm=na.rm) maxval <- max(x, na.rm=na.rm) (maxval/minval > r) && (maxval-minval > d) } } mmfun <- mmfilt() ffun <- filterfun(mmfun) good <- genefilter(X, ffun) sum(good) [1] 3051 X <- X[good, ]
X <- log10(X)
X <- scale(X) golubTrainSub <- golubTrain[good, ] slot(golubTrainSub, "exprs") <- X golubTrainSub
We save the workspace at this point and it will be used in future exercises.
save("golub.RData", file = file.choose())
save.image(file = "C:/Documents and Settings/Lei/My Documents/ Bitmap/golub.RData",version = NULL, ascii = FALSE, compress = FALSE, safe = TRUE)
Now we reduce the number of genes from original dataset 7129 to 3051. Can we make a good clustering analysis? Let us cluster the data using two different algorithms - hierarachical and k-mean. Keep in mind that we already know the label of each sample (either ALL or AML) in this lab. The exercise just gives you a sense of how the clustering algorithms work. In practice, we don’t have much knowledge about the label of the samples we study.
Now we have genes which are significantly different according to their express pattern. Let us examine a number of statistics of them, such as, ALL and AML mean expression levels, t-statistics, and nominal p-values.
X2 <- exprs(golubTrainSub[smallp, ]) stats <- apply(X2, 1, function(z){ res <- t.test(z ~ c1) c(res$estimate,res$statistic,res$parameter,res$p.value) } ) stats <- data.frame(t(stats)) names(stats) <- c("ALL mean","AML mean","t-statistic","df","p-value") stats <- stats[order(stats$p), ]
Repeat the previous clustering procedure.
6 Partitioning method - k-means
In hierarchical methods, the samples are arranged in a hierarchy according to a dissimilarity measure. Extracting clusters means cutting the tree-like hierarchy at a certain level. Increasing the number of clusters is just subdividing existing clus- ters - clusters are nested.
In partitioning methods this is different. You have to decide on a fixed number k of clusters before the clustering process. Samples are then assigned to the cluster where they best fit in. This is more flexible than hierarchical clustering, but leaves you with the problem of selection of k. Increasing the number of clusters is not subdivision of existing clusters but can result in a totally new allocation of samples.
Before doing k-means clustering, please read the help file of kmeans (help(kmeans)). First we set the number of cluster to k=2. Then perform k-means clustering for all samples and all genes. k-means uses a random starting solution and thus different runs can lead to different results. Run k-means 10 times and use the result with smallest within-cluster variance.
k <- 2 withinss <- Inf for (i in 1:10) { kmeans.run <- kmeans(t(X),k) print(sum(kmeans.run$withinss)) print(table(kmeans.run$cluster, c1)) cat("----\n") if (sum(kmeans.run$withinss) < withinss) { result <- kmeans.run withinss <- sum(result$withinss)
} }
table(result$cluster, c1)
This result is the statistically best out of 10 tries - but does it reflect biology? Now perform k-means again using the 100 top-variance genes.
k <- 2 withinss <- Inf X3 <- X2[1:100, ] for (i in 1:10) { kmeans.run <- kmeans(t(X3),k) print(sum(kmeans.run$withinss)) print(table(kmeans.run$cluster, c1)) cat("----\n") if (sum(kmeans.run$withinss) < withinss) { result <- kmeans.run withinss <- sum(result$withinss) } }
7 What do you need to submit?