[Bioc-devel] rownames in SummerizedExperiments

Simon Anders anders at embl.de
Sat Apr 5 17:39:55 CEST 2014


Hi Martin et al.

When I use "mcols" on a SummerizedExperiment object, I get a DataFrame
with the row metadata, but without rownames. This is quite annoying if I
want to select specific rows using my feature identifiers.

Would it be possible to change that?

  Simon



Demonstration of the issue:

> library( GenomicRanges )
[...]
>
> # Example data matrix with row and column names:
> a <- matrix( rnorm(50), c( 10, 5 ) )
> colnames(a) <- paste0( "Sample_", 1:5 )
> rownames(a) <- paste0( "Gene_", sample( LETTERS, 10 ) )
> a
         Sample_1    Sample_2   Sample_3    Sample_4   Sample_5
Gene_G -0.3877467 -1.70879454  0.7939223 -2.34550441  0.8595643
Gene_K -0.2552112  0.08670308 -1.4158207  0.66415623 -2.3311998
Gene_M -0.4514518  0.30546322 -0.1799235  1.32129088  0.5253143
Gene_T  0.7403792  0.22984996  0.1972806  1.67471472  0.7371430
Gene_Z  1.0290360 -0.49934034  2.5813815  0.60148770  0.3925438
Gene_B -0.6196811 -0.23720962  1.6226878 -0.39416017 -0.9792215
Gene_W  0.6341272  0.70582774  0.8372586  2.20678476 -1.5472927
Gene_L  0.4160801 -0.60180955  0.5366517 -2.41960274 -0.1754423
Gene_U  1.1331233  0.19707903 -1.1297945  0.03272385 -2.6627403
Gene_A -0.9800668 -0.61572952 -1.4320614  0.16594756 -1.4636233
>
> # Create a SummerizedExperiment from it:
> se <- SummarizedExperiment( a )
>
> # The row names have been taken over from 'a' to 'se':
> rownames(se)
 [1] "Gene_G" "Gene_K" "Gene_M" "Gene_T" "Gene_Z" "Gene_B" "Gene_W" "Gene_L"
 [9] "Gene_U" "Gene_A"
>
> # Add some meta data:
> mcols(se)$yellowness <- runif(10)
> mcols(se)$greenness <- runif(10)
>
> # Look at the meta data
> mcols(se)
DataFrame with 10 rows and 2 columns
   yellowness  greenness
    <numeric>  <numeric>
1   0.0772510 0.77249283
2   0.9760104 0.01193128
3   0.8420076 0.61835914
4   0.2859476 0.97866574
5   0.8153054 0.91518594
6   0.4111647 0.06934432
7   0.9445907 0.39559884
8   0.7793326 0.58575488
9   0.4379305 0.53325324
10  0.2076865 0.46240856
>
> # No row names :-(
>
>
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] GenomicRanges_1.14.4 XVector_0.2.0        IRanges_1.20.6
[4] BiocGenerics_0.8.0

loaded via a namespace (and not attached):
[1] stats4_3.0.2



More information about the Bioc-devel mailing list