How to render summary list for `GRangesList` by using `SummarizedExperiment` package?
0
0
Entering edit mode
@jurat-shahidin-9488
Last seen 4.7 years ago
Chicago, IL, USA

Hi:

Given processed ChIP-Seq peaks in `GRangesList`, I want to use the functions from `SummarizedExperiment` package to render succinct summary output. However, I looked into package vignette and tried to learn how to use this on `GRangesList`. My goal is, based on `GRangesList`, I want to let R print me out the short summary list (# of regions, metadata column, rows/columns, and others). I learned the features of `SummarizedExperiment` from package vignette how to do it, but I got an error. Here is my attempt:

lapply(seq_along(grs), function(x) {
    SummarizedExperiment(assays = NROW(x),
                         rowRanges = x,
                         colData=mcols(x))
})

the error message is:

Error in if (assays_nrow != rowData_nrow) { : argument is of length zero

why getting this error? How to fix that? How to apply `summarizedExperiment` method on `GRangesList` to render summary list? Can anyone direct me how to make this happen? Thanks in advance

r summarizedexperiment grangeslist • 2.0k views
ADD COMMENT
1
Entering edit mode

 

Briefly, there is no simple approach to this.  However, to get a working example:

library(GenomicRanges)

library(SummarizedExperiment)

example(GRangesList) # creates 'grl' in .GlobalEnv

colrep = function(x,n) matrix(x, nr=length(x), nc=n) # utility to create usable 'assay'

msel = lapply(grl, function(x) SummarizedExperiment(colrep(start(x),nrow(mcols(x))), rowRanges=x,

    colData=mcols(x)))

> msel

$gr1

class: RangedSummarizedExperiment 

dim: 1 1 

metadata(0):

assays(1): ''

rownames: NULL

rowData names(2): score GC

colnames: NULL

colData names(2): score GC

$gr2

class: RangedSummarizedExperiment 

dim: 2 2 

metadata(0):

assays(1): ''

rownames: NULL

rowData names(2): score GC

colnames: NULL

colData names(2): score GC

$gr3

class: RangedSummarizedExperiment 

dim: 2 2 

metadata(0):

assays(1): ''

rownames: NULL


 

rowData names(2): score GC

colnames: NULL

colData names(2): score GC

Your attempt failed because you did not supply a matrix for "assay".    

ADD REPLY
0
Entering edit mode

@Vincent: Dear Vincent, thanks for your help. BTW, I am expecting rather simple, intuitive solution to achieve my goal. What if I first flatten out GRangesList as one common GRanges, then use SummarizedExperiment package to render simple statistics? Is that workable?

ADD REPLY
1
Entering edit mode
I don't know that SummarizedExperiment is a good target for what you are trying to do. Is there a matrix of values to serve as "assay", with rows corresponding to features and columns corresponding to samples? Organizing such a matrix in coordination with feature-level and sample-level and experiment-level metadata is the primary purpose of SummarizedExperiment. The terminology likely derives from the common use case of summarizing short reads from multiple samples into a matrix, with the primary "summary" step being the quantification of 'features' through operations on sample-specific collections of reads. I am not sure this is what you are trying to do given the brevity of your description of intent. On Sun, Mar 12, 2017 at 9:49 AM, Jurat Shahidin [bioc] < noreply@bioconductor.org> wrote: > Activity on a post you are following on support.bioconductor.org > > User Jurat Shahidin <https: support.bioconductor.org="" u="" 9488=""/> wrote Comment: > How to render summary list for `GRangesList` by using > `SummarizedExperiment` package? > <https: support.bioconductor.org="" p="" 93740="" #93743="">: > > @Vincent: Dear Vincent, thanks for your help. I am wondering any easier > workaround to do this. I am expecting rather simple, intuitive solution to > achieve my goal. What if I first flatten out `GRangesList` as one common > `GRanges`, then use `SummarizedExperiment` package to render simple > statistics? Is that workable? > > ------------------------------ > > Post tags: r, summarizedexperiment, grangeslist > > You may reply via email or visit https://support.bioconductor. > org/p/93740/#93743 >
ADD REPLY
0
Entering edit mode

@Vincent: Dear vincent, the problem I faced is printing out GRangesList is not favorable for me, while rendering summary of each GRanges would be good option aims to give clear output for the user, that's why I am trying to find the easy workaround for this problem. Hope you will direct me some useful solution. Thanks in advance :)

ADD REPLY

Login before adding your answer.

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