Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LTLA opened this issue Nov 4, 2022 · 0 comments
Open

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

LTLA opened this issue Nov 4, 2022 · 0 comments

Comments

@LTLA
Copy link
Contributor

LTLA commented Nov 4, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant