seandavi / GEOquery

The bridge between the NCBI Gene Expression Omnibus and Bioconductor
http://seandavi.github.io/GEOquery/
Other
88 stars 36 forks source link

getGEOSuppFiles; uses already downloaded files instead of re-downloading #132

Closed dereckmezquita closed 2 years ago

dereckmezquita commented 2 years ago

getGEOSuppFiles now checks if the files were already downloaded. Happens inside the loop so checks for each file separately - if the dataset has more than one supplementary file.

result <- tryCatch({
    if (!file.exists(destfile)) {
        res <- download.file(paste(file.path(url, i), "tool=geoquery", sep = "?"), destfile = destfile, mode = "wb", method = getOption("download.file.method.GEOquery"))
        ## download.file returns a '0' on success
    } else {
      message(sprintf("Using locally cached version of supplementary file(s) %s found here:\n%s ",
        GEO, destfile))
        res <- 0
    }

    res == 0
}, error = function(e) return(FALSE), warning = function(w) return(FALSE))
seandavi commented 2 years ago

Thanks a bunch, @dereckdemezquita!