Skip to content

Commit

Permalink
update to the latest data hubs
Browse files Browse the repository at this point in the history
  • Loading branch information
ShixiangWang committed Oct 29, 2024
1 parent 8462937 commit 2f1742d
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 62 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ VignetteBuilder:
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# UCSCXenaTools 1.6.0

- Totally 2486 datasets are included in the current list.
- Single cell hub was found disabled.
- GDC hub was completely updated.
- GDC hub was completely updated. The old GDC hub has been renamed to gdcHubV18.

# UCSCXenaTools 1.5.0

Expand Down
92 changes: 46 additions & 46 deletions R/XenaFilter.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,57 +26,57 @@ XenaFilter <- function(x,
filterCohorts = NULL,
filterDatasets = NULL,
ignore.case = TRUE, ...) {
if (is.null(filterCohorts) & is.null(filterDatasets)) {
warning("No operation for input, do nothing...")
return(x)
}
if (is.null(filterCohorts) & is.null(filterDatasets)) {
warning("No operation for input, do nothing...")
return(x)
}

cohorts_select <- character()
datasets_select <- character()
cohorts_select <- character()
datasets_select <- character()

# suppress binding notes
XenaHosts <- XenaCohorts <- XenaDatasets <- NULL
# suppress binding notes
XenaHosts <- XenaCohorts <- XenaDatasets <- NULL

if (!is.null(filterCohorts)) {
cohorts_select <- grep(
pattern = filterCohorts,
x@cohorts,
ignore.case = ignore.case,
value = TRUE,
...
)
}
if (!is.null(filterCohorts)) {
cohorts_select <- grep(
pattern = filterCohorts,
x@cohorts,
ignore.case = ignore.case,
value = TRUE,
...
)
}

if (!is.null(filterDatasets)) {
datasets_select <- grep(
pattern = filterDatasets,
x@datasets,
ignore.case = ignore.case,
value = TRUE,
...
)
}
if (!is.null(filterDatasets)) {
datasets_select <- grep(
pattern = filterDatasets,
x@datasets,
ignore.case = ignore.case,
value = TRUE,
...
)
}

if (identical(cohorts_select, character()) &
identical(datasets_select, character())) {
warning("No valid cohorts or datasets find! Please check your input.")
} else {
if (identical(cohorts_select, character()) &
!identical(datasets_select, character())) {
UCSCXenaTools::XenaGenerate(subset = XenaHosts %in% x@hosts &
XenaDatasets %in% datasets_select)
} else { # nocov start
if (!identical(cohorts_select, character()) &
identical(datasets_select, character())) {
UCSCXenaTools::XenaGenerate(subset = XenaHosts %in% x@hosts &
XenaCohorts %in% cohorts_select)
} else {
UCSCXenaTools::XenaGenerate(
subset = XenaHosts %in% x@hosts &
XenaCohorts %in% cohorts_select &
XenaDatasets %in% datasets_select
)
}
} # nocov end
}
warning("No valid cohorts or datasets find! Please check your input.")
} else {
if (identical(cohorts_select, character()) &
!identical(datasets_select, character())) {
UCSCXenaTools::XenaGenerate(
subset = XenaHosts %in% x@hosts &
XenaDatasets %in% datasets_select)
} else if (!identical(cohorts_select, character()) &
identical(datasets_select, character())) {
UCSCXenaTools::XenaGenerate(
subset = XenaHosts %in% x@hosts &
XenaCohorts %in% cohorts_select)
} else {
UCSCXenaTools::XenaGenerate(
subset = XenaHosts %in% x@hosts &
XenaCohorts %in% cohorts_select &
XenaDatasets %in% datasets_select
)
}
}
}
15 changes: 9 additions & 6 deletions R/XenaHub-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,33 @@ xena_default_hosts <- function() {
"https://ucscpublic.xenahubs.net",
"https://tcga.xenahubs.net",
"https://gdc.xenahubs.net",
"https://gdcV18.xenahubs.net",
"https://icgc.xenahubs.net",
"https://toil.xenahubs.net",
"https://pancanatlas.xenahubs.net",
"https://xena.treehouse.gi.ucsc.edu:443",
"https://pcawg.xenahubs.net",
"https://atacseq.xenahubs.net",
"https://singlecellnew.xenahubs.net",
"https://kidsfirst.xenahubs.net"
#"https://tdi.xenahubs.net"
"https://kidsfirst.xenahubs.net",
"https://tdi.xenahubs.net"
)
}

.xena_hosts <- c(
"publicHub",
"tcgaHub",
"gdcHub",
"gdcHubV18",
"icgcHub",
"toilHub",
"pancanAtlasHub",
"treehouseHub",
"pcawgHub",
"atacseqHub",
"singlecellHub",
"kidsfirstHub"
#"tdiHub"
"kidsfirstHub",
"tdiHub"
)

