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

Question: Extending SummarizedExperiment without rowRanges argument
gravatar for xuren2120
3 months ago by
xuren21200 wrote:

Hi all,


I have some trouble with extending SummarizedExperiment without rowRanges argument. I'm trying to create a class that inherits from SummarizedExperiment. However, when constructing the class, there is an error which says 

Error in validObject(.Object) : invalid class “myTestClass” object: 
  length of 'rowRanges' (0) must equal nb of rows in 'x' (200)

Here is the code sample:

###  set class and constructor
             design = "ANY"

myTestClass <- function(countData, colData, design, ...){
    se = SummarizedExperiment(assays = list(counts = countData),
                              colData = colData, ...)
    return(new("myTestClass", se, design = design))

##  create an example count and colData
nrows = 200
ncols = 10
counts <- matrix(rnbinom(nrows * ncols, 10, 0.3), nrows)
colData = DataFrame(condition=rep(c("case", "control"), 5))

##  construct my class
myTestClass(countData = counts, colData = colData, design = ~1)
Error in validObject(.Object) : invalid class “myTestClass” object: 
length of 'rowRanges' (0) must equal nb of rows in 'x' (200)


I couldn't figure out where is the problem. Could anyone please help check? Is it possible that my class inherit from SummarizedExperiment without rowRanges argument? Thank you!

Xu Ren


> sessionInfo()

R version 3.4.0 (2017-04-21)

Platform: x86_64-redhat-linux-gnu (64-bit)

Running under: Red Hat Enterprise Linux

Matrix products: default

BLAS/LAPACK: /usr/lib64/R/lib/


[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              

[3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    


[7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 

[9] LC_ADDRESS=C               LC_TELEPHONE=C            


attached base packages:

[1] parallel  stats4    stats     graphics  grDevices utils     datasets

[8] methods   base     

other attached packages:

[1] SummarizedExperiment_1.6.5 DelayedArray_0.2.7        

[3] matrixStats_0.54.0         Biobase_2.36.2            

[5] GenomicRanges_1.28.6       GenomeInfoDb_1.12.3       

[7] IRanges_2.10.5             S4Vectors_0.14.7          

[9] BiocGenerics_0.22.1       

loaded via a namespace (and not attached):

[1] lattice_0.20-35         bitops_1.0-6            grid_3.4.0             

[4] zlibbioc_1.22.0         XVector_0.16.0          Matrix_1.2-14          

[7] tools_3.4.0             RCurl_1.95-4.11         compiler_3.4.0         

[10] GenomeInfoDbData_0.99.0
ADD COMMENTlink modified 3 months ago by Martin Morgan ♦♦ 22k • written 3 months ago by xuren21200
Answer: Extending SummarizedExperiment without rowRanges argument
gravatar for Martin Morgan
3 months ago by
Martin Morgan ♦♦ 22k
United States
Martin Morgan ♦♦ 22k wrote:

Try extending the SummarizedExperiment rather than RangedSummarizedExperiment class

             design = "ANY"

Questions about package development should be directed to the bioc-devel mailing list.

ADD COMMENTlink written 3 months ago by Martin Morgan ♦♦ 22k
Please log in to add an answer.


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