Bioconductor / RaggedExperiment

Matrix-like representations of mutation and CN data
https://bioconductor.org/packages/RaggedExperiment
4 stars 3 forks source link

Error in rowData annotation (that also affects colData) #17

Closed lgeistlinger closed 6 years ago

lgeistlinger commented 6 years ago
library(GenomicRanges)
library(RaggedExperiment)
grl <- GRangesList(
     sample1 = GRanges( c("chr1:1-10", "chr2:15-18", "chr2:25-34") ),
     sample2 = GRanges( c("chr1:1-10", "chr2:11-18" , "chr2:25-36") ),
     sample3 = GRanges( c("chr1:2-11", "chr2:14-18", "chr2:26-36") ),
     sample4 = GRanges( c("chr1:1-12", "chr2:18-35" ) ),
     sample5 = GRanges( c("chr1:1-12", "chr2:11-17" , "chr2:26-34") ) , 
     sample6 = GRanges( c("chr1:1-12", "chr2:12-18" , "chr2:25-35") )
)

ra <- RaggedExperiment(grl)

Some arbitrary colData annotation:

> colData(ra)$colanno <- seq_len(ncol(ra)) 
> colData(ra)
DataFrame with 6 rows and 1 column
          colanno
        <integer>
sample1         1
sample2         2
sample3         3
sample4         4
sample5         5
sample6         6

Ok.

Some arbitrary rowData annotation:

> rowData(ra)$rowanno <- LETTERS[seq_len(nrow(ra))]
> rowData(ra)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘getListElement’ for signature ‘"GRanges"’

Also, colData now returns the row annotation (??):

> colData(ra)
DataFrame with 6 rows and 1 column
      rowanno
  <character>
1           A
2           B
3           C
4           D
5           E
6           F
> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.3

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
[1] RaggedExperiment_1.5.0 GenomicRanges_1.33.1   GenomeInfoDb_1.17.0   
[4] IRanges_2.15.4         S4Vectors_0.19.2       BiocGenerics_0.27.0   

loaded via a namespace (and not attached):
 [1] lattice_0.20-35             matrixStats_0.53.1         
 [3] bitops_1.0-6                grid_3.5.0                 
 [5] zlibbioc_1.27.0             XVector_0.21.0             
 [7] Matrix_1.2-14               BiocParallel_1.15.0        
 [9] tools_3.5.0                 Biobase_2.41.0             
[11] RCurl_1.95-4.10             DelayedArray_0.7.0         
[13] compiler_3.5.0              SummarizedExperiment_1.11.1
[15] GenomeInfoDbData_1.1.0     
> 
lwaldron commented 6 years ago

Even though there is a brow, what would be the interpretation of rowRanges for a ragged experiment? Do you have a use case? -- Levi Waldron http://www.waldronlab.io Assistant Professor of Biostatistics CUNY School of Public Health US: +1 646-364-9616 Skype: levi.waldron

lgeistlinger commented 6 years ago

For instance, you can think of the individual CNV calls from ABSOLUTE - which would correspond to the rowRanges here. You might want to annotate quality measures to the calls such as the number of probes supporting this call.

LiNk-NY commented 6 years ago

Hi Ludwig, @lgeistlinger In this instance, mcols and rowData are both referring to the same information, annotations of the ranges in a GRangesList. Essentially when you do mcols<- or rowData<-, you're adding to "number of assays". Since each column in mcols is an "assay". That's how RaggedExperiment is represented.

I found a bug in the replacement method that will fix this. Thanks!