The support.bioconductor.org editor has been updated to markdown! Please see more info at: Tutorial: Updated Support Site Editor

Question: How to work with dplyr verbs in the colData slot of SingleCellExperiment objects?
1
gravatar for ramonmassoni
23 days 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 • 55 views
ADD COMMENTlink modified 23 days ago by Martin Morgan ♦♦ 22k • written 23 days 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 23 days ago • written 23 days ago by Konstantinos Yeles20
Answer: How to work with dplyr verbs in the colData slot of SingleCellExperiment objects
0
gravatar for Martin Morgan
23 days ago by
Martin Morgan ♦♦ 22k
United States
Martin Morgan ♦♦ 22k 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 23 days ago by Martin Morgan ♦♦ 22k
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: 338 users visited in the last hour