SingleCellExperiment icon indicating copy to clipboard operation
SingleCellExperiment copied to clipboard

version field duplicated in int_metadata after concatenating two SCE objects

Open lambdamoses opened this issue 4 years ago • 4 comments

I don't think this affects the users, but I found out this issue when writing a cbind method for a class that inherits from SCE and it caused a unit test to fail. Here's the reprex:

# From an example from the SCE package
ncells <- 100
u <- matrix(rpois(20000, 5), ncol=ncells)
v <- log2(u + 1)

pca <- matrix(runif(ncells*5), ncells)
tsne <- matrix(rnorm(ncells*2), ncells)

sce <- SingleCellExperiment(assays=list(counts=u, logcounts=v),
    reducedDims=SimpleList(PCA=pca, tSNE=tsne))

Then see the int_metadata in the R console.

> int_metadata(sce)
$version
[1] ‘1.15.2’

Now I concatenate the same SCE object

sce2 <- cbind(sce, sce)

And got this:

> int_metadata(sce2)
$version
[1] ‘1.15.2’

$version
[1] ‘1.15.2’

lambdamoses avatar Apr 14 '22 23:04 lambdamoses

Hi @lambdamoses ,

thanks for reporting this. @LTLA is this the intended behavior?

I would imagine that each object should have only one version, but on the other hand, can you combine two objects with different versions? And in this case, would you want to keep track of this? Or which version should "win"?

drisso avatar Apr 15 '22 13:04 drisso

Probably just a consequence of mimicking the default behavior for SE's cbind.

In this case, the correct behavior would be to replace both versions with the current version, given that cbind should return an SCE with its internal structure updated to the current version of the package.

LTLA avatar Apr 15 '22 18:04 LTLA

If both are replaced by the current version, then there really should be one version field in the int_metadata in the concatenated object, not two duplicated ones.

lambdamoses avatar Apr 15 '22 19:04 lambdamoses

Yes, that would be the intent.

LTLA avatar Apr 15 '22 19:04 LTLA