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.

scpAnnotateResults(tableList, annotations, by, by2 = NULL)

Arguments

tableList

A list of tables, typically the output of scpVarianceAnalysis(), scpDifferentialAnalysis(), or the the bySample or byFeature elements returned by scpComponentAnalysis().

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 in tableList to 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 in tableList. If NULL, it will be defined by by.

Author

Christophe Vanderaa, Laurent Gatto

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"