Attaches (or removes) a protein annotation table to an existing DEprot or DEprot.analyses object. The table is validated and re-ordered to match the proteins of the object, so that the protein.info slot stays row-by-row aligned with the counts tables. The annotation can then be appended to the differential expression results by get.results.

add.protein.info(
  DEprot.object,
  protein.info,
  id.column = NULL,
  overwrite = FALSE
)

Arguments

DEprot.object

An object of class DEprot or DEprot.analyses.

protein.info

A data.frame (or matrix) with one row per protein and any number of annotation columns (e.g., gene symbol, description, peptide counts, etc.). The protein IDs must be provided as row names, in a column called prot.id, or in the column indicated by id.column; they must correspond to the row names of the counts table. Proteins missing from the annotation are filled with NA, while annotations of proteins absent from the object are discarded. Use NULL to remove an annotation already stored in the object.

id.column

String indicating the name of the column of protein.info containing the protein IDs. If NULL (default), the row names are used (or a column called prot.id when the table has no explicit row names).

overwrite

Logical value indicating whether an annotation table already stored in the object should be replaced. Default: FALSE.

Value

An object of the same class as the input (DEprot or DEprot.analyses).

Author

Sebastian Gregoricchio

Examples

dpo <- load.counts2(counts = DEprot::unimputed.counts,
                    metadata = DEprot::sample.config,
                    data.type = "raw",
                    log.base = 2)
#> The counts matrix contained 295 rows with only NA values.
#> The latter have been removed from the matrix.

# A minimal annotation table
info <- data.frame(gene.name = toupper(rownames(DEprot::unimputed.counts)),
                   row.names = rownames(DEprot::unimputed.counts))

dpo <- add.protein.info(DEprot.object = dpo,
                        protein.info = info)
#> [protein.info] 295 annotated protein(s) are not present in the object and have been discarded.