convert_signatures: Convert signatures between models

Description Usage Arguments Value Examples

View source: R/sigfit_utility.R

Description

convert_signatures converts mutational signatures between two representations relative to different sets of mutational opportunities.

Usage

1
2
3
4
5
convert_signatures(
  signatures,
  opportunities_from = NULL,
  opportunities_to = NULL
)

Arguments

signatures

Either a numeric matrix of mutational signatures, with one row per signature and one column per mutation type, or a list of matrices generated via retrieve_pars.

opportunities_from

Mutational opportunities that are currently imposed on the signatures. This can be a numeric vector of mutational opportunities, with one element per mutation type. Character values "human-genome" or "human-exome" are also admitted, in which case the mutational opportunities of the reference human genome/exome will be used. If this argument is provided, the signatures will be normalised (divided) by the opportunities. Otherwise (if opportunities_from = NULL), the signatures will be interpreted as being already normalised (i.e. not relative to any opportunities).

opportunities_to

Mutational opportunities that are to be imposed on the signatures. Admits the same values as opportunities_from. If this argument is provided, the signatures will be multiplied by the opportunities. Otherwise (if opportunities_to = NULL), the signatures will be converted to a normalised representation (i.e. not relative to any opportunities).

Value

A numeric matrix of transformed signatures with the same dimensions as signatures.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Load COSMIC signatures
# (these are relative to the human genome mutational opportunities)
data("cosmic_signatures_v2")

# Plot COSMIC signature 1
barplot(cosmic_signatures_v2[1,])

# Convert signatures from genome-relative to exome-relative representation
exome_sigs <- convert_signatures(cosmic_signatures_v2,
                                 opportunities_from = "human-genome",
                                 opportunities_to = "human-exome")
barplot(exome_sigs[1,])

# Normalise signatures to a sequence-independent representation
normalised_sigs <- convert_signatures(cosmic_signatures_v2,
                                      opportunities_from = "human-genome",
                                      opportunities_to = NULL)
barplot(normalised_sigs[1,])

# Convert back to genome-relative opportunities
genome_sigs <- convert_signatures(normalised_sigs,
                                  opportunities_from = NULL,
                                  opportunities_to = "human-genome")
barplot(genome_sigs[1,])

kgori/sigfit documentation built on Feb. 3, 2022, 12:04 p.m.