Skip to content

Commit

Permalink
Merge branch 'development' into allyhawkins/main-celltype-intro
Browse files Browse the repository at this point in the history
  • Loading branch information
allyhawkins authored Oct 26, 2023
2 parents 6b8c92b + cc326e9 commit e90fc4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/add_celltypes_to_sce.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ if(!is.null(opt$singler_results)){
}

singler_results <- readr::read_rds(opt$singler_results)

# get label type from metadata of singler object
label_type <- metadata(singler_results)$reference_label

# create a tibble with annotations and barcode
# later we'll add the annotations into colData by joining on barcodes column
Expand All @@ -71,8 +74,8 @@ if(!is.null(opt$singler_results)){
)

# map ontology labels to cell type names, as needed
# we can tell if ontologies were used because this will exist:
if ("cell_ontology_df" %in% names(singler_results)) {
# label type will be label.ont if ontology is present
if (label_type == "label.ont") {

# end up with columns: barcode, singler_celltype_annotation, singler_celltype_ontology
colData(sce) <- annotations_df |>
Expand Down Expand Up @@ -100,6 +103,7 @@ if(!is.null(opt$singler_results)){
# add singler info to metadata
metadata(sce)$singler_results <- singler_results
metadata(sce)$singler_reference <- metadata(singler_results)$reference_name
metadata(sce)$singler_reference_label <- label_type

# add note about cell type method to metadata
metadata(sce)$celltype_methods <- c(metadata(sce)$celltype_methods, "singler")
Expand Down
2 changes: 2 additions & 0 deletions bin/classify_SingleR.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ singler_results <- SingleR::classifySingleR(

# add reference name to singler_results DataFrame metadata
metadata(singler_results)$reference_name <- reference_name
# add label name to metadata
metadata(singler_results)$reference_label <- metadata(singler_model)$reference_label

# export results ---------------

Expand Down

0 comments on commit e90fc4f

Please sign in to comment.