Skip to contents

This function takes an ExpressionSet object storing either a constant or variable number of biological or technical replicates per stage and collapses replicate expression levels using a defined FUN (window function).

Usage

CollapseReplicates(ExpressionSet, nrep, FUN, stage.names = NULL)

Arguments

ExpressionSet

a standard PhyloExpressionSet or DivergenceExpressionSet object.

nrep

either a numeric value specifying the constant number of replicates per stage or a numeric vector specifying the variable number of replicates for each stage position.

FUN

a window function (e.g., mean, median, max, min, etc.) specifying how replicate expression levels should be collapsed.

stage.names

a character vector specifying the new names of collapsed stages.

Author

Hajk-Georg Drost

Examples

data(PhyloExpressionSetExample)

# combine the expression levels of the 2 replicates (const) per stage
# using mean as window function and rename new stages: "S1","S2","S3"
CollapseReplicates(ExpressionSet = PhyloExpressionSetExample[1:5,1:8], 
                   nrep          = 2, 
                   FUN           = mean, 
                   stage.names   = c("S1","S2","S3"))
#> # A tibble: 5 × 5
#>   Phylostratum GeneID          S1     S2     S3
#>          <int> <fct>        <dbl>  <dbl>  <dbl>
#> 1            1 at1g01040.2  2042.  1222.   982.
#> 2            1 at1g01050.1  1659.  1615.  1305.
#> 3            1 at1g01070.1  1223.   934.   871.
#> 4            1 at1g01080.2   977.  1255.  1340.
#> 5            1 at1g01090.1 14101. 37071. 61606.

# combine the expression levels of the 2 replicates (stage one), 2 replicates (stage two),
# and 3 replicates (stage three) using mean as window function 
# and rename new stages: "S1","S2","S3"
CollapseReplicates(ExpressionSet = PhyloExpressionSetExample[1:5,1:9], 
                   nrep          = c(2,2,3), 
                   FUN           = mean, 
                   stage.names   = c("S1","S2","S3"))
#> # A tibble: 5 × 5
#>   Phylostratum GeneID          S1     S2     S3
#>          <int> <fct>        <dbl>  <dbl>  <dbl>
#> 1            1 at1g01040.2  2042.  1222.  1220.
#> 2            1 at1g01050.1  1659.  1615.  1228.
#> 3            1 at1g01070.1  1223.   934.   879.
#> 4            1 at1g01080.2   977.  1255.  1181.
#> 5            1 at1g01090.1 14101. 37071. 43661.