Subsetting Affybatch
3
1
Entering edit mode
10.3 years ago
Assa Yeroslaviz ★ 1.7k

Hi,

I read several files into an affybatch object. In the next step I would like to run a normalization for only a specific subset of genes from this affyBatch.

The problem is, that there are no gene names in the object. Each probeSet has several probes and

Is there a way to subset an affyBatch?

Thanks

Assa

r affymetrix • 6.0k views
0
Entering edit mode
10.3 years ago

This is always a problem I run in to when using eSet objects in R. It seems that these data structures are meant to contain all of your probe-level data (intensity values from your CEL files) as rows and columns in the matrix assayData, as well as phenotype info (in this case, probably the names of your CEL files) in a phenoData slot. You also have an annotation slot in this object, which I am assuming you want to contain gene names for each set of probes covering those genes. Well, guess what? Assuming you created this eSet object using "read.affybatch" or "ReadAffy" http://rss.acs.unt.edu/Rdoc/library/affy/html/read.affybatch.html) it seems that there is no way to specify this annotation information.

I work at the same university as the people who created these data structures, and, while I am sure they make sense to the creators, they can be pretty opaque to outsiders. If you want to subset your affyBatch object, the best you can do is specifying some rows or probe names from the assayData slot, or sample names from the phenoData slot.

sub.affyBatch <- affyBatch@assayData[,affyBatch@phenoData\$samplename] # I think this gets the probe level data for one sample of "samplename".
sub.affyBatch2 <- affyBatch@assayData[which(rownames(affyBatch@assayData)=="rsid"),] # I think this grabs one probe from the probe level data across all your samples.


The above examples may not work, but this is the type of thing I think you are looking for.

3
Entering edit mode

The basic operations are summarized on ?"AffyBatch-class"; generally using direct slot access (those @) will only lead to tears.

0
Entering edit mode

Note that this won't create new AffyBatch instances, but a matrix of number of probes by number of arrays.

0
Entering edit mode

But than it won't help me much as I'll need to coerce it into an affyBatch object all over again.

The Idea is, that I would like to remove the probe set which were found absent by the mas5-test from affymetrix. Is there a different way to make sure to normalize the data only with the present probes?

0
Entering edit mode
10.2 years ago
Davy ▴ 210

Perhaps someone might correct me but I think that if you know the probe ids of the probes you want to remove then you can do:

probes.to.remove <- c(<probe ids go here>)
affy.batch.data <- affy.batch.data[!(featurenames(affy.batch.data) %in% probes.to.remove), ]

0
Entering edit mode

This did not work for me, since the number of features is not the same as the dimensions of the AffyBatch object:

affy.batch.data <- d[, !(featureNames(d) %in% probes.to.remove)]
Error in d[, !(featureNames(d) %in% probes.to.remove)] :
(subscript) logical subscript too long

0
Entering edit mode
10.1 years ago
Assa Yeroslaviz ★ 1.7k

I have found this answer from 2009:

Select an affyBatch subset prior to normalization

But This is not exactly sub-setting the affyBatch, but sub-setting the environment I am working with this affyBatch. It seems quite harsh to me. To add to that, I tried to detach the environment & load it back. I always got the same modified environment. To get the old, complete one. I needed to quit and restart the session (which is annoying).

Isn't there any way one can sub-set an affyBatch?