version field duplicated in int_metadata after concatenating two SCE objects
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’
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"?
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.
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.
Yes, that would be the intent.