This function takes a signature collection and a model as input and adds selected signatures to a combined signature model. The default output is a data.frame in the 'combined_signature_model' style data.frame format from the Sigverse package.
Usage
sig_combine(
signatures,
model,
format = c("signature", "combined"),
verbose = FALSE
)
Arguments
- signatures
A sigverse signature collection. See (
sigshared::example_signature_collection()
) for details.- model
A named numeric vector representing the contribution of each signature to the combined model. The names correspond to the signatures, and the values represent their contributions. The sum of the values in this vector should be less than or equal to 1.
- format
A character string indicating the output format. If "combined", the function returns a 'combined_signature_model' data.frame where each row represents a contribution for a particular channel from a single signature (duplicate channels are not collapsed). If "signature", the function returns the data in the sigverse signature format, representing a novel signature created by combining the signatures in the collection according to the ratios described by the model.
- verbose
enables detailed output messages (flag).
Value
A data.frame in the 'combined_signature_model' style containing the selected signatures and their modified fractions based on the model.
Examples
library(sigstash)
# Load a signature collection
signatures <- sig_load("COSMIC_v3.3.1_SBS_GRCh38")
# Create a model that represents a mix of SBS1 (40%) and SBS2 (60%)
model <- c(SBS1 = 0.4, SBS2 = 0.6)
# Add selected signatures to the combined model
combined_signatures <- sig_combine(signatures, model)
print(combined_signatures)
#> type channel fraction
#> 1 C>A A[C>A]A 3.507565e-04
#> 2 C>A A[C>A]C 9.753506e-04
#> 3 C>A A[C>A]G 1.040620e-04
#> 4 C>A A[C>A]T 5.645758e-04
#> 5 C>G A[C>G]A 7.356219e-04
#> 6 C>G A[C>G]C 5.536380e-04
#> 7 C>G A[C>G]G 5.605870e-05
#> 8 C>G A[C>G]T 5.052782e-04
#> 9 C>T A[C>T]A 9.923988e-03
#> 10 C>T A[C>T]C 3.275645e-03
#> 11 C>T A[C>T]G 1.482697e-01
#> 12 C>T A[C>T]T 4.900869e-03
#> 13 T>A A[T>A]A 3.704447e-04
#> 14 T>A A[T>A]C 1.405570e-03
#> 15 T>A A[T>A]G 4.620521e-04
#> 16 T>A A[T>A]T 7.178224e-05
#> 17 T>C A[T>C]A 4.637984e-04
#> 18 T>C A[T>C]C 1.213215e-03
#> 19 T>C A[T>C]G 4.939210e-05
#> 20 T>C A[T>C]T 2.343610e-03
#> 21 T>G A[T>G]A 2.086691e-04
#> 22 T>G A[T>G]C 1.263457e-04
#> 23 T>G A[T>G]G 1.062807e-04
#> 24 T>G A[T>G]T 4.616597e-05
#> 25 C>A C[C>A]A 2.451991e-04
#> 26 C>A C[C>A]C 7.513668e-04
#> 27 C>A C[C>A]G 3.678179e-05
#> 28 C>A C[C>A]T 2.493459e-04
#> 29 C>G C[C>G]A 9.424529e-06
#> 30 C>G C[C>G]C 2.363192e-04
#> 31 C>G C[C>G]G 1.680262e-04
#> 32 C>G C[C>G]T 3.766841e-05
#> 33 C>T C[C>T]A 3.340651e-03
#> 34 C>T C[C>T]C 2.048862e-04
#> 35 C>T C[C>T]G 7.900789e-02
#> 36 C>T C[C>T]T 9.354423e-04
#> 37 T>A C[T>A]A 1.615965e-04
#> 38 T>A C[T>A]C 3.007052e-04
#> 39 T>A C[T>A]G 2.161075e-04
#> 40 T>A C[T>A]T 1.028904e-04
#> 41 T>C C[T>C]A 1.798213e-04
#> 42 T>C C[T>C]C 1.002896e-03
#> 43 T>C C[T>C]G 1.415402e-04
#> 44 T>C C[T>C]T 1.283336e-04
#> 45 T>G C[T>G]A 1.050587e-04
#> 46 T>G C[T>G]C 1.761738e-04
#> 47 T>G C[T>G]G 1.223743e-04
#> 48 T>G C[T>G]T 1.893343e-04
#> 49 C>A G[C>A]A 6.739429e-04
#> 50 C>A G[C>A]C 1.317277e-04
#> 51 C>A G[C>A]G 2.414671e-04
#> 52 C>A G[C>A]T 3.039667e-05
#> 53 C>G G[C>G]A 4.280223e-05
#> 54 C>G G[C>G]C 2.173235e-04
#> 55 C>G G[C>G]G 6.592130e-05
#> 56 C>G G[C>G]T 7.955379e-05
#> 57 C>T G[C>T]A 1.749326e-03
#> 58 C>T G[C>T]C 3.613588e-05
#> 59 C>T G[C>T]G 8.657135e-02
#> 60 C>T G[C>T]T 4.497471e-05
#> 61 T>A G[T>A]A 3.173979e-05
#> 62 T>A G[T>A]C 1.282647e-04
#> 63 T>A G[T>A]G 1.353408e-04
#> 64 T>A G[T>A]T 1.408428e-04
#> 65 T>C G[T>C]A 4.104283e-04
#> 66 T>C G[T>C]C 7.606214e-04
#> 67 T>C G[T>C]G 5.261763e-04
#> 68 T>C G[T>C]T 3.598995e-05
#> 69 T>G G[T>G]A 1.237254e-04
#> 70 T>G G[T>G]C 7.891291e-05
#> 71 T>G G[T>G]G 1.596591e-04
#> 72 T>G G[T>G]T 5.823419e-06
#> 73 C>A T[C>A]A 4.088038e-04
#> 74 C>A T[C>A]C 1.100521e-03
#> 75 C>A T[C>A]G 5.188617e-05
#> 76 C>A T[C>A]T 2.670355e-04
#> 77 C>G T[C>G]A 2.217865e-16
#> 78 C>G T[C>G]C 1.391628e-04
#> 79 C>G T[C>G]G 5.293497e-05
#> 80 C>G T[C>G]T 1.329548e-03
#> 81 C>T T[C>T]A 3.215172e-01
#> 82 C>T T[C>T]C 5.819379e-02
#> 83 C>T T[C>T]G 7.106643e-02
#> 84 C>T T[C>T]T 1.804772e-01
#> 85 T>A T[T>A]A 2.858385e-03
#> 86 T>A T[T>A]C 1.165516e-04
#> 87 T>A T[T>A]G 4.116638e-05
#> 88 T>A T[T>A]T 1.010989e-03
#> 89 T>C T[T>C]A 9.904566e-05
#> 90 T>C T[T>C]C 1.385195e-03
#> 91 T>C T[T>C]G 2.350857e-04
#> 92 T>C T[T>C]T 1.731088e-03
#> 93 T>G T[T>G]A 9.823727e-06
#> 94 T>G T[T>G]C 6.482091e-05
#> 95 T>G T[T>G]G 2.883043e-04
#> 96 T>G T[T>G]T 2.214016e-16
# Visualise using sigvis