Skip to content

Commit

Permalink
Fix integer overflow issues in countGenes for large inex matrix
Browse files Browse the repository at this point in the history
Fixes #105
  • Loading branch information
gokceneraslan authored Mar 6, 2019
1 parent 2f2539b commit 764d3b2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions statsFUN.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ getUserSeq <-function(gtf ) {

countGenes <- function(cnt,threshold=1,user_seq){

#tmp[tmp<threshold]<-0
cnt[cnt>=threshold]<-1

# use boolean matrix directly without indexing cnt to
# avoid integer overflow issues in large matrices
# see https://github.com/sdparekh/zUMIs/issues/105
cnt <- (cnt>=threshold)

samples<-as.data.frame(Matrix::colSums(cnt[!(rownames(cnt) %in% user_seq),]))
colnames(samples) <- c("Count")
samples[,"SampleID"] <- as.factor(row.names(samples))
Expand Down

0 comments on commit 764d3b2

Please sign in to comment.