Skip to content

Commit

Permalink
fix bug about CompressedCharacterList
Browse files Browse the repository at this point in the history
  • Loading branch information
lingminhao committed Feb 6, 2025
1 parent b122513 commit e316ebe
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions R/bambu.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ bambu <- function(reads, annotations = NULL, genome = NULL, NDR = NULL,
ColNames <- c()
for(i in seq_along(quantData)){
quantData_i <- quantData[[i]]
#load in the barcode clustering from file if provided
iter <- seq_len(ncol(metadata(quantData_i)$countMatrix)) # iter is integer
if(!is.null(clusters)){
if(class(clusters[[i]])!="CompressedCharacterList"){ # !is.list(clusters) is FALSE for CompressedCharacterList
clusterMaps <- NULL
Expand All @@ -285,14 +283,9 @@ bambu <- function(reads, annotations = NULL, genome = NULL, NDR = NULL,
rm(clusterMap)
iter <- clustering

} else{ #if clusters is a list
if(length(quantData)>1){
iter <- clusters[[i]] #lowMemory mode
}else{
iter <- clusters#do.call(c,clusters)
}
} else{
iter <- clusters[[i]]
}
}
countsSeCompressed <- bplapply(iter, FUN = function(j){ # previous i changed to j to avoid duplicated assignment
#i = iter[i %in% colnames(metadata(quantData_i)$countMatrix)] #bug, after assignment, i become emptyprint(i)
countMatrix <- unname(metadata(quantData_i)$countMatrix[,j]) # same here
Expand Down Expand Up @@ -332,4 +325,5 @@ bambu <- function(reads, annotations = NULL, genome = NULL, NDR = NULL,
colnames(countsSe) <- ColData[,1]
return(countsSe)
}
}
}
}

1 comment on commit e316ebe

@lingminhao
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the bug mentioned at GoekeLab/bambu-singlecell-spatial#6

Please sign in to comment.