Collapse technical replicates
collapseReplicates.Rd
Collapse technical replicates in a DGEList object by mean or sum. Modified from collapseReplicates function from DESeq2 package to accept DGEList objects and to allow collapsing replicated by mean or sum.
Usage
collapseReplicates(
dgeObject,
group,
sampleNames = NULL,
renameCols = TRUE,
showReps = FALSE,
method = "mean"
)
Arguments
- dgeObject
DGEList object with barcode counts.
- group
Column name in sample metadata to group samples by (string).
- sampleNames
Optional, column name in sample metadata that contains unique sample names (string). If provided, a new column collapsed_samples will be added to the sample metadata with the collapsed samples
- renameCols
Whether to rename the columns of the returned object using the levels of the grouping factor (boolean). Default = `TRUE`.
- showReps
Whether to print replicate column names to console (boolean). Default = `FALSE`.
- method
Method to collapse replicates by, one of `mean` or `sum` (string). Default = `mean`.
Examples
data(test.dge)
collapseReplicates(test.dge, group = "group", method = "mean")
#> An object of class "DGEList"
#> $samples
#> Sample Experiment Group PCR_Replicate Treatment
#> 10_High_dose S10-1 test_01 10_High_dose 1 High_dose
#> 11_Vehicle S11-1 test_01 11_Vehicle 1 Vehicle
#> 12_Vehicle S12-1 test_01 12_Vehicle 1 Vehicle
#> 13_Low_dose S13-1 test_01 13_Low_dose 1 Low_dose
#> 14_Low_dose S14-1 test_01 14_Low_dose 1 Low_dose
#> group lib.size norm.factors
#> 10_High_dose 10_High_dose 4114186 1
#> 11_Vehicle 11_Vehicle 2907500 1
#> 12_Vehicle 12_Vehicle 4202337 1
#> 13_Low_dose 13_Low_dose 4513559 1
#> 14_Low_dose 14_Low_dose 4503490 1
#> 14 more rows ...
#>
#> $counts
#> Samples
#> Tags 10_High_dose 11_Vehicle 12_Vehicle 13_Low_dose 14_Low_dose 15_Low_dose
#> BC_1 0 0 0 0 0 0
#> BC_13 0 0 0 0 0 0
#> BC_99 0 0 0 0 0 0
#> BC_120 0 0 0 0 0 0
#> BC_351 0 0 0 0 0 0
#> Samples
#> Tags 16_Low_dose 17_High_dose 18_Vehicle 1_High_dose 2_High_dose
#> BC_1 0 0 0 0 0
#> BC_13 0 0 0 0 0
#> BC_99 0 0 0 155 0
#> BC_120 0 0 0 0 0
#> BC_351 0 0 0 0 0
#> Samples
#> Tags 3_High_dose 4_Vehicle 5_Low_dose 6_High_dose 7_Vehicle 8_Vehicle
#> BC_1 0 0 0 0 0 0
#> BC_13 0 0 0 0 0 0
#> BC_99 0 0 0 0 0 0
#> BC_120 0 0 0 0 0 0
#> BC_351 0 0 0 0 0 0
#> Samples
#> Tags 9_Low_dose T0
#> BC_1 0 127.0
#> BC_13 0 1146.0
#> BC_99 0 1354.5
#> BC_120 0 234.5
#> BC_351 0 0.0
#> 1634 more rows ...
#>