I am using R version 3.4.1, Bioconductor 3.5 and RStudio to use scater package. I have 7 single-cell RNA seq datasets (from a 10x Genomics experiment), each corresponding to a different time point. Each dataset is a SCESet object. I want to merge the data all together. I have found there is the mergeSCESet function. However, this works perfectly well on some pairs of datasets, but not all. If not, I got this error :
Error in Biobase::combine(exprs(x), exprs(y)) :
matrix shared row and column elements differ: Mean relative difference: 1.102234
What is this mean relative difference ? How could I fix this or bypass it ?
The combine step will identify entries of the exprs(x) and exprs(y) matrices that have the same row and column names. For these entries, the expression values need to be the same in order for the merge to succeed. Otherwise, the function doesn't know which ones to keep in the output matrix.
In your case, I'm willing to bet that some of the cell barcodes are repeated between 10X experiments (and obviously the gene annotation will be the same), resulting in some matrix entries that have the same row and column names across multiple experiments. This probably doesn't happen all the time, so the function may work fine in some data sets but not in others. The simplest solution is just to slap an experiment-specific prefix onto the column names, e.g., "Exp1-ACACTGCGACT-1" or something, prior to running the function.
Personally, I've hated mergeSCESet for a long time, and I'm happy to say that as we transition to the SingleCellExperiment class in the next release, you will be able to just cbind the individual objects together to obtain a merged object (assuming that the row order is the same across individual matrices). In your case, the cbind function may complain about duplicate column names, but that's a more informative error message than the one you get from mergeSCESet.