I am using the voomLmFit
workflow to process and analyze an RNA-seq dataset. This goes fine.
Yet, when I try to subset the MArrayLM
object, that is obtained by running voomLmFit
, to only include a subset of genes (in my case annotated with a specific biotype) I noticed that the content of the EList
component is not subsetted (= $E
, $weights
and $genes
). This is in contrast to what I expected.
Therefore: is this intentional? If so, how then to subset the EList
component as well?
Thanks,
G
Note 1: I observed the same when subsetting the fit object that is obtained after the eBayes()
step.
Note 2: is there a reason why the annotation information is present twice? $genes
is also present in the EList
component.
Below some code to illustrate this (as per Chapter 4 (page 60) of the edgeR
user guide).
> library(edgeR)
> library(tweeDEseqCountData)
> data(pickrell1)
>
> Counts <- exprs(pickrell1.eset)
> Gender <- pickrell1.eset$gende
>
> data(annotEnsembl63)
> annot <- annotEnsembl63[,c("Symbol","Chr")]
>
> y <- DGEList(counts=Counts, genes=annot[rownames(Counts),])
>
> isexpr <- filterByExpr(y, group=Gender)
> hasannot <- rowSums(is.na(y$genes))==0
>
> y.filtered <- y[isexpr & hasannot, , keep.lib.sizes=FALSE]
>
> y.filtered <- normLibSizes(y.filtered)
>
> design <- model.matrix(~Gender)
>
> v <- edgeR::voomLmFit(counts = y.filtered, design = design, block = NULL, sample.weights = FALSE, plot = TRUE, normalize.method = "none")
>
> ## define some genes of interest
> my.genes <- c("ENSG00000127720", "ENSG00000051596", "ENSG00000236211")
>
> ## subset.
> ## Note that all content of the EList still has original dimension
> v[my.genes,]
An object of class "MArrayLM"
$coefficients
(Intercept) Gendermale
ENSG00000127720 0.6867804 -0.09056663
ENSG00000051596 5.1102007 0.01717677
ENSG00000236211 5.2132901 0.03700956
$stdev.unscaled
(Intercept) Gendermale
ENSG00000127720 0.12254247 0.1899450
ENSG00000051596 0.06683824 0.1030391
ENSG00000236211 0.06678426 0.1029758
$sigma
[1] 0.7928014 1.0189892 2.1298141
$df.residual
[1] 67 67 67
$cov.coefficients
(Intercept) Gendermale
(Intercept) 0.025 -0.02500000
Gendermale -0.025 0.05948276
$pivot
[1] 1 2
$rank
[1] 2
$Amean
ENSG00000127720 ENSG00000051596 ENSG00000236211
0.6447488 5.1157701 5.2302451
$method
[1] "ls"
$design
(Intercept) Gendermale
1 1 1
2 1 1
3 1 0
4 1 1
5 1 0
64 more rows ...
$genes
Symbol Chr
ENSG00000127720 C12orf26 12
ENSG00000051596 THOC3 5
ENSG00000236211 AC068137.5 2
$targets
group lib.size norm.factors
NA18486 1 7750614 0.9294587
NA18498 1 13614927 1.0964857
NA18499 1 8570996 0.9576338
NA18501 1 8596932 1.1944060
NA18502 1 13377004 0.9422220
64 more rows ...
$EList
$E
NA18486 NA18498 NA18499 NA18501 NA18502 NA18504
ENSG00000127720 -0.1483337 1.122363 0.820972 1.789632 0.20215888 0.1124152
ENSG00000051596 5.8254189 4.993297 4.747626 4.842008 4.69069161 4.5306694
ENSG00000236211 6.4629749 5.313100 5.344534 4.591169 5.07719320 5.5950791
ENSG00000213697 1.5087786 1.542939 1.092274 2.049276 -0.01196593 0.9295512
ENSG00000135541 0.7950828 1.945486 1.690911 1.662252 1.91403349 1.9099224
NA18505 NA18507 NA18508 NA18510 NA18511 NA18516
ENSG00000127720 0.89663383 0.4033372 0.3556554 0.2756946 1.0557263 1.4455556
ENSG00000051596 5.15742827 5.5926549 5.5047867 5.8904044 4.7865752 5.1568699
ENSG00000236211 4.55879084 4.4194312 5.2015256 4.8111551 4.7697604 4.7508324
ENSG00000213697 1.45056943 1.0486723 1.1939044 1.1687793 0.8147182 0.2697057
ENSG00000135541 0.09693248 1.5273259 0.9836866 1.8606571 0.1626415 0.8723702
NA18517 NA18519 NA18520 NA18522 NA18523 NA18852
ENSG00000127720 0.4625639 0.3238008 0.3399790 1.307367 0.02352065 0.6362799
ENSG00000051596 5.7459651 5.3511718 5.5723555 5.943635 5.28176545 4.7924555
ENSG00000236211 5.8669000 5.7238539 5.8693372 4.045515 5.49186699 5.0015355
ENSG00000213697 -0.3545721 1.4356937 0.6294856 0.234611 0.95640645 0.8333168
ENSG00000135541 2.0986005 1.4356937 1.7749161 1.680411 0.95640645 1.7544614
NA18853 NA18855 NA18856 NA18858 NA18861 NA18862
ENSG00000127720 0.417341 0.3112431 1.2378376 0.9499893 1.584091 1.7294831
ENSG00000051596 4.482494 5.8950029 4.9620749 4.6024147 5.095053 4.7791139
ENSG00000236211 7.341379 6.1278428 4.7113788 5.0410589 4.454182 5.6892533
ENSG00000213697 1.023062 1.0249389 0.2763117 0.7529524 1.518503 0.3586454
ENSG00000135541 1.385632 1.6446669 1.0727783 0.8216652 2.321057 2.6805735
NA18870 NA18871 NA18909 NA18912 NA18913 NA18916
ENSG00000127720 1.327554 0.9402908 0.6780392 1.5197835 -0.4385061 1.3457396
ENSG00000051596 4.627834 4.2100962 4.8572540 4.3921357 5.2894143 4.5584936
ENSG00000236211 4.537837 4.8533733 4.6632855 6.1144091 5.8823608 5.1618012
ENSG00000213697 1.327554 1.0304886 0.1097555 -0.6270579 1.1464564 0.6725499
ENSG00000135541 1.554325 1.8687376 1.3178637 1.5197835 0.6834844 1.8029466
NA19093 NA19098 NA19099 NA19101 NA19102 NA19108
ENSG00000127720 1.1236172 0.09435953 0.5798838 1.3069284 0.3527364 1.185508
ENSG00000051596 4.9649194 5.55472766 5.1873785 4.5516440 4.6912157 5.220891
ENSG00000236211 3.2683887 4.51004095 3.4144601 5.0229145 5.7317815 4.888985
ENSG00000213697 -0.4613453 1.50423533 1.2778552 0.3666346 0.7397595 1.018051
ENSG00000135541 3.1316099 1.81056657 2.0538149 2.0996958 1.8617500 2.029106
NA19114 NA19116 NA19119 NA19127 NA19128 NA19130
ENSG00000127720 0.2312883 0.7382099 0.4768217 0.5111366 0.50770071 1.302568
ENSG00000051596 4.8860948 4.8857938 4.6892713 5.7533002 5.25032293 5.249536
ENSG00000236211 7.6223785 5.9443410 5.4523390 6.2257984 6.53386843 5.073173
ENSG00000213697 0.5938584 0.3930744 2.4488073 0.5111366 0.02227388 1.261345
ENSG00000135541 0.4828271 2.6993209 2.0617842 2.7976593 2.34420198 2.465703
NA19131 NA19137 NA19138 NA19140 NA19143 NA19144
ENSG00000127720 0.5344892 0.6828116 0.3746129 0.1156107 0.3226062 -0.8999756
ENSG00000051596 5.0864446 5.7960497 4.8981749 5.4574383 4.9744002 4.9939093
ENSG00000236211 5.5511383 4.7702745 4.2697980 6.0108774 4.5757609 5.8205975
ENSG00000213697 -0.5073310 0.5865963 1.5200434 0.5701765 0.5090193 1.4219525
ENSG00000135541 2.4386292 2.4967997 1.7052582 1.4692476 1.3953625 1.5081091
NA19147 NA19152 NA19153 NA19159 NA19160 NA19171
ENSG00000127720 0.10740287 1.0880426 0.1875934 -1.146275 0.04797117 1.187973
ENSG00000051596 5.15559355 5.3903732 5.0861687 4.944216 4.79889522 4.872844
ENSG00000236211 5.11327146 4.5885209 5.0828291 5.511937 4.67462662 3.995328
ENSG00000213697 -0.02384167 0.8921224 1.3068923 1.718796 0.96550901 1.489628
ENSG00000135541 1.77366547 1.7689741 2.4485535 1.175653 1.70247460 2.136747
NA19172 NA19190 NA19192 NA19193 NA19200 NA19201
ENSG00000127720 0.4772295 0.340551 -0.1694657 0.3290738 0.6201132 0.7311505
ENSG00000051596 4.8541989 4.606588 5.1678377 5.6866258 4.8792462 4.4067156
ENSG00000236211 5.0284037 4.365580 6.2527994 8.3278482 4.4312798 5.4303567
ENSG00000213697 -0.5772183 0.340551 2.4494442 -1.0245632 2.8539104 2.3373295
ENSG00000135541 1.1486067 1.122960 2.0381298 1.4779372 2.0550503 2.2050817
NA19203 NA19204 NA19209 NA19210 NA19222 NA19225
ENSG00000127720 0.0324493 1.3271402 -0.16534375 -0.1937652 1.4099509 1.3273477
ENSG00000051596 5.4905688 4.9697681 5.25284620 6.0165356 5.7410975 5.4573800
ENSG00000236211 5.5446762 4.5240954 5.33418327 6.9161222 4.4688446 4.9101226
ENSG00000213697 -0.2190895 0.5274389 -0.05431244 1.0640326 0.8794361 0.8313902
ENSG00000135541 2.9959234 2.0393379 1.93226705 2.3160959 2.4995881 1.8497687
NA19238 NA19239 NA19257
ENSG00000127720 1.4395553 1.8085983 1.1312497
ENSG00000051596 5.2685187 5.3014033 5.3920442
ENSG00000236211 4.9710466 4.5013260 4.7540804
ENSG00000213697 0.7816613 0.8228121 -0.1754116
ENSG00000135541 2.5471960 2.4991150 1.8434474
17512 more rows ...
$weights
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1.251586 1.942032 1.399736 1.541965 1.815790 1.491340 1.817455 1.926966
[2,] 5.489630 5.624351 5.563001 5.647866 5.653545 5.635361 5.653470 5.627023
[3,] 5.545679 5.603760 5.598851 5.655623 5.644411 5.651818 5.644176 5.607108
[4,] 1.570496 2.456153 1.340979 1.954851 1.735290 1.887949 1.736874 2.438297
[5,] 2.120196 3.224496 2.173426 2.617118 2.792673 2.534869 2.795030 3.202901
[,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16]
[1,] 1.841693 1.394420 2.077705 1.625174 1.888593 1.728688 1.638039 1.723509
[2,] 5.652383 5.596100 5.617030 5.655631 5.646163 5.653827 5.651471 5.654075
[3,] 5.640776 5.629390 5.597939 5.654544 5.633837 5.643307 5.656543 5.644083
[4,] 1.759935 1.759572 1.984606 2.064171 1.804553 2.197417 1.566876 2.190728
[5,] 2.828530 2.373408 3.148111 2.749081 2.893043 2.909171 2.539123 2.901225
[,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24]
[1,] 1.101696 1.867750 1.388510 1.582176 1.314756 1.776112 1.328133 1.634925
[2,] 5.222958 5.648995 5.593202 5.640857 5.544903 5.655353 5.509792 5.656303
[3,] 5.300989 5.637186 5.627773 5.652638 5.590500 5.650074 5.554565 5.654044
[4,] 1.057593 1.784725 1.751739 1.513935 1.654016 1.697770 1.272995 2.076723
[5,] 1.676916 2.864399 2.363470 2.456826 2.234534 2.736814 2.055733 2.764462
[,25] [,26] [,27] [,28] [,29] [,30] [,31] [,32]
[1,] 1.513844 1.337407 1.889688 1.101054 1.653474 1.725318 1.606082 2.059310
[2,] 5.622091 5.560858 5.646015 5.221811 5.657514 5.657258 5.646413 5.601891
[3,] 5.641065 5.602288 5.633637 5.299991 5.653104 5.653968 5.654328 5.576847
[4,] 1.449172 1.684024 1.805594 1.056983 2.100566 1.649570 1.536572 2.592129
[5,] 2.353998 2.274371 2.894547 1.675847 2.793695 2.665115 2.492654 3.388496
[,33] [,34] [,35] [,36] [,37] [,38] [,39] [,40]
[1,] 2.028913 1.894343 1.064646 2.111553 1.472951 1.946478 0.9809772 1.722634
[2,] 5.625165 5.632875 5.155325 5.610860 5.603624 5.638489 5.0632560 5.657085
[3,] 5.608138 5.614278 5.237313 5.590924 5.630788 5.623479 5.1697116 5.654097
[4,] 1.938229 2.399795 1.022230 2.017374 1.410426 1.859430 1.2171923 1.647023
[5,] 3.082920 3.156285 1.615403 3.192700 2.290006 2.972348 1.6199705 2.661320
[,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48]
[1,] 1.722194 1.897934 1.768640 1.542089 1.758088 1.802856 1.724192 1.706720
[2,] 5.654138 5.632224 5.655699 5.631323 5.652437 5.654129 5.657186 5.654885
[3,] 5.644281 5.613627 5.651159 5.647984 5.638959 5.646240 5.654022 5.646620
[4,] 2.189030 2.404035 1.690681 1.475954 2.233904 1.723065 1.648501 2.169050
[5,] 2.899207 3.161422 2.726280 2.396524 2.954225 2.774476 2.663523 2.875451
[,49] [,50] [,51] [,52] [,53] [,54] [,55] [,56]
[1,] 1.638906 2.008920 1.758545 1.353010 1.786382 1.465868 1.546138 1.562827
[2,] 5.651530 5.628552 5.652416 5.531585 5.648654 5.628888 5.632299 5.636291
[3,] 5.656602 5.612386 5.638892 5.571910 5.634516 5.648347 5.648963 5.651248
[4,] 1.567698 1.919141 2.234469 1.296624 2.268826 1.854255 1.479792 1.495613
[5,] 2.540383 3.056165 2.954926 2.096715 2.996569 2.493475 2.402617 2.427727
[,57] [,58] [,59] [,60] [,61] [,62] [,63] [,64]
[1,] 1.678833 1.493514 1.404808 1.899952 1.714734 1.514104 1.940458 1.794416
[2,] 5.656249 5.612976 5.601162 5.644636 5.654497 5.622207 5.639281 5.647503
[3,] 5.650892 5.635995 5.632213 5.631776 5.645405 5.641130 5.624548 5.632962
[4,] 2.133169 1.429904 1.773346 1.815358 2.179397 1.449419 1.853673 2.278738
[5,] 2.832716 2.322432 2.390877 2.908637 2.887757 2.354390 2.964226 3.008489
[,65] [,66] [,67] [,68] [,69]
[1,] 1.310924 1.665428 1.858824 1.899941 1.643896
[2,] 5.494107 5.653325 5.650220 5.631861 5.651870
[3,] 5.542387 5.656895 5.638408 5.613172 5.656943
[4,] 1.256673 1.592842 1.776233 2.406406 1.572429
[5,] 2.026921 2.578892 2.852119 3.164294 2.547632
17512 more rows ...
$genes
Symbol Chr
ENSG00000127720 C12orf26 12
ENSG00000051596 THOC3 5
ENSG00000236211 AC068137.5 2
ENSG00000213697 RP11-513I7.2 11
ENSG00000135541 AHI1 6
17512 more rows ...
>
>
> packageVersion("edgeR")
[1] '4.2.1'
>
Thanks to the both of you for your clarifications and suggestions!