Skip to content

Commit

Permalink
Fix(unique colnames): fixed issue with loosing duplicated colnames
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickCNMartin committed Dec 3, 2024
1 parent 5e66158 commit 840a37a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions R/integration.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ integrate_assays <- function(mapped,
#-------------------------------------------------------------------------#
query_map <- check_maps(mapped)
query_counts <- get_counts(mapped, type = use_counts)
from <- query_map$from
from <- sub("-.*", "", query_map$from)
query_counts <- query_counts[, match(from, colnames(query_counts))]
colnames(query_counts) <- make.unique(colnames(query_counts), sep = "-")
reference_counts <- get_counts(reference, type = use_counts)
to <- query_map$to
reference_counts <- reference_counts[, match(to, colnames(reference_counts))]
to <- sub("-.*", "", query_map$to)
reference_counts <- reference_counts[,
match(to, colnames(reference_counts))]
colnames(reference_counts) <- make.unique(
colnames(reference_counts), sep = "-")
#-------------------------------------------------------------------------#
# Count integration using Seurat methods
#-------------------------------------------------------------------------#
Expand Down
2 changes: 1 addition & 1 deletion R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ listify <- function(mat) {

remove_suffix <- function(barcodes) {
prefix <- sapply(barcodes, function(dat){
prefix <- paste0(strsplit(x = dat, split = "-")[[1]][1:2], collapse = "-")
prefix <- paste0(strsplit(x = dat, split = "*")[[1]][1:2], collapse = "*")
return(prefix)
})
return(prefix)
Expand Down

0 comments on commit 840a37a

Please sign in to comment.