-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Hi, I tried to run your doublet annotation functions but I encountered several errors.
Firstly, I tried to run your getMarkerPeaks function:
marker_peaks <- getMarkerPeaks(data, doublets = unlist(multiplets),
n_peaks = 100,
min_cells = 200)
Error in order(meta_peaks$avg_logFC, -meta_peaks$p_val_adj, decreasing = T): argument 1 is not a vector
Traceback:
1. getMarkerPeaks(data, doublets = unlist(multiplets), n_peaks = 100,
. min_cells = 200)
2. meta_peaks[order(meta_peaks$avg_logFC, -meta_peaks$p_val_adj,
. decreasing = T), ]
3. `[.data.frame`(meta_peaks, order(meta_peaks$avg_logFC, -meta_peaks$p_val_adj,
. decreasing = T), )
4. order(meta_peaks$avg_logFC, -meta_peaks$p_val_adj, decreasing = T)
After that I generated marker peaks by myself and used them in your annotateDoublets function:
multiplet_annotations <- annotateDoublets(obj = data, marker_peaks = df, doublets = multiplets)
Error in rep(t_read_counts$ids[j], t_read_counts[j, row.names(probs)[i]]): invalid 'times' argument
Traceback:
1. annotateDoublets(obj = data, marker_peaks = df, doublets = multiplets)
2. getCellValues(obj, cells = Cells(obj), marker_peaks_set = marker_peaks,
. doublets = doublets, k = k)
3. lapply(cells, function(cell) {
. neighbors <- names(obj@graphs$ATAC_nn[cell, obj@graphs$ATAC_nn[cell,
. ] > 0])
. reads <- Matrix::as.matrix(subset(obj, cells = neighbors,
. features = marker_peaks_set$peaks)@assays[["ATAC"]]@counts)
. no_clusters <- length(unique(marker_peaks_set$cluster))
. results = data.frame(matrix(nrow = 0, ncol = no_clusters +
. 1)) %>% `colnames<-`(value = c("cell_id", as.character(unique(marker_peaks_set$cluster))))
. results[cell, "cell_id"] = cell
. reads <- data.frame(apply(reads, 1, mean)) %>% `colnames<-`(value = cell)
. if (colSums(reads) == 0) {
. results[, -1] <- 0
. results[cell, "a.heterotypic"] <- NA
. results[cell, "a.homotypic"] <- NA
. return(results)
. }
. doublet_probs <- reads %>% getReadCountDistributions(marker_peaks_set,
. .) %>% data.frame()
. results[cell, colnames(doublet_probs)] <- doublet_probs
. results[cell, "a.heterotypic"] <- paste(names(doublet_probs)[order(doublet_probs,
. decreasing = T)[1:2]], collapse = ".")
. results[cell, "a.homotypic"] <- names(which.max(doublet_probs))
. return(results)
. }) %>% do.call(rbind, .)
4. do.call(rbind, .)
5. lapply(cells, function(cell) {
. neighbors <- names(obj@graphs$ATAC_nn[cell, obj@graphs$ATAC_nn[cell,
. ] > 0])
. reads <- Matrix::as.matrix(subset(obj, cells = neighbors,
. features = marker_peaks_set$peaks)@assays[["ATAC"]]@counts)
. no_clusters <- length(unique(marker_peaks_set$cluster))
. results = data.frame(matrix(nrow = 0, ncol = no_clusters +
. 1)) %>% `colnames<-`(value = c("cell_id", as.character(unique(marker_peaks_set$cluster))))
. results[cell, "cell_id"] = cell
. reads <- data.frame(apply(reads, 1, mean)) %>% `colnames<-`(value = cell)
. if (colSums(reads) == 0) {
. results[, -1] <- 0
. results[cell, "a.heterotypic"] <- NA
. results[cell, "a.homotypic"] <- NA
. return(results)
. }
. doublet_probs <- reads %>% getReadCountDistributions(marker_peaks_set,
. .) %>% data.frame()
. results[cell, colnames(doublet_probs)] <- doublet_probs
. results[cell, "a.heterotypic"] <- paste(names(doublet_probs)[order(doublet_probs,
. decreasing = T)[1:2]], collapse = ".")
. results[cell, "a.homotypic"] <- names(which.max(doublet_probs))
. return(results)
. })
6. FUN(X[[i]], ...)
7. reads %>% getReadCountDistributions(marker_peaks_set, .) %>%
. data.frame()
8. data.frame(.)
9. getReadCountDistributions(marker_peaks_set, .)
I used ATAC peaks from 10X genomics and successfully generated file with possible multiplet barcodes, but on annotation step code stops working. Have you encountered this behavior? Thanks in advance!
Metadata
Metadata
Assignees
Labels
No labels