Skip to content

Commit

Permalink
支持 hiplot 镜像下载 close #32 close #30
Browse files Browse the repository at this point in the history
  • Loading branch information
ShixiangWang committed Dec 14, 2020
1 parent 1ffc981 commit 8bc0447
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 57 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# UCSCXenaTools 1.4.0

- Supported downloading data from Hiplot mirror site <https://xena.hiplot.com.cn/>.

# UCSCXenaTools 1.3.6

- Fixed a bug about try times for data download.
Expand Down
23 changes: 23 additions & 0 deletions R/XenaHub-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,29 @@ xena_default_hosts <- function() {

names(.xena_hosts) <- xena_default_hosts()

# Add Hiplot mirror url
# Still use UCSC Xena URL if it is not available
.xena_hosts_hiplot <- .xena_hosts
names(.xena_hosts_hiplot) <- c(
"https://xena-ucscpublic.hiplot.com.cn",
"https://xena-tcga.hiplot.com.cn",
"https://xena-gdc.hiplot.com.cn",
"https://xena-icgc.hiplot.com.cn",
"https://xena-toil.hiplot.com.cn",
"https://xena-pancanatlas.hiplot.com.cn",
"https://xena.treehouse.gi.ucsc.edu:443", #!
"https://xena-pcawg.hiplot.com.cn",
"https://xena-atacseq.hiplot.com.cn",
"https://singlecellnew.xenahubs.net", #!
"https://kidsfirst.xenahubs.net", #!
"https://tdi.xenahubs.net" #!
)
# Map hiplot to ucsc
.xena_mirror_map <- names(.xena_hosts)
names(.xena_mirror_map) <- names(.xena_hosts_hiplot)
# Map ucsc to hiplot
.xena_mirror_map_rv <- names(.xena_hosts_hiplot)
names(.xena_mirror_map_rv) <- names(.xena_hosts)

##' Generate a XenaHub Object
##'
Expand Down
11 changes: 10 additions & 1 deletion R/XenaQuery.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@
##' xe_query = XenaQuery(xe)
##' }
XenaQuery <- function(x) {
use_hiplot <- getOption("use_hiplot", default = FALSE)

data_list <- UCSCXenaTools::XenaData
if (use_hiplot) {
message("Use hiplot server (China) for mirrored data hubs (set 'options(use_hiplot = FALSE)' to disable it)")
data_list$XenaHosts <- .xena_mirror_map_rv[data_list$XenaHosts]
}

message("This will check url status, please be patient.")
datasetsName <- datasets(x)
query <- UCSCXenaTools::XenaData %>%

query <- data_list %>%
dplyr::filter(XenaDatasets %in% datasetsName) %>%
dplyr::rename(hosts = XenaHosts, datasets = XenaDatasets) %>%
dplyr::mutate(url = ifelse(.data$XenaHostNames == "gdcHub",
Expand Down
3 changes: 3 additions & 0 deletions R/fetch.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ fetch_dataset_identifiers <- function(host, dataset) {
#' @export
has_probeMap <- function(host, dataset) {
.attach_this()
if (! host %in% .xena_mirror_map) {
host <- .xena_mirror_map[host]
}
df <- base::subset(UCSCXenaTools::XenaData, XenaHosts == host & XenaDatasets == dataset)
!is.na(df[["ProbeMap"]])
}
Expand Down
32 changes: 21 additions & 11 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,18 @@ All datasets are available at <https://xenabrowser.net/datapages/>.

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>
* 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>
* PCAWG Xena Hub: <https://pcawg.xenahubs.net>
* ATAC-seq Hub: <https://atacseq.xenahubs.net>
* Singel Cell Xena Hub: <https://singlecellnew.xenahubs.net>
* Kids First Xena Hub: <https://kidsfirst.xenahubs.net>
* Tumor Deconvolution and Immunogenicity Xena Hub: <https://tdi.xenahubs.net>
* UCSC Public Hub: <https://ucscpublic.xenahubs.net/>
* TCGA Hub: <https://tcga.xenahubs.net/>
* GDC Xena Hub: <https://gdc.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/>
* PCAWG Xena Hub: <https://pcawg.xenahubs.net/>
* ATAC-seq Hub: <https://atacseq.xenahubs.net/>
* Singel Cell Xena Hub: <https://singlecellnew.xenahubs.net/>
* Kids First Xena Hub: <https://kidsfirst.xenahubs.net/>
* Tumor Deconvolution and Immunogenicity Xena Hub: <https://tdi.xenahubs.net/>
* Treehouse Xena Hub: <https://xena.treehouse.gi.ucsc.edu:443/>

Users can update dataset list from the newest version of UCSC Xena by hand with `XenaDataUpdate()` function, followed
by restarting R and `library(UCSCXenaTools)`.
Expand Down Expand Up @@ -193,7 +194,16 @@ df_todo

Query and download.

```{r, eval=FALSE}
XenaQuery(df_todo) %>%
XenaDownload() -> xe_download
```

**For researchers in China, now [Hiplot team](https://hiplot.com.cn/) has deployed several Xena [mirror sites](https://xena.hiplot.com.cn/) at Shanghai. You can set an option `options(use_hiplot = TRUE)` before querying data step to speed up both data querying and downloading.**

```{r}
options(use_hiplot = TRUE)
XenaQuery(df_todo) %>%
XenaDownload() -> xe_download
```
Expand Down
79 changes: 47 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,70 +5,72 @@
<thead>
<tr class="header">
<th align="left">
<p>Usage</p>
Usage
</th>
<th align="left">
<p>Release</p>
Release
</th>
<th align="left">
<p>Development</p>
Development
</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">
<p><a href="https://www.gnu.org/licenses/gpl-3.0.en.html"><img src="https://img.shields.io/badge/licence-GPL--3-blue.svg" alt="Licence"></a></p>
<a href="https://www.gnu.org/licenses/gpl-3.0.en.html"><img src="https://img.shields.io/badge/licence-GPL--3-blue.svg" alt="Licence"></a>
</td>
<td align="left">
<p><a href="https://cran.r-project.org/package=UCSCXenaTools"><img src="https://www.r-pkg.org/badges/version/UCSCXenaTools" alt="CRAN"></a></p>
<a href="https://cran.r-project.org/package=UCSCXenaTools"><img src="https://www.r-pkg.org/badges/version/UCSCXenaTools" alt="CRAN"></a>
</td>
<td align="left">
<p><a href="https://travis-ci.org/ropensci/UCSCXenaTools"><img src="https://travis-ci.org/ropensci/UCSCXenaTools.svg?branch=master" alt="Travis"></a></p>
<a href="https://travis-ci.org/ropensci/UCSCXenaTools"><img src="https://travis-ci.org/ropensci/UCSCXenaTools.svg?branch=master" alt="Travis"></a>
</td>
</tr>
<tr class="even">
<td align="left">
<p><a href="https://cran.r-project.org/"><img src="https://img.shields.io/badge/R%3E%3D-3.5.0-blue.svg" alt="minimal R version"></a></p>
<a href="https://cran.r-project.org/"><img src="https://img.shields.io/badge/R%3E%3D-3.5.0-blue.svg" alt="minimal R version"></a>
</td>
<td align="left">
<p><a href="https://cran.r-project.org/web/checks/check_results_UCSCXenaTools.html"><img src="https://cranchecks.info/badges/summary/UCSCXenaTools" alt="cran-checks"></a></p>
<a href="https://cran.r-project.org/web/checks/check_results_UCSCXenaTools.html"><img src="https://cranchecks.info/badges/summary/UCSCXenaTools" alt="cran-checks"></a>
</td>
<td align="left">
<p><a href="https://ci.appveyor.com/project/ShixiangWang/UCSCXenaTools"><img src="https://ci.appveyor.com/api/projects/status/github/ropensci/UCSCXenaTools?branch=master&svg=true" alt="AppVeyor"></a></p>
<a href="https://ci.appveyor.com/project/ShixiangWang/UCSCXenaTools"><img src="https://ci.appveyor.com/api/projects/status/github/ropensci/UCSCXenaTools?branch=master&svg=true" alt="AppVeyor"></a>
</td>
</tr>
<tr class="odd">
<td align="left">
<p><a href="https://CRAN.R-project.org/package=UCSCXenaTools"><img src="https://tinyverse.netlify.com/badge/UCSCXenaTools"></a></p>
<a href="https://CRAN.R-project.org/package=UCSCXenaTools"><img src="https://tinyverse.netlify.com/badge/UCSCXenaTools"></a>
</td>
<td align="left">
<p><a href="https://github.com/ropensci/software-review/issues/315"><img src="https://badges.ropensci.org/315_status.svg" alt="rOpenSci"></a></p>
<a href="https://github.com/ropensci/software-review/issues/315"><img src="https://badges.ropensci.org/315_status.svg" alt="rOpenSci"></a>
</td>
<td align="left">
<p><a href="https://codecov.io/github/ShixiangWang/UCSCXenaTools?branch=master"><img src="https://codecov.io/github/ShixiangWang/UCSCXenaTools/coverage.svg?branch=master" alt="Codecov"></a></p>
<a href="https://codecov.io/github/ShixiangWang/UCSCXenaTools?branch=master"><img src="https://codecov.io/github/ShixiangWang/UCSCXenaTools/coverage.svg?branch=master" alt="Codecov"></a>
</td>
</tr>
<tr class="even">
<td align="left">
<p><a href="https://CRAN.R-project.org/package=UCSCXenaTools"><img src="https://cranlogs.r-pkg.org/badges/grand-total/UCSCXenaTools" alt="downloads"></a></p>
<a href="https://CRAN.R-project.org/package=UCSCXenaTools"><img src="https://cranlogs.r-pkg.org/badges/grand-total/UCSCXenaTools" alt="downloads"></a>
</td>
<td align="left">
<p><a href="https://zenodo.org/badge/latestdoi/178662770"><img src="https://zenodo.org/badge/178662770.svg" alt="DOI"></a></p>
<a href="https://zenodo.org/badge/latestdoi/178662770"><img src="https://zenodo.org/badge/178662770.svg" alt="DOI"></a>
</td>
<td align="left">
<p><a href="https://github.com/ropensci/UCSCXenaTools/issues?q=is%3Aissue+is%3Aclosed"><img src="https://img.shields.io/github/issues-closed/ropensci/UCSCXenaTools.svg" alt="Closed issues" /></a></p>
[![Closed
issues](https://img.shields.io/github/issues-closed/ropensci/UCSCXenaTools.svg)](https://github.com/ropensci/UCSCXenaTools/issues?q=is%3Aissue+is%3Aclosed)
</td>
</tr>
<tr class="odd">
<td align="left">
<p><a href="https://CRAN.R-project.org/package=UCSCXenaTools"><img src="https://cranlogs.r-pkg.org/badges/UCSCXenaTools" alt="month-downloads"></a></p>
<a href="https://CRAN.R-project.org/package=UCSCXenaTools"><img src="https://cranlogs.r-pkg.org/badges/UCSCXenaTools" alt="month-downloads"></a>
</td>
<td align="left">
<p><a href="https://doi.org/10.21105/joss.01627"><img src="https://joss.theoj.org/papers/10.21105/joss.01627/status.svg" alt="JOSS" > </a></p>
<a href="https://doi.org/10.21105/joss.01627"><img src="https://joss.theoj.org/papers/10.21105/joss.01627/status.svg" alt="JOSS" >
</a>
</td>
<td align="left">
<p><a href="https://www.repostatus.org/#active"><img src="https://www.repostatus.org/badges/latest/active.svg" alt="Project Status: Active – The project has reached a stable, usable state and is being actively developed." /></a></p>
<a href="https://www.repostatus.org/#active"><img src="https://www.repostatus.org/badges/latest/active.svg" alt="Project Status: Active – The project has reached a stable, usable state and is being actively developed." /></a>
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -130,19 +132,20 @@ All datasets are available at <https://xenabrowser.net/datapages/>.
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>
- ICGC Xena Hub: <https://icgc.xenahubs.net>
- Pan-Cancer Atlas Hub: <https://pancanatlas.xenahubs.net>
- UCSC Public Hub: <https://ucscpublic.xenahubs.net/>
- TCGA Hub: <https://tcga.xenahubs.net/>
- GDC Xena Hub: <https://gdc.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>
- PCAWG Xena Hub: <https://pcawg.xenahubs.net>
- ATAC-seq Hub: <https://atacseq.xenahubs.net>
- Singel Cell Xena Hub: <https://singlecellnew.xenahubs.net>
- Kids First Xena Hub: <https://kidsfirst.xenahubs.net>
<https://toil.xenahubs.net/>
- PCAWG Xena Hub: <https://pcawg.xenahubs.net/>
- ATAC-seq Hub: <https://atacseq.xenahubs.net/>
- Singel Cell Xena Hub: <https://singlecellnew.xenahubs.net/>
- Kids First Xena Hub: <https://kidsfirst.xenahubs.net/>
- Tumor Deconvolution and Immunogenicity Xena Hub:
<https://tdi.xenahubs.net>
<https://tdi.xenahubs.net/>
- Treehouse Xena Hub: <https://xena.treehouse.gi.ucsc.edu:443/>

Users can update dataset list from the newest version of UCSC Xena by
hand with `XenaDataUpdate()` function, followed by restarting R and
Expand Down Expand Up @@ -177,7 +180,7 @@ You can load `XenaData` after loading `UCSCXenaTools` into R.
``` r
library(UCSCXenaTools)
#> =========================================================================================
#> UCSCXenaTools version 1.3.4
#> UCSCXenaTools version 1.3.6
#> Project URL: https://github.com/ropensci/UCSCXenaTools
#> Usages: https://cran.r-project.org/web/packages/UCSCXenaTools/vignettes/USCSXenaTools.html
#>
Expand Down Expand Up @@ -231,10 +234,22 @@ df_todo
Query and download.

``` r
XenaQuery(df_todo) %>%
XenaDownload() -> xe_download
```

**For researchers in China, now [Hiplot team](https://hiplot.com.cn/)
has deployed several Xena [mirror sites](https://xena.hiplot.com.cn/) at
Shanghai. You can set an option `options(use_hiplot = TRUE)` before
querying data step to speed up both data querying and downloading.**

``` r
options(use_hiplot = TRUE)

XenaQuery(df_todo) %>%
XenaDownload() -> xe_download
#> This will check url status, please be patient.
#> All downloaded files will under directory /var/folders/bj/nw1w4g1j37ddpgb6zmh3sfh80000gn/T//RtmpjwXWVC.
#> All downloaded files will under directory /var/folders/bj/nw1w4g1j37ddpgb6zmh3sfh80000gn/T//Rtmpb97sk9.
#> The 'trans_slash' option is FALSE, keep same directory structure as Xena.
#> Creating directories for datasets...
#> Downloading TCGA.LUNG.sampleMap/LUNG_clinicalMatrix
Expand Down Expand Up @@ -271,7 +286,7 @@ Cite me by the following paper.
Wang et al., (2019). The UCSCXenaTools R package: a toolkit for accessing genomics data
from UCSC Xena platform, from cancer multi-omics to single-cell RNA-seq.
Journal of Open Source Software, 4(40), 1627, https://doi.org/10.21105/joss.01627

# For BibTex
@article{Wang2019UCSCXenaTools,
Expand Down
34 changes: 21 additions & 13 deletions vignettes/USCSXenaTools.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ All datasets are available at <https://xenabrowser.net/datapages/>.

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>
* 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>
* PCAWG Xena Hub: <https://pcawg.xenahubs.net>
* ATAC-seq Hub: <https://atacseq.xenahubs.net>
* Singel Cell Xena Hub: <https://singlecellnew.xenahubs.net>
* Kids First Xena Hub: <https://kidsfirst.xenahubs.net>
* Tumor Deconvolution and Immunogenicity Xena Hub: <https://tdi.xenahubs.net>
* UCSC Public Hub: <https://ucscpublic.xenahubs.net/>
* TCGA Hub: <https://tcga.xenahubs.net/>
* GDC Xena Hub: <https://gdc.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/>
* PCAWG Xena Hub: <https://pcawg.xenahubs.net/>
* ATAC-seq Hub: <https://atacseq.xenahubs.net/>
* Singel Cell Xena Hub: <https://singlecellnew.xenahubs.net/>
* Kids First Xena Hub: <https://kidsfirst.xenahubs.net/>
* Tumor Deconvolution and Immunogenicity Xena Hub: <https://tdi.xenahubs.net/>
* Treehouse Xena Hub: <https://xena.treehouse.gi.ucsc.edu:443/>

Users can update dataset list from the newest version of UCSC Xena by hand with `XenaDataUpdate()` function, followed
by restarting R and `library(UCSCXenaTools)`.
Expand Down Expand Up @@ -129,10 +130,18 @@ x2 %>%
XenaGenerate()
```


Query and download.

```{r, eval=FALSE}
XenaQuery(df_todo) %>%
XenaDownload() -> xe_download
```

**For researchers in China, now [Hiplot team](https://hiplot.com.cn/) has deployed several Xena [mirror sites](https://xena.hiplot.com.cn/) at Shanghai. You can set an option `options(use_hiplot = TRUE)` before querying data step to speed up both data querying and downloading.**

```{r}
options(use_hiplot = TRUE)
XenaQuery(df_todo) %>%
XenaDownload() -> xe_download
```
Expand All @@ -145,7 +154,6 @@ class(cli)
names(cli)
```


### Browse datasets

Create two XenaHub objects:
Expand Down

0 comments on commit 8bc0447

Please sign in to comment.