This file is indexed.

/usr/lib/R/site-library/Biobase/scripts/getBioC.R is in r-bioc-biobase 2.14.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# This function gets and installs the required Bioconductor libraries.
#
# libName: a vector of character string for the name of the library to be
# installed. Valid names include "all" - all the released packages,
# "affy" - packages "affy" plus exprs, "CDNA" - packages "CDNA" plus
# exprs, and "exprs" - packages "Biobase", "annotate", "genefilter",
# "geneploter", "edd", "Roc", and "tkWidgets".
# destdir: a character string for the directory where the downloaded
# packages will be stored.
# isDevel: a boolean indicating whether the released (FALSE) or
# developer (TRUE) version will be downloaded and installed.
# verbose: a boolean indicating whether any error related to the
# downloading process will be (TRUE) printed. Error messages will
# still be returned but invisible if berbose is set to FALSE.
# bundle: a boolean indicating whether packages will be downloaded as
# bundles (TRUE) or individual packages (FALSE). Valid bundle
# (e. g. "all", "exprs") or package ("tkWidgets", "annotate") have to
# be used in each case.
#
getBioC <- function (libName = "exprs", destdir = NULL, isDevel = FALSE,
                     verbose = TRUE, bundle = TRUE){

    on.exit(options(show.error.messages = TRUE))

    PLATFORM <- .Platform$OS.type
    DESTDIR <- ifelse(is.null(destdir), getwd(), destdir)
    messages <- NULL
    packs <- NULL

    if(bundle){
        for(i in libName){
            packs <- c(packs, getPackNames(i))
        }
    }else{
        packs <- libName
    }

    repository <- getPkgDisc(isDevel)

    for(i in packs){
        sourceUrl <- getDLURL(i, repository, PLATFORM)
        fileName <- getFileName(sourceUrl)
        # check the connection instead of downloading directly which
        # will write files of 0 size in the directory even when
        # the connection is not there.
        options(show.error.messages = FALSE)
        tryMe <- try(url(sourceUrl, "r"))
        options(show.error.messages = TRUE)

        if(inherits(tryMe, "try-error")){
           messages <- c(messages, paste("Get", i, "failed"))
        }else{
            close(tryMe)
            download.file(sourceUrl, fileName,
                         mode = getMode(PLATFORM), quiet = TRUE)
            options(show.error.messages = FALSE)
            tryMe <- try(installPack(PLATFORM, fileName))
            options(show.error.messages = TRUE)

            if(inherits(tryMe, "try-error")){
                messages <- c(messages,
                                paste("Install", i, "failed"))
            }
        }
    }
    if(is.null(messages))
        messages <- "Download was successful"
    if(verbose)
        print(messages)
    return(invisible(messages))
}

getPackNames <- function (libName){
    error <- paste("The library is not valid. Must be:",
                      "all, exprs, affy, or CDNA", sep = "\n")
    AFFY <- "affy"
    CDNA <- c("marrayInput", "marrayClasses", "marrayNorm",
           "marrayPlots")
    EXPRS <-c("Biobase", "annotate", "genefilter", "geneplotter",
              "edd", "ROC", "tkWidgets")
    switch(libName,
           "all" = return(c(EXPRS, AFFY, CDNA)),
           "exprs" = return(EXPRS),
           "affy" = return(c(EXPRS, AFFY)),
           "cdna" =,
           "CDNA" = return(c(EXPRS, CDNA)),
           stop(error))
}

getMode <- function(platform){
    switch(platform,
           "unix" = return("w"),
           "windows" = return("wb"),
           stop("OS system not surported"))
}

installPack <- function(platform, fileName){
    if(platform == "unix"){
        system(paste("R CMD INSTALL ", fileName, sep = ""), TRUE)
    }else{
        if(platform == "windows"){
            install.packages(fileName, .libPaths()[1], CRAN = NULL)
        }else{
            stop("The OS system is not supported")
        }
    }
}

getDLURL <- function(pakName, rep, platform){
    sourceURL <- NULL
    isPkg <- FALSE
    version <- 0
    higherV <- FALSE

    for(i in rep){
        if(gsub("^Package: *(.*)", "\\1", i) == pakName){
            isPkg <- TRUE
        }
        if(isPkg && regexpr("^Version:", i)[1] > 0){
            if(gsub("^Version: *(.*)", "\\1", i) > version)
                higherV <- TRUE
            else
                higherV <- FALSE
        }
        if(platform == "windows"){
            if(isPkg && higherV && regexpr("Win32URL", i)[1] > 0){
                sourceURL <- gsub("^Win32URL: *(.*)", "\\1", i)
                isPkg = FALSE
            }
        }else{
            if(isPkg && higherV && regexpr("/Source/", i)[1] > 0){
                sourceURL <- gsub("^SourceURL: *(.*)", "\\1", i)
                isPkg <- FALSE
            }
        }
    }
    return(sourceURL)
}

getPkgDisc <- function (isDevel){
    on.exit(options(show.error.messages = TRUE))

    if(isDevel)
        URL <-
            "http://www.bioconductor.org/packages/devel/distrib/PACKAGES"
    else
        URL <-
            "http://www.bioconductor.org/packages/release/distrib/PACKAGES"

    con <- url(URL)
    options(show.error.messages = FALSE)
    tryMe <- try(readLines(con))
    options(show.error.messages = TRUE)

    if(inherits(tryMe, "try-error"))
       stop("The url for BioC PACKAGES is incorrect")

    close(con)
    return(tryMe)
}

getFileName <- function(url){
    temp <- unlist(strsplit(url, "/"))
    return(temp[length(temp)])
}