The function takes as input a list of DFrame and a table with
additional annotations. The annotation tables is automatically
merged into all tables of the list by matching the specified
columns (given by the arguments by and by2). This function is
useful to add annotation to analysis results generated by
scpVarianceAnalysis(), scpDifferentialAnalysis(), or
scpComponentAnalysis(). The annotation table is typically the
colData or rowData of the object used for modelling. In case
of shared column names between the input tables and the annotation
table, any annotation that is already present in the list of
tables will be overwritten by the new annotations.
Arguments
- tableList
A list of tables, typically the output of
scpVarianceAnalysis(),scpDifferentialAnalysis(), or the thebySampleorbyFeatureelements returned byscpComponentAnalysis().- annotations
A table of class 'data.frame' or 'DFrame' containing the annotations to add. If no further arguments are provided, the table must have row names.
- by
A
character(1)providing the name of the column in the tables intableListto use to match the rows of the annotation table.- by2
A
character(1)providing the name of the column in the annotation table to use to match the rows of the tables intableList. IfNULL, it will be defined byby. The column pointed byby2will be dropped in the output tables.
Examples
data("leduc_minimal")
var <- scpVarianceAnalysis(leduc_minimal)
colnames(var$Residuals)
#> [1] "feature" "SS" "df"
#> [4] "percentExplainedVar"
## Add peptide annotations available from the rowData
var <- scpAnnotateResults(
var, rowData(leduc_minimal), by = "feature", by2 = "Sequence"
)
colnames(var$Residuals)
#> [1] "feature" "SS"
#> [3] "df" "percentExplainedVar"
#> [5] "Reverse" "Potential.contaminant"
#> [7] "Leading.razor.protein.id" "Leading.razor.protein.symbol"
#> [9] "gene"