r3fang / SnapATAC

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

Error in runJaccard.default #113

Open mvinyard opened 4 years ago

mvinyard commented 4 years ago

Hi Rongxin, I'm trying to run SnapATAC and I'm getting an error that I'm having trouble getting around/solving. It's in the runJaccard() step. All steps prior to this work. I started the analysis from the fastq files using snaptools. I then import the snap file and I am following the below pasted example. The only part on which I diverge is in the 'barcode selection', step 1 because I am starting from a snaptools-made snap file and do not have the corresponding 'barcodes' file.

Tutorial: https://github.com/r3fang/SnapATAC/blob/master/examples/10X_brain_5k/README.md#diffusion_maps

Input:

x.sp = runJaccard(
obj = x.sp,
tmp.folder=tempdir(),
mat = "bmat",
max.var=2000,
# ncell.chunk=1000,
# do.par=FALSE,
# num.cores=10,
seed.use=10)

Out:

Error in runJaccard.default(obj = x.sp, tmp.folder = tempdir(), mat = "bmat", : input matrix contains empty rows, remove empty rows first
Traceback:

1. runJaccard(obj = x.sp, tmp.folder = tempdir(), mat = "bmat", 
 .     max.var = 2000, seed.use = 10)
2. runJaccard.default(obj = x.sp, tmp.folder = tempdir(), mat = "bmat", 
 .     max.var = 2000, seed.use = 10)
3. stop("input matrix contains empty rows, remove empty rows first")
r3fang commented 4 years ago

Hi,

I think you are looking at a tutorial that is out of date. “runJaccard” is a function was used in previous version. Unfortunately, you will have to perform barcode selection. Without the barcode file, you can select barcode based on the following code:

> library(GenomicRanges);
> promoter.df = read.table(“hg19.promoter.bed”); # predefined promoter regions
> promoter.gr <http://promoter.gr/> = GRanges(promoter.df[,1], IRanges(promoter.df[,2], promoter.df[,3]));
> idy = queryHits(findOverlaps(x.sp@feature, promoter.gr <http://promoter.gr/>));
> promoter_ratio = (Matrix::rowSums(x.sp@bmat[,idy])+1) / (Matrix::rowSums(x.sp@bmat)+1) ;
> UMI = log10(Matrix::rowSums(x.sp@bmat)+1);
> data = data.frame(UMI, promoter_ratio);

Then follow rest of the tutorial: https://github.com/r3fang/SnapATAC/blob/master/examples/10X_brain_5k/README.md https://github.com/r3fang/SnapATAC/blob/master/examples/10X_brain_5k/README.md

On Oct 6, 2019, at 3:37 PM, Michael Vinyard notifications@github.com wrote:

runJaccard