Many studies include data from assays which have not been integrated into the DataSpace. Some of these are available as “Non-Integrated Datasets,” which can be downloaded from the app as a zip file. DataSpaceR provides an interface for accessing non-integrated data from studies where it is available.
Methods on the DataSpace Study object allow you to see what non-integrated data may be available before downloading it. We will be using HVTN 505 as an example.
library(DataSpaceR)
con <- connectDS()
vtn505 <- con$getStudy("vtn505")
vtn505
#> <DataSpaceStudy>
#> Study: vtn505
#> URL: https://dataspace.cavd.org/CAVD/vtn505
#> Available datasets:
#> - BAMA
#> - Demographics
#> - ICS
#> - NAb
#> Available non-integrated datasets:
#> - ADCP
#> - DEM SUPP
#> - Fc ArrayThe print method on the study object will list available non-integrated datasets. The availableDatasets property shows some more info about available datasets, with the integrated field indicating whether the data is integrated. The value for n will be NA for non-integrated data until the dataset has been loaded.
| name | label | n | integrated |
|---|---|---|---|
| BAMA | Binding Ab multiplex assay | 10260 | TRUE |
| Demographics | Demographics | 2504 | TRUE |
| ICS | Intracellular Cytokine Staining | 22684 | TRUE |
| NAb | Neutralizing antibody | 628 | TRUE |
| ADCP | ADCP | NA | FALSE |
| DEM SUPP | Demographics (Supplemental) | NA | FALSE |
| Fc Array | Fc Array | NA | FALSE |
Non-Integrated datasets can be loaded with getDataset like integrated data. This will unzip the non-integrated data to a temp directory and load it into the environment.
adcp <- vtn505$getDataset("ADCP")
#> downloading vtn505_adcp.zip to /var/folders/9m/vwxpkj1100z3gpsf27m21fx00000gn/T//RtmpbFAh0R...
#> No encoding supplied: defaulting to UTF-8.
#> unzipping vtn505_adcp.zip to /var/folders/9m/vwxpkj1100z3gpsf27m21fx00000gn/T//RtmpbFAh0R/vtn505_adcp
dim(adcp)
#> [1] 378 11
colnames(adcp)
#> [1] "study_prot" "ParticipantId" "study_day"
#> [4] "lab_code" "specimen_type" "antigen"
#> [7] "percent_cv" "avg_phagocytosis_score" "positivity_threshold"
#> [10] "response" "assay_identifier"You can also view the file format info using getDatasetDescription. For non-integrated data, this will open a pdf into your computer’s default pdf viewer.
Non-integrated data is downloaded to a temp directory by default. There are a couple of ways to override this if desired. One is to specify outputDir when calling getDataset or getDatasetDescription.
If you will be accessing the data at another time and don’t want to have to re-download it, you can change the default directory for the whole study object with setDataDir.
vtn505$dataDir
#> [1] "/var/folders/9m/vwxpkj1100z3gpsf27m21fx00000gn/T//RtmpbFAh0R"
vtn505$setDataDir(".")
vtn505$dataDir
#> [1] "/private/var/folders/9m/vwxpkj1100z3gpsf27m21fx00000gn/T/RtmpvAQ0M9/Rbuild147f67f64d818/DataSpaceR/vignettes"If the dataset already exists in the specified dataDir or outputDir, it will be not be downloaded. This can be overridden with reload=TRUE, which forces a re-download.
sessionInfo()
#> R version 3.6.2 (2019-12-12)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS Catalina 10.15.2
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] DataSpaceR_0.7.3
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.3 Rlabkey_2.3.3 knitr_1.26 magrittr_1.5
#> [5] xtable_1.8-4 R6_2.4.1 rlang_0.4.2 fastmap_1.0.1
#> [9] stringr_1.4.0 httr_1.4.1 highr_0.8 tools_3.6.2
#> [13] DT_0.10 data.table_1.12.8 xfun_0.11 htmltools_0.4.0
#> [17] crosstalk_1.0.0 yaml_2.2.0 digest_0.6.23 assertthat_0.2.1
#> [21] shiny_1.4.0 later_1.0.0 promises_1.1.0 htmlwidgets_1.5.1
#> [25] curl_4.3 mime_0.7 evaluate_0.14 rmarkdown_2.0
#> [29] stringi_1.4.3 compiler_3.6.2 jsonlite_1.6 httpuv_1.5.2