0.1 SummarizedExperiment object

Researchers who prefer using the SummarizedExperiment class can feed their data and associated metrics into the bigPint methods using one SummarizedExperiment object (instead of both a data and dataMetrics object). We demonstrate here how to create a SummarizedExperiment object. In the remaining articles of the vignette, the example code uses the data and dataMetrics objects as example input. However, at the bottom of each vignette, we also include the corresponding example code that uses instead the SummarizedExperiment object to create the exact same plots.


0.2 Example: two groups

As was shown in the article Data object, the data object called soybean_ir_sub contained 5,604 genes and two treatment groups, N and P (Lauter and Graham 2016). We can create a SummarizedExperiment object that combines aspects of the data object and dataMetrics object. We start by reading in the data and dataMetrics objects (created from edgeR in the article Data metrics object.

library(bigPint)
library(DelayedArray)
library(SummarizedExperiment)

data(soybean_ir_sub)
data = soybean_ir_sub
data(soybean_ir_sub_metrics)
dataMetrics = soybean_ir_sub_metrics

We then convert the dataMetrics object from a list of dataframes into one dataframe.

dMUnlist <- dataMetrics
dMUnlist[-1] <- lapply(dMUnlist[-1], transform, ID = NULL)
dMUnlist <- do.call(cbind, dMUnlist)
names(dMUnlist)[1] <- "ID"

Now, we can tranform our data object into a DelayedMatrix class object and then input both our data and dataMetrics objects combined into a SummarizedExperiment class object. We can verify that the assay() and rowData() methods work for accessing our SummarizedExperiment object.

rownames(data) = data[,1]
data = data[,-1]
data <- DelayedArray(data)
se_soybean_ir_sub <- SummarizedExperiment(assays = data, rowData = dMUnlist)
assay(se_soybean_ir_sub)
## <5604 x 6> matrix of class DelayedMatrix and type "integer":
##                             N.1  N.2  N.3  P.1  P.2  P.3
## Glyma.06G158700.Wm82.a2.v1   48   28   15   29   16    8
## Glyma.08G156000.Wm82.a2.v1    0    0    0    0    0    0
## Glyma.12G070600.Wm82.a2.v1    8   11   11    5    8    7
## Glyma.19G045200.Wm82.a2.v1  200  192  187  186  193  183
## Glyma.05G050000.Wm82.a2.v1    0    0    0    0    0    0
##                        ...    .    .    .    .    .    .
## Glyma.08G043300.Wm82.a2.v1   31   32   17   23   24   23
## Glyma.01G089300.Wm82.a2.v1 1859 1904 1607 1869 1735 1479
## Glyma.04G168000.Wm82.a2.v1    1    2    0    1    1    6
##   Glyma.U001000.Wm82.a2.v1    0    0    0    0    0    0
## Glyma.17G217700.Wm82.a2.v1    0    0    0    0    0    0
rowData(se_soybean_ir_sub)
## DataFrame with 5604 rows and 6 columns
##                                                ID N_P.logFC N_P.logCPM
##                                       <character> <numeric>  <numeric>
## Glyma.06G158700.Wm82.a2.v1 Glyma.19G168700.Wm82..  -5.92478    7.51940
## Glyma.08G156000.Wm82.a2.v1 Glyma.13G293500.Wm82..   2.99174    8.07647
## Glyma.12G070600.Wm82.a2.v1 Glyma.05G188700.Wm82..  -3.50791    8.83079
## Glyma.19G045200.Wm82.a2.v1 Glyma.13G173100.Wm82..  -3.90775    8.26716
## Glyma.05G050000.Wm82.a2.v1 Glyma.11G141800.Wm82..  -3.50814   10.19121
## ...                                           ...       ...        ...
## Glyma.08G043300.Wm82.a2.v1 Glyma.03G066400.Wm82..         0    1.57995
## Glyma.01G089300.Wm82.a2.v1 Glyma.13G267400.Wm82..         0    1.57995
## Glyma.04G168000.Wm82.a2.v1 Glyma.06G233000.Wm82..         0    1.57995
## Glyma.U001000.Wm82.a2.v1   Glyma.U001000.Wm82.a..         0    1.57995
## Glyma.17G217700.Wm82.a2.v1 Glyma.17G217700.Wm82..         0    1.57995
##                               N_P.LR  N_P.PValue     N_P.FDR
##                            <numeric>   <numeric>   <numeric>
## Glyma.06G158700.Wm82.a2.v1   265.835 9.17713e-60 5.14287e-56
## Glyma.08G156000.Wm82.a2.v1   171.406 3.64738e-39 1.02200e-35
## Glyma.12G070600.Wm82.a2.v1   167.408 2.72509e-38 5.09046e-35
## Glyma.19G045200.Wm82.a2.v1   156.672 6.03836e-36 8.45974e-33
## Glyma.05G050000.Wm82.a2.v1   153.788 2.57718e-35 2.88851e-32
## ...                              ...         ...         ...
## Glyma.08G043300.Wm82.a2.v1         0           1           1
## Glyma.01G089300.Wm82.a2.v1         0           1           1
## Glyma.04G168000.Wm82.a2.v1         0           1           1
## Glyma.U001000.Wm82.a2.v1           0           1           1
## Glyma.17G217700.Wm82.a2.v1         0           1           1

0.3 Example: three groups

Similarly, as was shown in the data page, the data object called soybean_cn_sub contained 7,332 genes and three treatment groups, S1, S2, and S3 (Brown and Hudson 2015). We can create a SummarizedExperiment object that combines aspects of the data object and dataMetrics object. We start by reading in the data and dataMetrics objects (created from edgeR in the article Data metrics object.

data(soybean_cn_sub)
data = soybean_cn_sub
data(soybean_cn_sub_metrics)
dataMetrics = soybean_cn_sub_metrics

We then convert the dataMetrics object from a list of dataframes into one dataframe.

dMUnlist <- dataMetrics
dMUnlist[-1] <- lapply(dMUnlist[-1], transform, ID = NULL)
dMUnlist <- do.call(cbind, dMUnlist)
names(dMUnlist)[1] <- "ID"

Now, we can tranform our data object into a DelayedMatrix class object and then input both our data and dataMetrics objects combined into a SummarizedExperiment class object. We can verify that the assay() and rowData() methods work for accessing our SummarizedExperiment object.

rownames(data) = data[,1]
data = data[,-1]
data <- DelayedArray(data)
se_soybean_cn_sub <- SummarizedExperiment(assays = data, rowData = dMUnlist)
assay(se_soybean_cn_sub)
## <7332 x 9> matrix of class DelayedMatrix and type "double":
##                       S1.1      S1.2      S1.3 ...      S3.2      S3.3
##  Glyma06g12670.1 0.8024444 2.7088837 1.7634068   . 8.3675932 8.3893470
##  Glyma08g12390.2 4.7687202 5.2357774 5.1666308   . 4.0314271 4.2693124
## Glyma12g02076.11 3.1899340 2.9021310 2.9065021   . 2.7311049 3.2556486
##  Glyma18g53450.1 0.8024444 0.8024444 0.8024444   . 0.8024444 0.8024444
##  Glyma05g03470.4 3.1899340 2.4801080 3.2620818   . 3.4196490 4.1435591
##              ...         .         .         .   .         .         .
##  Glyma02g14300.1 4.6005599 4.9369766 3.8996875   . 5.7465508 5.8893165
##  Glyma06g17451.4 0.8024444 3.0701936 2.2841221   . 2.4400407 0.8024444
##  Glyma06g01600.2 2.5761594 4.0431593 4.6920688   . 3.8463167 3.2556486
##  Glyma15g08800.1 0.8024444 2.7088837 2.2841221   . 4.1727846 3.4845295
##  Glyma02g34995.1 0.8024444 0.8024444 0.8024444   . 0.8024444 0.8024444
rowData(se_soybean_cn_sub)
## DataFrame with 7332 rows and 16 columns
##                               ID  S1_S2.logFC S1_S2.logCPM    S1_S2.LR
##                      <character>    <numeric>    <numeric>   <numeric>
## Glyma06g12670.1  Glyma18g00690.1      3.14062      8.04141     29.3378
## Glyma08g12390.2  Glyma08g22380.1      2.62010      8.04877     24.7573
## Glyma12g02076.11 Glyma20g30460.1      2.50410      8.13953     23.9634
## Glyma18g53450.1  Glyma07g09700.1      2.37046      8.19272     22.6529
## Glyma05g03470.4  Glyma10g31780.1      2.74334      7.93199     21.0107
## ...                          ...          ...          ...         ...
## Glyma02g14300.1  Glyma10g10560.4 -0.000413428      7.86347 5.75159e-07
## Glyma06g17451.4  Glyma17g26590.1  0.000192534      8.97422 2.99561e-07
## Glyma06g01600.2  Glyma17g01820.2  0.000285254      7.82862 2.52770e-07
## Glyma15g08800.1  Glyma01g44330.1  0.000199404      8.36789 2.05641e-07
## Glyma02g34995.1  Glyma10g42001.6 -0.000277880      7.38340 1.66064e-07
##                  S1_S2.PValue   S1_S2.FDR  S1_S3.logFC S1_S3.logCPM    S1_S3.LR
##                     <numeric>   <numeric>    <numeric>    <numeric>   <numeric>
## Glyma06g12670.1   6.07991e-08 0.000445779      3.18022      8.04877     30.3535
## Glyma08g12390.2   6.50226e-07 0.002383728      3.31783      8.13526     24.7499
## Glyma12g02076.11  9.81862e-07 0.002399671      2.44357      8.13953     23.2588
## Glyma18g53450.1   1.94068e-06 0.003557261      2.46355      8.04141     22.5072
## Glyma05g03470.4   4.56725e-06 0.006697417      3.02815      7.85103     22.3237
## ...                       ...         ...          ...          ...         ...
## Glyma02g14300.1      0.999395    0.999675  1.81323e-04      8.10963 1.36861e-07
## Glyma06g17451.4      0.999563    0.999675 -1.98697e-04      7.64696 1.02335e-07
## Glyma06g01600.2      0.999599    0.999675 -1.00972e-04      8.60600 6.35068e-08
## Glyma15g08800.1      0.999638    0.999675  6.68582e-05      8.63256 2.72930e-08
## Glyma02g34995.1      0.999675    0.999675  1.47433e-05      7.70704 6.03470e-10
##                  S1_S3.PValue   S1_S3.FDR  S2_S3.logFC S2_S3.logCPM    S2_S3.LR
##                     <numeric>   <numeric>    <numeric>    <numeric>   <numeric>
## Glyma06g12670.1   3.60054e-08 0.000263991      2.66436      7.85943     16.1010
## Glyma08g12390.2   6.52717e-07 0.002392862      2.71840      7.82372     16.0104
## Glyma12g02076.11  1.41600e-06 0.003377724      2.77896      8.13526     14.2810
## Glyma18g53450.1   2.09356e-06 0.003377724      2.19312      7.63085     11.8374
## Glyma05g03470.4   2.30341e-06 0.003377724      2.28950      7.84031     10.4718
## ...                       ...         ...          ...          ...         ...
## Glyma02g14300.1      0.999705     0.99998 -0.000587797      7.10963 5.02569e-07
## Glyma06g17451.4      0.999745     0.99998 -0.000173649      8.56697 1.76322e-07
## Glyma06g01600.2      0.999799     0.99998  0.000118818      8.54350 8.37196e-08
## Glyma15g08800.1      0.999868     0.99998 -0.000129616      8.16544 7.10091e-08
## Glyma02g34995.1      0.999980     0.99998 -0.000100783      8.32825 4.83293e-08
##                  S2_S3.PValue S2_S3.FDR
##                     <numeric> <numeric>
## Glyma06g12670.1   6.00514e-05  0.230938
## Glyma08g12390.2   6.29947e-05  0.230938
## Glyma12g02076.11  1.57446e-04  0.384798
## Glyma18g53450.1   5.80513e-04  0.999825
## Glyma05g03470.4   1.21213e-03  0.999825
## ...                       ...       ...
## Glyma02g14300.1      0.999434  0.999825
## Glyma06g17451.4      0.999665  0.999825
## Glyma06g01600.2      0.999769  0.999825
## Glyma15g08800.1      0.999787  0.999825
## Glyma02g34995.1      0.999825  0.999825

References

Brown, Anne V., and Karen A. Hudson. 2015. “Developmental Profiling of Gene Expression in Soybean Trifoliate Leaves and Cotyledons.” BMC Plant Biology 15 (1): 169.

Lauter, AN Moran, and MA Graham. 2016. “NCBI Sra Bioproject Accession: PRJNA318409.”