Skip to content

combineCols should keep names in metadata with use.names=TRUE #66

@LTLA

Description

@LTLA

I'm not quite sure why I did this, but the current code at

metadata=unlist(lapply(all.se, metadata), recursive=FALSE, use.names=FALSE),

wipes out the names of the metadata list, e.g.,

example(SummarizedExperiment, verbose=FALSE)
metadata(se) <- list(A=1, B=2, C=3)
rownames(se) <- seq_len(nrow(se))
combined <- combineCols(se, se)
metadata(combined)
## [[1]]
## [1] 1
## 
## [[2]]
## [1] 2
## 
## [[3]]
## [1] 3
## 
## [[4]]
## [1] 1
## 
## [[5]]
## [1] 2
## 
## [[6]]
## [1] 3

Oops. Same issue affects both SEs and RSEs at their respective methods.

It should be easily fixable by just doing something like this:

all.meta <- lapply(all.se, metadata)
names(all.meta) <- NULL # or unname, I suppose
combined.meta <- unlist(all.meta, recursive=FALSE)

And then using that in the args list. This eliminates the names from the argument list of combineCols(...), while preserving the list names inside the metadata() for each SE. This gives a relatively nicer:

metadata(combined)
## $A
## [1] 1
## 
## $B
## [1] 2
## 
## $C
## [1] 3
## 
## $A
## [1] 1
## 
## $B
## [1] 2
## 
## $C
## [1] 3

Duplicate names... oh well, we'll just have to put up with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions