Convert contrast names to sedesign object
Source:R/jam_contrastnames2design.R
contrast_names_to_sedesign.RdConvert contrast names to sedesign object
Value
sedesign object, or if the input contrast_names contain
mixed number of factors per contrast, the output is split into
a list of sedesign objects based upon the number of factors.
Details
This function is a convenience function intended only to convert
a vector of contrast names into sedesign format for use in other
functions. It assumes only one sample replicate per group for this
purpose.
One utility of this function is to convert two-way contrast names into a contrast matrix, to test whether the contrast defined is equivalent for the two names.
See also
Other jam experiment design:
SEDesign(),
[,SEDesign-method,
check_sedesign(),
contrast2comp(),
contrast_colors_by_group(),
contrastnames(),
contrasts(),
contrasts<-(),
contrasts_to_factors(),
contrasts_to_venn_setlists(),
design,SEDesign-method,
draw_oneway_contrast(),
draw_twoway_contrast(),
factors(),
filter_contrast_names(),
groups(),
groups_to_sedesign(),
plot.SEDesign(),
plot_sedesign(),
print,SEDesign-method,
samples(),
sedesign_to_factors(),
sort_contrasts(),
validate_sedesign()
Examples
contrast_names_3fac <- c(
"(CellA_Treated-CellA_Control)-(CellB_Treated-CellB_Control)",
"(CellA_Treated-CellB_Treated)-(CellA_Control-CellB_Control)")
contrast_names_to_sedesign(contrast_names_3fac)
#> <SEDesign> 4 samples, 4 groups, 2 contrasts
#> factors:
#> - factor1: CellA, CellB
#> - factor2: Treated, Control
contrast_names_3way <- c(
paste0("((CellA_Treated_Mut-CellB_Treated_Mut)-",
"(CellA_Control_Mut-CellB_Control_Mut))-",
"((CellA_Treated_WT-CellB_Treated_WT)-",
"(CellA_Control_WT-CellB_Control_WT))"),
paste0("((CellA_Treated_Mut-CellA_Control_Mut)-",
"(CellB_Treated_Mut-CellB_Control_Mut))-",
"((CellA_Treated_WT-CellA_Control_WT)-",
"(CellB_Treated_WT-CellB_Control_WT))"))
contrast_names_to_sedesign(contrast_names_3way)
#> <SEDesign> 8 samples, 8 groups, 2 contrasts
#> factors:
#> - factor1: CellA, CellB
#> - factor2: Treated, Control
#> - factor3: Mut, WT