Switch to unified view

a b/tests/testthat/test-basic-workflow.R
1
# Skip these tests on CRAN
2
skip_on_cran()
3
4
context("test-basic-workflow")
5
6
data("XenaData", package = "UCSCXenaTools")
7
head(XenaData)
8
9
10
test_that("Load XenaData works", {
11
  expect_is(XenaData, "data.frame")
12
})
13
14
xe <- XenaGenerate(subset = XenaHostNames == "tcgaHub")
15
16
test_that("XenaGenerate works", {
17
  expect_is(xe, "XenaHub")
18
})
19
20
test_that("Xena Scan works", {
21
  XenaScan()
22
  XenaScan(pattern = "zzzzzzzzzzz")
23
  x1 <- XenaScan(pattern = "Blood")
24
  x2 <- XenaScan(pattern = "LUNG", ignore.case = FALSE)
25
26
  x1 %>%
27
    XenaGenerate()
28
  x2 %>%
29
    XenaGenerate()
30
})
31
32
xe2 <- XenaFilter(xe, filterDatasets = "clinical")
33
xe2 <- XenaFilter(xe2, filterDatasets = "LUAD|LUSC")
34
35
test_that("XenaFilter works", {
36
  expect_is(xe2, "XenaHub")
37
})
38
39
xe2_query <- XenaQuery(xe2)
40
41
test_that("XenaQuery works", {
42
  expect_is(xe2_query, "data.frame")
43
})
44
45
xe2_download <- XenaDownload(xe2_query, trans_slash = FALSE, download_probeMap = TRUE)
46
xe2_download <- XenaDownload(xe2_query,
47
  trans_slash = TRUE,
48
  destdir = file.path(tempdir(), "test_ucscxenatools")
49
)
50
51
# 4 ways to prepare data
52
dt1 <- XenaPrepare(file.path(tempdir(), "test_ucscxenatools"))
53
dt1 <- XenaPrepare(file.path(tempdir(), "test_ucscxenatools"), use_chunk = TRUE)
54
dt2 <- XenaPrepare(xe2_download$destfiles[1])
55
dt2 <- XenaPrepare(xe2_download$destfiles[1], use_chunk = TRUE)
56
dt3 <- XenaPrepare(xe2_download$url[1])
57
dt3 <- XenaPrepare(xe2_download$url[1], use_chunk = TRUE)
58
dt3 <- XenaPrepare(xe2_download$url, use_chunk = TRUE)
59
dt4 <- XenaPrepare(xe2_download)
60
dt4 <- XenaPrepare(xe2_download, use_chunk = TRUE)
61
62
### Simplified functions
63
expect_error(getTCGAdata("xxx"))
64
expect_error(getTCGAdata(c("UVM", "LUAD"), mRNASeq = TRUE, mRNASeqType = "xxx"))
65
expect_error(getTCGAdata(c("UVM", "LUAD"),
66
  Methylation = TRUE, MethylationType = "xxx",
67
  RPPAArray = TRUE, ReplicateBaseNormalization = FALSE
68
))
69
getTCGAdata(c("UVM", "LUAD"),
70
  GisticCopyNumber = TRUE, Gistic2Threshold = FALSE,
71
  CopyNumberSegment = TRUE, RemoveGermlineCNV = FALSE
72
)
73
getTCGAdata("LUNG", download = TRUE)
74
getTCGAdata("LUAD",
75
  clinical = FALSE, mRNASeq = TRUE,
76
  mRNAArray = TRUE, miRNASeq = TRUE, exonRNASeq = TRUE,
77
  RPPAArray = TRUE, ReplicateBaseNormalization = TRUE,
78
  Methylation = TRUE, GeneMutation = TRUE, SomaticMutation = TRUE,
79
  GisticCopyNumber = TRUE, Gistic2Threshold = TRUE, CopyNumberSegment = TRUE, RemoveGermlineCNV = TRUE
80
)
81
82
83
downloadTCGA(
84
  project = "UVM",
85
  data_type = "Phenotype",
86
  file_type = "Clinical Information"
87
)
88
downloadTCGA("xxx",
89
  data_type = "Phenotype",
90
  file_type = "Clinical Information"
91
)
92
93
availTCGA()
94
availTCGA(which = "ProjectID")
95
availTCGA(which = "DataType")
96
availTCGA(which = "FileType")
97
98
showTCGA()
99
showTCGA("LUAD")
100
101
# clean all
102
rm(list = ls())