combineBlocks {scran} | R Documentation

## Combine blockwise statistics

### Description

Combine DataFrames of statistics computed separately for each block. This usually refers to feature-level statistics and sample-level blocks.

### Usage

    combineBlocks(
      blocks,
      ave.fields,
      pval.field,
      method,
      geometric,
      equiweight,
      weights,
      valid
    )

### Arguments

`blocks` | A list of DataFrames containing blockwise statistics. These should have the same number of rows and the same set of columns.
`ave.fields` | Character vector specifying the columns of `blocks` to be averaged. The value of each column is averaged across blocks, potentially in a weighted manner.
`pval.field` | String specifying the column of `blocks` containing the p-value. This is combined using `combineParallelPValues`.
`method` | String specifying how p-values should be combined, see `?combineParallelPValues`.
`geometric` | Logical scalar indicating whether the geometric mean should be computed when averaging `ave.fields`.
`equiweight` | Logical scalar indicating whether each block should be given equal weight.
`weights` | Numeric vector of length equal to `blocks`, containing the weight for each block. Only used if `equiweight=TRUE`.
`valid` | Logical vector indicating whether each block is valid. Invalid blocks are still stored in the `per.block` output but are not used to compute the combined statistics.

### Value

A DataFrame containing all fields in `ave.fields` and the p-values, where each column is created by combining the corresponding block-specific columns. A `per.block` column is also reported, containing a DataFrame of the DataFrames of blockwise statistics.

### Author(s)

Aaron Lun

### See Also

This function is used in `modelGeneVar` and friends, `combineVar` and `testLinearModel`.

### Examples

    library(scuttle)
    sce <- mockSCE()

    y1 <- sce[,1:100]
    y1 <- logNormCounts(y1) # normalize separately after subsetting.
    results1 <- modelGeneVar(y1)

    y2 <- sce[,1:100 + 100]
    y2 <- logNormCounts(y2) # normalize separately after subsetting.
    results2 <- modelGeneVar(y2)

    # A manual implementation of combineVar:
    combineBlocks(list(results1, results2),
        ave.fields=c("mean", "total", "bio", "tech"),
        pval.field='p.value',
        method='fisher',
        geometric=FALSE,
        equiweight=TRUE,
        weights=NULL,
        valid=c(TRUE, TRUE))

[Package scran version 1.22.1 Index]