Annotate the tissues that each cell-type is found in.
map_tissues(celltypes = NULL, map = NULL, collapse = NULL)
#### Prepare mapping file #####
URL <- paste0("https://atlas.fredhutch.org/data/bbi/descartes/human_gtex/",
"downloads/data_summarize_fetus_data/df_cell.RDS")
meta <- readRDS(url(URL))
map <- data.table::data.table(
stringr::str_split(unique(meta$Organ_cell_lineage),"-",n = 2,
simplify = TRUE) |>
`colnames<-`(c("tissue","celltype"))
)
f <- file.path("~/Desktop/ewce/rare_disease_celltyping/data/",
"DescartesHuman_celltype_mapping.csv")
data.table::fwrite(map,f)
piggyback::pb_upload(file = f, repo = "neurogenomics/MultiEWCE")
A vector of cell-types to map onto tissues.
A data.table containing the columns
"celltype" and "tissue".
If NULL
, will use a built-in mapping file that only applies to the
CellTypeDataset DescartesHuman
(see load_example_ctd for details).
If not NULL
,
collapse rows with >1 tissue into one string:
e.g. c("Heart" "Lung")
--> "Heart;Lung"
A list of tissues with the same length
as the input celltypes
.
results <- load_example_results()
tissues <- map_tissues(celltypes = results$CellType)
#> ℹ All local files already up-to-date!