I am using R and the GEOQuery package for downloading a set of GEO profiles. For doing this I use the following instructions:
library(Biobase)
library(GEOquery)
gdsAcc<-getGEO('GDS1245',destdir=".")
which downloads the GDS1245.soft.gz in the specified directory.
The problem is that some GEO profiles have been removed, so when I use the above mentioned instructions in a loop and I came with something like:
gdsAcc<-getGEO('GDS450',destdir=".")
in the last case the profile GDS450 does not exist so it throws an error and the program stops. I would like to know how I can catch that error so that in case that the profile does not exist the program will continue looking for the other profiles.
My algorithm is something like:
for (i in 1:length_GEO_profiles){
disease<-GEOname
gdsName<-paste("GDS",disease,sep="")
gdsAcc<-getGEO(gdsName,destdir=".")
}
Any help?
Thanks