# How can I collapse probes to single value per gene using GEOquery?

I have extracted microarray gene expression data from GEO using the GEOquery package in R. There are multiple probes per gene. Is there a way to select the best probe? If so, what would be the criteria and how can you do this? Maybe use Jetset probes (=best quality probes) for this?

Otherwise, would you use the average expression value of all probes for each gene? If so, how can you do this in R, please?

EDIT

Edit after comment below: I like the suggestion proposed here: https://support.bioconductor.org/p/70133/, using this code:

 Probesets=paste("a",1:200,sep="") # "fake probesets"
Genes=sample(letters,200,replace=T)
Value=rnorm(200)
X=data.frame(Probesets,Genes,Value) # I edited this line, as it seemed to contain an error
X=X[order(X$$Value,decreasing=T),] Y=X[which(!duplicated(X$$Genes)),]


But, I do not understand it. How is the value for each gene in Y calculated? It was commented that this is the MAD, but calculating the Median Absolute Deviation (MAD) by hand results in a different value. Could anyone help, please? Thank you.

• The post: bioinformatics.stackexchange.com/questions/3082/… helped a little bit, but did not answer all my questions. Apr 16 '20 at 4:02
• support.bioconductor.org/p/92128 Apr 16 '20 at 7:00
• Thank you. Lots of options! I still have a question. See edit above. Thank you. Apr 16 '20 at 10:54
• The trick is duplicated() being used with ! and only after sorting X in decreasing order. Basically, you sort your "values" from higher to lower and duplicated() gives you FALSE if that particular "value" was never observed in the "array of interest". When you negate this with !, you only keep the first occurence of a particular value and this first occurence would be the highest as it was sorted already in the previous step.
– haci
Apr 16 '20 at 11:39
• Thank you for your answer. That is very clear now. Now I am only left with figuring out how to calculate the MAD in R, but I will search for that. Apr 16 '20 at 12:48