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) 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) non_healthy <- meta_data %>% filter(sample.diseaseStatesRecordedAtVisit != "") %>% select(subject.subjectGuid, sample.diseaseStatesRecordedAtVisit) %>% unique() non_healthy meta_data <- meta_data %>% filter(!subject.subjectGuid %in% non_healthy$subject.subjectGuid) 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) 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 ) res <- 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 ) sessionInfo()