Skip to content

Error in colnames<-,ExperimentList #338

@lgatto

Description

@lgatto

I am under the impression that I should be able to replace the colnames of the different assays in an ExperimentList and a MAE:

> showMethods(`colnames<-`)
Function: colnames<- (package base)
x="ANY", value="ANY"
x="CompressedSplitDataFrameList", value="ANY"
x="DataFrame", value="ANY"
x="ExperimentList", value="CompressedCharacterList"
    (inherited from: x="ANY", value="ANY")
x="ExperimentList", value="list"
    (inherited from: x="ANY", value="ANY")
x="ExperimentList", value="SimpleCharacterList"
    (inherited from: x="ANY", value="ANY")
x="matrix", value="character"
    (inherited from: x="ANY", value="ANY")
x="MultiAssayExperiment", value="list"
x="MultiAssayExperiment", value="List"
x="RangedSelection", value="ANY"
x="SimpleDataFrameList", value="ANY"
x="SummarizedExperiment", value="character"
    (inherited from: x="ANY", value="ANY")

But it doesn't work for either. Here I try with and ExperimentList

> example(SummarizedExperiment, echo = FALSE) ## to get se0
> el <- ExperimentList(list(a = se0[, 1], b = se0[, 1], c = se0[, 1]))
> el
ExperimentList class object of length 3:
 [1] a: SummarizedExperiment with 200 rows and 1 columns
 [2] b: SummarizedExperiment with 200 rows and 1 columns
 [3] c: SummarizedExperiment with 200 rows and 1 columns
> colnames(el)
CharacterList of length 3
[["a"]] A
[["b"]] A
[["c"]] A
> colnames(el) <- as.list(1:3)
Error in dimnames(x) <- dn : 'dimnames' applied to non-array
> colnames(el) <- CharacterList(as.list(1:3))
Error in dimnames(x) <- dn : 'dimnames' applied to non-array

The error is different if I try with a MAE

> mae <- MultiAssayExperiment(el)
> colnames(mae)
CharacterList of length 3
[["a"]] A
[["b"]] A
[["c"]] A
> colnames(mae) <- CharacterList(as.list(letters[1:3]))
Error in `colnames<-`(`*tmp*`, value = new("CompressedCharacterList",  : 
  'value' names and lengths should all be identical to 'names(x)'

Metadata

Metadata

Assignees

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