tests/testthat/test_read.R

test_that("downloadTCGA() function works properly", {
    expect_dimsSize_equal <- function(parameters, dimsSize){
        tmp <- tempdir()
        downloadTCGA( cancerTypes = parameters[[1]],
                      destDir = tmp,
                      date = parameters[[2]])
        
        list.files(tmp) %>%
            grep("Clinical", x = ., value = TRUE) %>%
            file.path(tmp, .)  -> folder
        
        folder %>%
            list.files() %>%
            grep("clin.merged", x = ., value=TRUE) %>%
            file.path(folder, .) %>%
            readTCGA(path = ., "clinical") -> clinical_data
        
        
        
        expect_equal( dim(clinical_data), dimsSize )
        unlink(tmp)
    }
    expect_dimsSize_equal( list( "ACC", "2015-06-01" ), c(92, 1115) )
})

Try the RTCGA package in your browser

Any scripts or data that you put into this service are public.

RTCGA documentation built on Nov. 8, 2020, 5:11 p.m.