[Bioc-devel] How to set dimnames inside constructor function?

Muad Abd El Hay mu@d@@bde|h@y @end|ng |rom ph@rm@@un|-he|de|berg@de
Thu Jun 18 11:17:15 CEST 2020


Hello everyone,

This is my first attempt at writing a package (wrote it in S3 and now 
porting it to S4). So it might be a trivial question.

I am trying to extend the SummarizedExperiment object for calcium 
imaging data (no gene names as features). Features/rownames are the 
number of the frames and colnames are the cells/ROIs.

Inside the constructor function, I wanted to set the rownames and 
colnames as below:

```R
   se <- SummarizedExperiment(list(raw=raw),
                              rowData = DataFrame(time = time),
                              ...)
   dimnames(se) <- list(paste("f", 1:nrow(se), sep=""),
                        paste("name", 1:ncol(se), sep="_"))
   .CalciumExperiment(se)
```

But I keep getting the following error:

```R
Error in `assays<-`(`*tmp*`, withDimnames = withDimnames, ..., value = 
`*vtmp*`) :
   please use 'assay(x, withDimnames=FALSE)) <- value' or 'assays(x,
   withDimnames=FALSE)) <- value' when the dimnames on the supplied
   assay(s) are not identical to the dimnames on CalciumExperiment 
object
   'x'
```

I also tried using `rownames(se)`and `colnames(se)`with the same error. 
Setting the `dimnames`, `colnames`, or `rownames` on the `raw` matrix 
beforehand also did not work.

Am I missing something fundamental here?

Thank you in advance!
Best wishes,
Muad Abd El Hay
	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list