However I get an error. How can I select data from assays list in SummarizedExperiment to plot?
# Normalize the data
data_norm <- normalize_vsn(data_filt)
data_for_dist <- data_filt@assays$`.->data`@listData %>%as.data.frame() %>% na.omit() %>% gather(sample,value)
descdist(data_for_dist$value)
Error
Error in h(simpleError(msg, call)) : error in evaluating the argument 'object' in selecting a method for function 'na.omit': error in evaluating the argument 'x' in selecting a method for function 'as.data.frame': $ operator not defined for this S4 class
The SummarizedExperiment format, like (almost) every Bioconductor data structure has setter and getter functions that access slots and assays. Here that is:
assay(data_filt, assayName)
assayName is the name of the assay but can be omitted if it only holds a single assay, then the first one is used. Use assayNames to see all assays in the SE. Disagree here with the comment to manually access slots as this structure might change in future releases and break code while getter functions are constant. See the SummarizedExperiment vignette at Bioconductor for extensive documentation on all relevant getters and setters.
I think the correct syntax should be :
Check the structure of
data_filt@assays
, because.->data
sounds me strangeThank you this works.