Reputation: 119
I have a mircoarray dataset from the illumina beadchip platform which I have been using to examine differential expression between 3 treatment groups. Following background subtraction and normalisation I have a file of class "Elist" type - represented as below.
$E
A B C D E F
ILMN_1 9.678162 9.635665 9.420577 9.778417 9.521473 9.820778
ILMN_2 11.458221 11.152161 11.158666 11.410278 11.416522 11.377062
ILMN_3 9.385075 9.087426 9.230654 9.704379 9.720282 9.482488
ILMN_4 9.909423 9.115123 9.693177 10.348670 9.896625 9.729896
ILMN_5 11.826927 12.067796 12.165630 12.256113 12.061949 12.213470
$genes
SYMBOL
ILMN_1 Gene 1
ILMN_2 Gene 2
ILMN_3 Gene 3
ILMN_4 Gene 4
ILMN_5 Gene 5
I would now like to create an object of "Elist" class which includes only a subset of genes selected by their gene symbol with a view to generating a heatmap of the subset. ( I should be able to manage the heatmap from there)
eg
$E
A B C D E F
ILMN_2 11.458221 11.152161 11.158666 11.410278 11.416522 11.377062
ILMN_4 9.909423 9.115123 9.693177 10.348670 9.896625 9.729896
$genes
SYMBOL
ILMN_2 Gene 2
ILMN_4 Gene 4
I have tried
subset = Elist[Elist$genes == c("gene 2", "gene4"), ]
but this seems to only generate a subset of the first gene in the vector or occasionally several rows of NAs. If I inset just one gene into the vector it works fine.
subset = Elist[Elist$genes %in% c("gene 2", "gene4"), ]
Any help much appreciated. (any advice on how to post the question better appreciated too!)
Many thanks - Vincents answer works very well - the solution was
subset = Eset[ Eset$genes$SYMBOL %in% c("Gene2", "Gene4"), ]
I would now like to make a heatmap of the gene subset firstly being able to order the columns myself into treatment groups and secondly replacing the row names with gene names rather than the probe name.
I am able the remove the clustering order using Colv but unable to get any further
heatmap.2(Subset$E, Colv = FALSE, Rowv = FALSE)
Any help much appreciated.
Upvotes: 0
Views: 1000
Reputation: 3429
Let's call this object expr
, instead of EList
(the name of the class itself):
require(limma)
expr <- new("EList"
, .Data = list(structure(list(A = c(9.678162, 11.458221, 9.385075, 9.909423, 11.826927),
B = c(9.635665, 11.152161, 9.087426, 9.115123, 12.067796),
C = c(9.420577, 11.158666, 9.230654, 9.693177, 12.16563),
D = c(9.778417, 11.410278, 9.704379, 10.34867, 12.256113),
E = c(9.521473, 11.416522, 9.720282, 9.896625, 12.061949),
F = c(9.820778, 11.377062, 9.482488, 9.729896, 12.21347)),
.Names = c("A", "B", "C", "D", "E", "F"),
class = "data.frame",
row.names = c("ILMN_1", "ILMN_2", "ILMN_3", "ILMN_4", "ILMN_5")),
structure(list(SYMBOL = c("Gene1","Gene2", "Gene3", "Gene4", "Gene5")),
.Names = "SYMBOL",
row.names = c("ILMN_1","ILMN_2", "ILMN_3", "ILMN_4", "ILMN_5"),
class = "data.frame")))
We would like to select in the object the lines corresponding to genes 1 and 3. A previous comment pointed to the right direction, the following should normally work:
expr[ expr$genes$SYMBOL %in% c("Gene2", "Gene4"), ]
Am I missing a question about heatmaps, I don't see any?
Upvotes: 0