quiet_library <- function(...) { suppressPackageStartupMessages(library(...)) }
quiet_library(hise)
quiet_library(dplyr)
quiet_library(purrr)
BR1_rna_desc <- getFileDescriptors(
fileType = "scRNA-seq-labeled",
filter = list(cohort.cohortGuid = "BR1"))
BR2_rna_desc <- getFileDescriptors(
fileType = "scRNA-seq-labeled",
filter = list(cohort.cohortGuid = "BR2"))
UP1_rna_desc <- getFileDescriptors(
fileType = "scRNA-seq-labeled",
filter = list(cohort.cohortGuid = "UP1"))
BR1_rna_desc <- fileDescToDataframe(BR1_rna_desc)
BR2_rna_desc <- fileDescToDataframe(BR2_rna_desc)
UP1_rna_desc <- fileDescToDataframe(UP1_rna_desc)
Batches starting with "EXP" are experimental, non-pipeline batches.
B004 is an early batch that has some batch effects. We'll exclude this batch, as samples have been re-run in later batches.
Batches later than B145 are not used for this reference.
meta_data <- plyr::rbind.fill(BR1_rna_desc , BR2_rna_desc )
meta_data <- meta_data %>%
filter(!grepl("EXP",file.batchID)) %>%
filter(!file.batchID == "B004") %>%
mutate(file.batch_num = as.numeric(sub("B","",file.batchID))) %>%
filter(file.batch_num <= 145) %>%
select(-file.batch_num)
We want to use only healthy subjects without abnormal presentation for this reference. A few subjects have non-healthy or abnormal states recored at some visits. We'll identify and remove these subjects.
non_healthy <- meta_data %>%
filter(sample.diseaseStatesRecordedAtVisit != "") %>%
select(subject.subjectGuid, sample.diseaseStatesRecordedAtVisit) %>%
unique()
non_healthy
subject.subjectGuid | sample.diseaseStatesRecordedAtVisit | |
---|---|---|
<chr> | <chr> | |
1 | BR1034 | Psoriasis |
7 | BR2007 | Healthy - Abnormal |
17 | BR2049 | Healthy - Abnormal |
meta_data <- meta_data %>%
filter(!subject.subjectGuid %in% non_healthy$subject.subjectGuid)
To build our reference, we'll use the pre-vaccination samples from each of our BR1 (healthy adult 25-35 years) and BR2 (healthy adult 55-65 years) subjects.
These samples have the visit name "Flu Year 1 Day 0".
meta_data$pbmc_sample_id <- gsub("_","",paste0("PB0",substr(sub(".*PB0", "", meta_data$file.name),1,8)))
meta_data <- meta_data %>%
arrange(pbmc_sample_id) %>%
filter(!duplicated(sample.sampleKitGuid, fromLast = TRUE)) %>%
filter(sample.visitName == 'Flu Year 1 Day 0') %>%
arrange(sample.sampleKitGuid)
table(meta_data$cohort.cohortGuid)
BR1 BR2 47 45
A set of 16 pediatric samples have been previously published in Thomson, Z. et al. Trimodal single-cell profiling reveals a novel pediatric CD8αα+ T cell subset and broad age-related molecular reprogramming across the T cell compartment. Nat. Immunol. 24, 1947–1959 (2023).
We'll use this set of samples to provide coverage of pediatric cells in our reference.
UP_Sample_kits <- c("KT00809","KT00811","KT00193","KT00841",
"KT00842","KT00833","KT00910","KT00884",
"KT00892","KT00914","KT00913","KT00927",
"KT00928","KT02391","KT02392","KT03223")
UP1_rna_desc <- UP1_rna_desc %>%
filter(sample.sampleKitGuid %in% UP_Sample_kits)
meta_data <- plyr::rbind.fill(meta_data, UP1_rna_desc)
if(!dir.exists("output")) {
dir.create("output")
}
out_file <- file.path(
"output",
paste0("ref_h5_meta_data_",Sys.Date(),".csv")
)
write.csv(
meta_data,
out_file,
row.names = FALSE,
quote = FALSE
)
In order to store the results in HISE, we'll need to cache these files to register them, and then we can upload the CSV file for later steps.
res <- cacheFiles(list(meta_data$file.id))
[1] "Initiating file download for B001-P1_PB00001-01_labeled.h5" [1] "Download successful." [1] "Initiating file download for B001-P1_PB00002-01_labeled.h5" [1] "Download successful." [1] "Initiating file download for B001-P1_PB00003-01_labeled.h5" [1] "Download successful." [1] "Initiating file download for B002-P1_PB00004-01_2023-11-17T21:36:51.794326181Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B002-P1_PB00006-01_2023-11-17T21:36:51.794326181Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B078-P2_PB00010-02_2021-08-19T17:09:29.934849811Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B002-P1_PB00012-01_2023-11-17T21:36:51.794326181Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B002-P1_PB00014-01_2023-11-17T21:36:51.794326181Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B002-P1_PB00015-01_2023-11-17T21:36:51.794326181Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B002-P1_PB00016-01_2023-11-17T21:36:51.794326181Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B002-P2_PB00022-01_2023-11-17T21:38:04.103392546Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B078-P2_PB00023-05_2021-08-19T17:09:29.934849811Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B078-P2_PB00025-04_2021-08-19T17:09:29.934849811Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B078-P2_PB00026-05_2021-08-19T17:09:29.934849811Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B078-P2_PB00030-02_2021-08-19T17:09:29.934849811Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B078-P2_PB00031-05_2021-08-19T17:09:29.934849811Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B007-P1_PB00041-01_2020-06-24T03:16:48.417213376Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B010-P1_PB00166-01_2021-11-09T17:30:04.059664207Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B039-P2_PB00334-01_2020-12-14T06:30:12.885244281Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B036-P1_PB00338-01_2020-11-05T20:20:56.478927112Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B056-P2_PB00339-01_2021-06-09T18:00:29.080476056Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B036-P1_PB00341-01_2020-11-05T20:20:56.478927112Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B050-P1_PB00342-01_2021-02-28T21:06:52.68159788Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B041-P2_PB00345-01_2021-02-12T20:13:57.744090035Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B047-P2_PB00347-01_2021-02-25T00:07:50.971832932Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B040-P2_PB00349-01_2021-03-24T00:48:50.255094117Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B040-P2_PB00350-01_2021-03-24T00:48:50.255094117Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B078-P1_PB00352-04_2021-08-15T20:26:02.548957446Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B078-P1_PB00353-04_2021-08-15T20:26:02.548957446Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B046-P2_PB00356-01_2021-02-24T00:13:26.04313294Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B040-P2_PB00357-01_2021-03-24T00:48:50.255094117Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B039-P1_PB00362-01_2020-12-13T18:58:42.148340626Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B040-P2_PB00363-01_2021-03-24T00:48:50.255094117Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B040-P2_PB00365-01_2021-03-24T00:48:50.255094117Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B039-P1_PB00366-01_2020-12-13T18:58:42.148340626Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B142-P2_PB00368-07_2022-11-16T19:59:12.434982913Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B056-P2_PB00369-01_2021-06-09T18:00:29.080476056Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B040-P1_PB00377-01_2021-02-14T05:03:10.129208213Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B077-P2_PB00383-01_2021-07-23T23:25:52.724598929Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B040-P1_PB00384-01_2021-02-14T05:03:10.129208213Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B041-P2_PB00386-01_2021-02-12T20:13:57.744090035Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B055-P2_PB00387-01_2021-07-18T21:22:58.754356074Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B040-P1_PB00388-01_2021-02-14T05:03:10.129208213Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B067-P2_PB00390-01_2023-05-10T23:59:25.925856679Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B041-P2_PB00391-01_2021-02-12T20:13:57.744090035Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B053-P2_PB00393-01_2021-10-01T22:42:30.043074144Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B082-P2_PB00394-02_2021-08-22T03:15:23.834723601Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B040-P1_PB00398-01_2021-02-14T05:03:10.129208213Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B053-P1_PB00501-01_2021-03-16T16:53:54.504538818Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B041-P1_PB00504-01_2021-02-11T20:48:07.416042815Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B041-P1_PB00507-01_2021-02-11T20:48:07.416042815Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B043-P1_PB00510-01_2021-01-28T01:04:59.754710921Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B041-P1_PB00514-01_2021-02-11T20:48:07.416042815Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B064-P1_PB00516-01_2021-06-13T18:07:41.688427174Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B046-P1_PB00518-01_2021-02-24T00:12:47.912386239Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B077-P2_PB00520-01_2021-07-23T23:25:52.724598929Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B077-P2_PB00523-01_2021-07-23T23:25:52.724598929Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B045-P1_PB00525-01_2021-02-20T17:54:07.896349649Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B073-P2_PB00526-01_2021-07-16T04:08:14.677295096Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B072-P2_PB00529-01_2021-07-12T17:24:20.370028377Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B045-P1_PB00530-01_2021-02-20T17:54:07.896349649Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B046-P1_PB00532-01_2021-02-24T00:12:47.912386239Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B080-P2_PB00533-01_2021-08-17T16:54:06.046922824Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B046-P1_PB00535-01_2021-02-24T00:12:47.912386239Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B046-P1_PB00537-01_2021-02-24T00:12:47.912386239Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B048-P2_PB00539-01_2021-02-26T23:24:20.340902222Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B080-P2_PB00541-01_2021-08-17T16:54:06.046922824Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B060-P2_PB00545-01_2021-04-20T21:56:32.569265429Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B072-P2_PB00549-01_2021-07-12T17:24:20.370028377Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B045-P1_PB00552-01_2021-02-20T17:54:07.896349649Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B073-P2_PB00557-01_2021-07-16T04:08:14.677295096Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B132-P2_PB00561-04_2023-08-01T23:45:21.463231471Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B046-P1_PB00562-01_2021-02-24T00:12:47.912386239Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B056-P2_PB00563-01_2021-06-09T18:00:29.080476056Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B145-P2_PB00564-04_2023-02-11T00:49:32.117536882Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B073-P2_PB00565-01_2021-07-16T04:08:14.677295096Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B053-P1_PB00566-01_2021-03-16T16:53:54.504538818Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B048-P1_PB00568-01_2021-03-01T17:06:41.838698747Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B047-P2_PB00569-01_2021-02-25T00:07:50.971832932Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B056-P2_PB00575-01_2021-06-09T18:00:29.080476056Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B048-P1_PB00582-01_2021-03-01T17:06:41.838698747Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B054-P1_PB00588-01_2022-06-28T21:54:05.984884065Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B072-P2_PB00592-01_2021-07-12T17:24:20.370028377Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B060-P2_PB00599-01_2021-04-20T21:56:32.569265429Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B054-P1_PB00600-01_2022-06-28T21:54:05.984884065Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B084-P2_PB00602-01_2021-09-29T16:53:56.828677249Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B072-P2_PB00621-01_2021-07-12T17:24:20.370028377Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B084-P2_PB00623-01_2021-09-29T16:53:56.828677249Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B145-P2_PB00625-02_2023-02-11T00:49:32.117536882Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B072-P2_PB00645-01_2021-07-12T17:24:20.370028377Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B073-P1_PB01425-01_2021-07-16T04:07:49.451824358Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B085-P2_PB01446-01_2021-10-07T16:25:25.021068654Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B053-P1_PB00809-01_2021-03-16T16:53:54.504538818Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B060-P2_PB00811-01_2021-04-20T21:56:32.569265429Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B053-P2_PB00193-01_2021-10-01T22:42:30.043074144Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B063-P2_PB00841-01_2021-05-27T20:39:53.63831316Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B063-P2_PB00842-01_2021-05-27T20:39:53.63831316Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B094-P2_PB00833-01_2021-11-24T17:15:39.555696237Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B094-P2_PB00910-01_2021-11-24T17:15:39.555696237Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B094-P2_PB00884-01_2021-11-24T17:15:39.555696237Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B094-P2_PB00892-01_2021-11-24T17:15:39.555696237Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B096-P2_PB00914-01_2021-11-28T04:01:08.720902535Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B096-P2_PB00913-01_2021-11-28T04:01:08.720902535Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B096-P2_PB00927-01_2021-11-28T04:01:08.720902535Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B096-P2_PB00928-01_2021-11-28T04:01:08.720902535Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B138-P2_PB02391-001_2022-11-08T19:15:22.447561185Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B138-P2_PB02392-001_2022-11-08T19:15:22.447561185Z_labeled.h5" [1] "Download successful." [1] "Initiating file download for B138-P1_PB03223-001_2022-11-08T19:14:56.863218242Z_labeled.h5" [1] "Download successful."
Error in if (thisDesc$file$id != idsExpanded[[fidx]]) {: the condition has length > 1 Traceback: 1. cacheFiles(list(meta_data$file.id))
study_space_uuid <- "64097865-486d-43b3-8f94-74994e0a72e0"
title <- paste("PBMC Ref. Metadata", Sys.Date())
in_list <- as.list(meta_data$file.id)
out_list <- list(out_file)
uploadFiles(
files = out_list,
studySpaceId = study_space_uuid,
title = title,
inputFileIds = in_list,
store = "project",
doPrompt = FALSE
)
[1] "Cannot determine the current notebook." [1] "1) /home/jupyter/scRNA-Reference-IH-A/00-R_Sample_Selection.ipynb" [1] "2) /home/jupyter/examples/Visualization_apps/dash/save_visualization_app_example.ipynb" [1] "3) /home/jupyter/examples/R/XX-R Tips and tricks.ipynb"
sessionInfo()
R version 4.3.2 (2023-10-31) Platform: x86_64-conda-linux-gnu (64-bit) Running under: Ubuntu 20.04.6 LTS Matrix products: default BLAS/LAPACK: /opt/conda/lib/libopenblasp-r0.3.25.so; LAPACK version 3.11.0 locale: [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C time zone: Etc/UTC tzcode source: system (glibc) attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] purrr_1.0.2 dplyr_1.1.4 hise_2.16.0 loaded via a namespace (and not attached): [1] crayon_1.5.2 vctrs_0.6.5 httr_1.4.7 cli_3.6.2 [5] rlang_1.1.3 stringi_1.8.3 generics_0.1.3 assertthat_0.2.1 [9] jsonlite_1.8.8 glue_1.7.0 RCurl_1.98-1.14 plyr_1.8.9 [13] htmltools_0.5.7 IRdisplay_1.1 IRkernel_1.3.2 fansi_1.0.6 [17] evaluate_0.23 tibble_3.2.1 bitops_1.0-7 fastmap_1.1.1 [21] base64enc_0.1-3 lifecycle_1.0.4 stringr_1.5.1 compiler_4.3.2 [25] Rcpp_1.0.12 pkgconfig_2.0.3 pbdZMQ_0.3-10 digest_0.6.34 [29] R6_2.5.1 repr_1.1.6.9000 tidyselect_1.2.0 utf8_1.2.4 [33] curl_5.1.0 pillar_1.9.0 magrittr_2.0.3 withr_3.0.0 [37] uuid_1.2-0 tools_4.3.2 mime_0.12