Question: How to work with dplyr verbs in the colData slot of SingleCellExperiment objects?
1
gravatar for ramonmassoni
11 weeks ago by
ramonmassoni10
ramonmassoni10 wrote:

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 • 89 views
ADD COMMENTlink modified 11 weeks ago by Martin Morgan ♦♦ 23k • written 11 weeks ago by ramonmassoni10

Maybe, you find useful these two packages:

  1. https://github.com/sa-lee/plyranges
  2. https://github.com/const-ae/tidygenomics
ADD REPLYlink modified 11 weeks ago • written 11 weeks ago by Konstantinos Yeles20
Answer: How to work with dplyr verbs in the colData slot of SingleCellExperiment objects
0
gravatar for Martin Morgan
11 weeks ago by
Martin Morgan ♦♦ 23k
United States
Martin Morgan ♦♦ 23k wrote:

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 COMMENTlink written 11 weeks ago by Martin Morgan ♦♦ 23k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 116 users visited in the last hour