names(.xena_hosts) <- xena_default_hosts()
Expand Down Expand Up @@ -148,15 +150,16 @@ XenaHub <- function(hosts = xena_default_hosts(),
"publicHub",
"tcgaHub",
"gdcHub",
"gdcHubV18",
"icgcHub",
"toilHub",
"pancanAtlasHub",
"treehouseHub",
"pcawgHub",
"atacseqHub",
"singlecellHub",
"kidsfirstHub"
#"tdiHub"
"kidsfirstHub",
"tdiHub"
)) {
stopifnot(
is.character(hosts),
Expand Down
2 changes: 1 addition & 1 deletion R/XenaQuery.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ XenaQuery <- function(x) {
query <- data_list %>%
dplyr::filter(XenaDatasets %in% datasetsName) %>%
dplyr::rename(hosts = XenaHosts, datasets = XenaDatasets) %>%
dplyr::mutate(url = ifelse(.data$XenaHostNames == "gdcHub",
dplyr::mutate(url = ifelse(.data$XenaHostNames %in% c("gdcHub", "gdcHubV18"),
file.path(hosts, "download", url_encode(basename(datasets))),
file.path(hosts, "download", url_encode(datasets))
)) %>%
Expand Down
2 changes: 1 addition & 1 deletion R/XenaQueryProbeMap.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ XenaQueryProbeMap <- function(x) {
} else {
query <- query %>%
dplyr::rename(hosts = XenaHosts, datasets = ProbeMap) %>%
dplyr::mutate(url = ifelse(.data$XenaHostNames == "gdcHub",
dplyr::mutate(url = ifelse(.data$XenaHostNames %in% c("gdcHub", "gdcHubV18"),
file.path(hosts, "download", url_encode(basename(datasets))),
file.path(hosts, "download", url_encode(datasets))
)) %>%
Expand Down
3 changes: 3 additions & 0 deletions R/api_inner.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# post --------------------------------------------------------------------

.xena_post <- function(host, query, ...) {
# allow insecure options like curl -k
# https://stackoverflow.com/questions/65531599/how-to-pass-the-k-or-insecure-argument-to-curl-in-the-r-package-httr
httr::set_config(httr::config(ssl_verifypeer = 0L, ssl_verifyhost = 0L))
host <- paste0(host, "/data/")
res <- POST(host, body = query)
stop_for_status(res)
Expand Down
3 changes: 2 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ Currently, **UCSCXenaTools** supports the following data hubs of UCSC Xena.

* UCSC Public Hub: <https://ucscpublic.xenahubs.net/>
* TCGA Hub: <https://tcga.xenahubs.net/>
* GDC Xena Hub: <https://gdc.xenahubs.net/>
* GDC Xena Hub (new): <https://gdc.xenahubs.net/>
* GDC v18.0 Xena Hub (old): <https://gdcV18.xenahubs.net/>
* ICGC Xena Hub: <https://icgc.xenahubs.net/>
* Pan-Cancer Atlas Hub: <https://pancanatlas.xenahubs.net/>
* UCSC Toil RNAseq Recompute Compendium Hub: <https://toil.xenahubs.net/>
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ Xena.

- UCSC Public Hub: <https://ucscpublic.xenahubs.net/>
- TCGA Hub: <https://tcga.xenahubs.net/>
- GDC Xena Hub: <https://gdc.xenahubs.net/>
- GDC Xena Hub (new): <https://gdc.xenahubs.net/>
- GDC v18.0 Xena Hub (old): <https://gdcV18.xenahubs.net/>
- ICGC Xena Hub: <https://icgc.xenahubs.net/>
- Pan-Cancer Atlas Hub: <https://pancanatlas.xenahubs.net/>
- UCSC Toil RNAseq Recompute Compendium Hub:
Expand Down Expand Up @@ -114,7 +115,7 @@ You can load `XenaData` after loading `UCSCXenaTools` into R.
``` r
library(UCSCXenaTools)
#> =========================================================================================
#> UCSCXenaTools version 1.5.0
#> UCSCXenaTools version 1.4.8
#> Project URL: https://github.com/ropensci/UCSCXenaTools
#> Usages: https://cran.r-project.org/web/packages/UCSCXenaTools/vignettes/USCSXenaTools.html
#>
Expand Down Expand Up @@ -171,7 +172,7 @@ Query and download.
XenaQuery(df_todo) %>%
XenaDownload() -> xe_download
#> This will check url status, please be patient.
#> All downloaded files will under directory /var/folders/37/gt0rbmqn61b513tbr8pyz_y40000gn/T//RtmpbXwIKj.
#> All downloaded files will under directory /tmp/RtmpB0pxLW.
#> The 'trans_slash' option is FALSE, keep same directory structure as Xena.
#> Creating directories for datasets...
#> Downloading TCGA.LUNG.sampleMap/LUNG_clinicalMatrix
Expand Down
Binary file modified data/XenaData.rda
Binary file not shown.
5 changes: 3 additions & 2 deletions man/XenaHub.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2f1742d

Please sign in to comment.