Combining or merging different Bioconductor data structures

combine(x, y, ...)

# S4 method for SummarizedExperiment,SummarizedExperiment
combine(x, y)

# S4 method for SingleCellExperiment,SingleCellExperiment
combine(x, y)

Arguments

x

Object.

y

Object.

...

Additional arguments.

Value

SummarizedExperiment.

Note

Updated 2019-11-19.

We're attempting to make this as strict as possible, requiring:

  • Rows (genes) across objects must be identical.

  • rowRanges and/or rowData metadata must be identical.

  • colData must contain the same columns.

  • Specific metadata must be identical (see metadata argument).

See also

Examples

data( RangedSummarizedExperiment, SingleCellExperiment, package = "acidtest" ) str_pad <- stringr::str_pad ## SummarizedExperiment ==== x <- RangedSummarizedExperiment colnames(x) <- paste0( "sample", str_pad( string = seq_len(ncol(x)), width = 2L, pad = "0" ) ) y <- x colnames(y) <- paste0( "sample", str_pad( string = seq(from = ncol(y) + 1L, to = ncol(y) * 2L), width = 2L, pad = "0" ) ) ## Combine the two objects. c <- combine(x, y)
#> Combining objects into RangedSummarizedExperiment.
#> Binding columns in assays: counts.
#> Checking row data.
#> Updating column data.
#> Updating metadata.
#> DataFrame with 24 rows and 3 columns #> condition sampleName interestingGroups #> <factor> <factor> <factor> #> sample01 A sample01 A #> sample02 A sample02 A #> sample03 A sample03 A #> sample04 A sample04 A #> sample05 A sample05 A #> ... ... ... ... #> sample20 B sample20 B #> sample21 B sample21 B #> sample22 B sample22 B #> sample23 B sample23 B #> sample24 B sample24 B
#> class: RangedSummarizedExperiment #> dim: 500 24 #> metadata(4): version date interestingGroups combine #> assays(1): counts #> rownames(500): gene001 gene002 ... gene499 gene500 #> rowData names(8): broadClass description ... geneName seqCoordSystem #> colnames(24): sample01 sample02 ... sample23 sample24 #> colData names(1): condition
## SingleCellExperiment ==== x <- SingleCellExperiment colnames(x) <- paste0( "cell", str_pad( string = seq_len(ncol(x)), width = 4L, pad = "0" ) ) y <- x colnames(y) <- paste0( "cell", str_pad( string = seq_len(ncol(y)) + ncol(y), width = 4L, pad = "0" ) ) ## Combine the two objects. c <- combine(x, y)
#> Combining objects into RangedSummarizedExperiment.
#> Binding columns in assays: counts.
#> Checking row data.
#> Updating column data.
#> Updating metadata.
#> DataFrame with 2 rows and 2 columns #> sampleName interestingGroups #> <factor> <factor> #> sample1 sample1 sample1 #> sample2 sample2 sample2
#> class: SingleCellExperiment #> dim: 500 200 #> metadata(2): date combine #> assays(1): counts #> rownames(500): gene001 gene002 ... gene499 gene500 #> rowData names(8): broadClass description ... geneName seqCoordSystem #> colnames(200): cell0001 cell0002 ... cell0199 cell0200 #> colData names(1): sampleID #> reducedDimNames(0): #> spikeNames(0): #> altExpNames(0):