Skip to content

Commit

Permalink
Fixing getGistic for windows and linux, needs to be tested in mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Chedraoui Silva committed Nov 2, 2016
1 parent 790398a commit 3e2d43d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/TCGAInternal.R
Original file line number Diff line number Diff line change
Expand Up @@ -529,18 +529,24 @@ getGistic <- function(disease) {
x <- x[grep("CopyNumber_Gistic2.Level_4",x)]

if(!file.exists(x[1])) {
if(is.windows()) mode <- "wb" else mode <- "w"
if(Sys.info()["sysname"] == "Windows") mode <- "wb" else mode <- "w"
downloader::download(file.path(base,x[1]),x[1], mode = mode)
}
# Check if downlaod was not corrupted
md5 <- readr::read_table(file.path(base,x[2]), col_names = FALSE, progress = FALSE)$X1
if(tools::md5sum(x[1]) != md5) stop("Error while downloading CNV data")
if(is.linux()) {
print(x[1])
if(Sys.info()["sysname"] == "Linux") {
untar(x[1],files = "*all_thresholded.by_genes.txt", extras = "--wildcards")
} else {
untar(x[1],files = "*all_thresholded.by_genes.txt")
}
file <- paste0(gsub(".tar.gz","",x[1]),"/all_thresholded.by_genes.txt")
if(!file.exists(file)) {
compressed.files <- untar(x[1], list = TRUE)
compressed.files <- compressed.files[grepl("all_thresholded.by_genes.txt", compressed.files)]
untar(x[1],files = compressed.files )
}
ret <- tryCatch({
fread(file, data.table = FALSE, colClasses = "character")
}, error = function(e) {
Expand Down

0 comments on commit 3e2d43d

Please sign in to comment.