Oshlack / splatter

Simple simulation of single-cell RNA sequencing data
http://oshlacklab.com/splatter/
GNU General Public License v3.0
217 stars 57 forks source link

Conditions incorrectly assigned to samples #160

Closed jordimartorell closed 1 year ago

jordimartorell commented 1 year ago

Dear developers,

I am strugling with the conditional effects in splatPop. When I run this code, with a high cde.facLoc to see clearly the difference between conditions, and with one condition assigned to one sample and other conditions to 9 samples:

sim <- splatPopSimulate(params = newSplatPopParams(nGenes = 100,
                        batchCells=10,
                        batch.size=10,
                        condition.prob=c(0.1, 0.9),
                        cde.facLoc = 10,
                        seed=1234),
            vcf=mockVCF(n.samples=10),
            method="single",
            sparsify = FALSE) 

sim <- logNormCounts(sim)
sim <- runPCA(sim)
plotPCA(sim, colour_by = "Condition")

I get the following PCA:

Rplot

It can be observed that the first principal component clearly separate the two conditions, but Condition1 is not assigned to the sample at the left, but to one of the 9 samples at the right instead. Furthermore, I've made some tests and, with this labels, I find no differential expression between conditions. However, after manual "correction" of the labels, I find a very significant DE.

I tried many different parameters in the simulation, but I always get the same results. Could you please check if there is some bug with the samples assignment to conditions?

Best regards, Jordi

lazappi commented 1 year ago

Hmmm...possibly there is an indexing issue somewhere? @azodichr can you please look into this?

azodichr commented 1 year ago

Hi @jordimartorell, Thanks for bringing this issue to our attention. I have fixed the problem with conditional group assignments getting mislabeled and pushed it to @lazappi (see pull reqest "Issue_158") to be merged into the dev version.

lazappi commented 1 year ago

I have merged the PR and the fix should be available on release and devel soon