Skip to content

downloadGEObedFiles() FTP Download errors and make modifications #254

@sunv28

Description

@sunv28

The downloadGEObedFiles() code provided by the author here has an issue because the GEO server may no longer support * * FTP * * access. It is recommended to use * * HTTPS * * instead. Therefore, I have made modifications to the code and created a new function,downloadGEObedFilesHTTPS ()

downloadGEObedFilesHTTPS <- function(genome,destDir) {
    #Obtaining genomic information
    info <- getGEOInfo(genome)
    
    #Get supplementary_file column
    fnames <- as.character(info$supplementary_file)
    
    #Replace FTP with HTTPS
    fnames_https <- gsub("^ftp://", "https://", fnames)
    
    #Generate target file path
    destfiles <- sub(".*\\/", paste0(destDir, "/"), fnames_https)
    names(destfiles) <- NULL
    
    #Traverse and download files
    for (i in seq_along(fnames_https)) {
        if (!file.exists(destfiles[i])) {
            tryCatch(
                download.file(fnames_https[i], destfile = destfiles[i], mode = "wb"),
                error = function(e) message(fnames_https[i], ": file not found and skip")
            )
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions