From 6b7c34213856e31373f601b097140382c4df40e1 Mon Sep 17 00:00:00 2001 From: Ally Hawkins Date: Thu, 9 Jan 2025 10:11:46 -0600 Subject: [PATCH] account for multiplexed libraries --- .../cell-type-consensus/scripts/03-save-coldata.R | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/analyses/cell-type-consensus/scripts/03-save-coldata.R b/analyses/cell-type-consensus/scripts/03-save-coldata.R index 45568956f..84d431b11 100644 --- a/analyses/cell-type-consensus/scripts/03-save-coldata.R +++ b/analyses/cell-type-consensus/scripts/03-save-coldata.R @@ -39,11 +39,16 @@ sce <- readr::read_rds(opt$sce_file) # extract ids library_id <- metadata(sce)$library_id -sample_id <- metadata(sce)$sample_id +# account for multiplexed libraries that have multiple samples +# for now just combine sample ids into a single string and don't worry about demultiplexing +sample_id <- metadata(sce)$sample_id |> + paste0(collapse = ";") project_id <- metadata(sce)$project_id # check if cell line since cell lines don't have any cell type assignments -is_cell_line <- metadata(sce)$sample_type == "cell line" +# account for having more than one sample and a list of sample types +# all sample types should be the same theoretically +is_cell_line <- all(metadata(sce)$sample_type == "cell line") # only create and write table for non-cell line samples if(!is_cell_line){ @@ -57,8 +62,10 @@ if(!is_cell_line){ library_id = library_id ) |> dplyr::select( - ends_with("id"), - "barcodes", + project_id, + sample_id, + library_id, + barcodes, contains("celltype") # get both singler and cellassign with ontology )