-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathISM-utils.R
68 lines (49 loc) · 1.46 KB
/
ISM-utils.R
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
#' @include ISM.R
NULL
# PUBLIC -----------------------------------------------------------------------
# PRIVATE ----------------------------------------------------------------------
# Generate named list of files in either rawdata or analysis/exprs_matrices folders
ISM$set(
which = "private",
name = ".getGEFileNames",
value = function(rawdata) {
studies <- private$.getSdyVec()
# check webdav folder for presence of rawdata
file_list <- lapply(studies, FUN = function(sdy) {
suffix <- ifelse(rawdata,
"/%40files/rawdata/gene_expression?method=JSON",
"/%40files/analysis/exprs_matrices?method=JSON"
)
dirLink <- paste0(
self$config$labkey.url.base,
"/_webdav/Studies/",
sdy,
suffix
)
files <- private$.listISFiles(dirLink)
if (rawdata) {
if (!is.null(files)) {
files <- files[grep("\\.(tsv|csv|cel|txt)$", files, ignore.case = T)]
files <- length(files) > 0
}
}
return(files)
})
names(file_list) <- studies
return(file_list)
}
)
# Get vector of study folders
ISM$set(
which = "private",
name = ".getSdyVec",
value = function() {
studies <- labkey.getFolders(
baseUrl = self$config$labkey.url.base,
folderPath = "/Studies/"
)[, 1]
studies <- studies[grepl("SDY[0-9]+", studies)]
studies
}
)
# HELPER -----------------------------------------------------------------------