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

Error in colnames<-,ExperimentList #338

Open
lgatto opened this issue Feb 5, 2025 · 0 comments
Open

Error in colnames<-,ExperimentList #338

lgatto opened this issue Feb 5, 2025 · 0 comments

Comments

@lgatto
Copy link
Collaborator

lgatto commented Feb 5, 2025

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)'
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