How to work with dplyr verbs in the colData slot of SingleCellExperiment objects?
2
1
Entering edit mode
ramonmassoni ▴ 10
@ramonmassoni-19642
Last seen 5 months ago
Spain

Hi,

I'm trying to work in a tidyverse framework with the cell metadata (colData) of a SingleCellExperiment object. To do that, I have to explicitly convert it to a data frame with (as.data.frame). However, if I try to set colData(sce) <- as.data.frame(colData(sce)), it throws an error. I tried to convert it to a datatable with (as.data.table), but it didn't work either. If you have any insight it would be much appreciate it, especially since dplyr is one of the most useful packages to work with standard data frames.

Thanks,

Ramon

SingleCellExperiment • 2.0k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
1
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States

These S4 objects are based on 'DataFrame', so

> colData(sce) = as(colData(sce), "DataFrame")

Or

> colData(sce) = colData(sce) %>% as.data.frame() %>% etc... %>% DataFrame()
ADD COMMENT

Login before adding your answer.

Traffic: 798 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6