Skip to content

Instantly share code, notes, and snippets.

@mikelove
Last active July 25, 2018 20:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikelove/8fb94c610b588d4a6a64848d3fcbdf76 to your computer and use it in GitHub Desktop.
Save mikelove/8fb94c610b588d4a6a64848d3fcbdf76 to your computer and use it in GitHub Desktop.
SummarizedExperiment apparently missing validity check on re-assignment of rownames of rowData
# this is using SummarizedExperiment v1.11.5
suppressPackageStartupMessages(library(SummarizedExperiment))
m <- matrix(1:20, nrow=5, ncol=4, dimnames=list(letters[1:5], LETTERS[1:4]))
# this gives an error, good.
rowdata <- data.frame(x=1:5, row.names=letters[5:1])
se <- SummarizedExperiment(m, rowData=rowdata)
# build the right way
rowdata <- data.frame(x=1:5, row.names=letters[1:5])
se <- SummarizedExperiment(m, rowData=rowdata)
z <- rowData(se)[5:1,,drop=FALSE]
# so there's an problem:
all(rownames(se) == rownames(z))
# yet this is allowed, bad.
rowData(se) <- z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment