How to select data from assays list in SummarizedExperiment to plot
1
1
Entering edit mode
22 months ago
WUSCHEL ▴ 810

I am using DEP Bioconductor package https://bioconductor.org/packages/release/bioc/vignettes/DEP/inst/doc/DEP.html I want to visualize normal distribution of data using fitdistrplus pakage's descdist function

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
r bioconductor DEP SummarizedExperiment • 1.3k views
ADD COMMENT
1
Entering edit mode

I think the correct syntax should be :

data_for_dist <- data_filt@assays@data@listData %>%as.data.frame() %>% na.omit() %>% gather(sample,value)

Check the structure of data_filt@assays, because .->data sounds me strange

ADD REPLY
0
Entering edit mode

Thank you this works.

ADD REPLY
1
Entering edit mode
22 months ago
ATpoint 85k

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.

ADD COMMENT

Login before adding your answer.

Traffic: 1649 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