r3fang / SnapATAC

Analysis Pipeline for Single Cell ATAC-seq
GNU General Public License v3.0
301 stars 125 forks source link

createGmatFromMat ERROR #258

Open gengbaobao opened 8 months ago

gengbaobao commented 8 months ago

Hello developer

I run "x.sp = createGmatFromMat(obj = x.sp, input.mat="bmat", genes=genes.sel.gr, do.par = T, num.cores = 2)", but get this error "Error in count.df[, 2] : subscript out of bounds".

How to fix it?

Thanks

fancody commented 6 months ago

I've had this issue recently as well. I modified the line 96: count.i = data.use[,idx.bins.i,dropping=TRUE] to count.i = data.use[,idx.bins.i]; and the line 104: count.i = Matrix::rowSums(data.use[,idx.bins.i,dropping=TRUE]); to count.i = Matrix::rowSums(data.use[,idx.bins.i); in SnapATAC-master/R/createGmat.R. After that, add before running createGmatFromMat source('/SnapATAC-master/R/createGmat.R') library(parallel) This makes createGmatFromMat work successfully, but I'm not sure if this change will affect the result