Open manalb95 opened 4 years ago
can you please show me the output of the following command:
showBinSizes(snap_file)
where snap_file is each of the snap files. This command will show the bin size(s) in the snap file.
Here is the output for each of the files:
showBinSizes('SU001_post/CRA-count/outs/possorted.snap') [1] 5000 showBinSizes("SU001_pre/CRA-count/outs/possorted.snap") [1] 5000 showBinSizes("SU010_pre/CRA-count/outs/possorted.snap") [1] 5000
Hi
This is likely because the bins are in different order in different snap files. you might need to manually reorder the bins before merging:
> library(SnapATAC);
> file.list = c("CEMBA180305_2B.snap", "atac_v1_adult_brain_fresh_5k.snap");
> sample.list = c("snATAC", "10X");
> x.sp.ls = lapply(seq(file.list), function(i){
x.sp = createSnap(file=file.list[i], sample=sample.list[i]);
x.sp
})
> names(x.sp.ls) = sample.list;
> x.sp.list = lapply(seq(x.sp.list), function(i){
x.sp = addBmatToSnap(x.sp.list[[i]], bin.size=5000);
x.sp
})
> bin.shared = Reduce(intersect, lapply(x.sp.list, function(x.sp) x.sp@feature$name));
> x.sp.list <- lapply(x.sp.list, function(x.sp){
idy = match(bin.shared, x.sp@feature$name);
x.sp[,idy, mat="bmat"];
})
> x.sp = Reduce(snapRbind, x.sp.list);
for more details, you can refer to this example: https://github.com/r3fang/SnapATAC/blob/master/examples/10X_snATAC/README.md
Hello, I have 3 different datasets which I am trying to analyse together. I generated the snap files using snaptools snap-pre, and added the bin matrix using snaptools snap-add-bmat. However, after merging the datasets in R and trying to add the bin matrix to the snap file I get this error:
x.sp = addBmatToSnap(x.sp, bin.size=5000); Error in addBmatToSnap.default(x.sp, bin.size = 5000) : bins does not match between snap files, please regenerate the cell-by-bin matrix by snaptools
I used the same settings when generating the bins.