5 Target visualization
5.2 Signature
object
Signature
is a core object in sigminer, it stores signatures and their exposures. Here we show how to plot signature profile and exposure profile. The result plots are basically ggplot based, so they can be further edited by your custom operations with ggplot grammar.
5.2.1 Operate Signature
The result of sig_extract()
or sig_auto_extract()
is a list
with Signature
class. You can use $
or use operation function to obtain the data stored in it.
To get the signature matrix:
# Or mt_sig2$Signature
sig_signature(mt_sig2)[1:5, ]
## Sig1 Sig2 Sig3
## A[T>C]A 0.008632350 0.012998315 0.0027599263
## C[T>C]A 0.005765919 0.007065285 0.0007488439
## G[T>C]A 0.013026940 0.004318256 0.0009744887
## T[T>C]A 0.004725412 0.004544973 0.0012188315
## A[C>T]A 0.004464683 0.017714329 0.0063508777
To get signature exposure matrix:
# Or mt_sig$Exposure
sig_exposure(mt_sig2)[, 1:5]
## TCGA-A1-A0SH-01A-11D-A099-09 TCGA-A2-A04N-01A-11D-A10Y-09
## Sig1 31.66886 16.840245
## Sig2 17.46182 31.616889
## Sig3 86.66939 3.141982
## TCGA-A2-A0CP-01A-11W-A050-09 TCGA-A2-A0EP-01A-52D-A22X-09
## Sig1 23.365351 14.2720018
## Sig2 22.090623 0.7626465
## Sig3 4.622696 6.8293109
## TCGA-A2-A0EV-01A-11W-A050-09
## Sig1 35.06135
## Sig2 25.81997
## Sig3 17.46720
get_sig_exposure()
may be more useful, it can be used to return a data.frame
and set an exposure threshold.
get_sig_exposure(mt_sig2)
## sample Sig1 Sig2 Sig3
## 1: TCGA-A1-A0SH-01A-11D-A099-09 3.166886e+01 1.746182e+01 8.666939e+01
## 2: TCGA-A2-A04N-01A-11D-A10Y-09 1.684024e+01 3.161689e+01 3.141982e+00
## 3: TCGA-A2-A0CP-01A-11W-A050-09 2.336535e+01 2.209062e+01 4.622696e+00
## 4: TCGA-A2-A0EP-01A-52D-A22X-09 1.427200e+01 7.626465e-01 6.829311e+00
## 5: TCGA-A2-A0EV-01A-11W-A050-09 3.506135e+01 2.581997e+01 1.746720e+01
## 6: TCGA-A2-A0SX-01A-12D-A099-09 1.799211e+01 1.298242e+01 9.594181e+00
## 7: TCGA-A2-A0T7-01A-21D-A099-09 5.268863e+00 2.400288e+01 4.272836e-18
## 8: TCGA-A2-A0YF-01A-21D-A10G-09 1.304188e+01 2.883374e+01 3.092878e-219
## 9: TCGA-A2-A25F-01A-11D-A167-09 8.954687e+00 2.124482e-322 0.000000e+00
## 10: TCGA-A2-A3XW-01A-11D-A23C-09 9.992137e+00 8.307369e+00 5.585825e-01
## 11: TCGA-A2-A4S1-01A-21D-A25Q-09 6.855788e+01 2.385549e+01 4.218989e+00
## 12: TCGA-A7-A0D9-01A-31W-A071-09 2.789866e+01 1.612393e+01 1.610362e+01
## 13: TCGA-A7-A13F-01A-11D-A12Q-09 2.218617e-143 7.233318e+01 1.015108e+01
## 14: TCGA-A7-A5ZV-01A-11D-A28B-09 1.707878e+02 4.282286e+01 3.607406e+01
## 15: TCGA-A8-A06P-01A-11W-A019-09 2.143307e+01 1.954021e+01 3.290205e+00
## 16: TCGA-A8-A076-01A-21W-A019-09 3.186376e+01 4.840680e+01 1.219314e+01
## 17: TCGA-A8-A07W-01A-11W-A019-09 9.941026e+01 4.891769e+01 2.093785e+01
## 18: TCGA-A8-A084-01A-21W-A019-09 1.860221e+01 3.549728e+01 2.878729e+01
## 19: TCGA-A8-A08S-01A-11W-A050-09 1.705885e+01 4.703995e+01 2.595490e-14
## 20: TCGA-A8-A09G-01A-21W-A019-09 3.971052e-87 1.640886e+01 3.009882e+02
## 21: TCGA-A8-A0A4-01A-11W-A019-09 1.266228e+01 2.461204e+01 8.855363e-01
## 22: TCGA-A8-A0AB-01A-11W-A050-09 2.161191e+01 1.136710e+01 4.588114e+00
## 23: TCGA-AC-A2B8-01A-11D-A17D-09 2.033307e-122 2.098482e+01 1.038001e+02
## 24: TCGA-AC-A2FO-01A-11D-A17W-09 8.304307e+00 5.968893e+00 1.455197e+01
## 25: TCGA-AC-A3YI-01A-21D-A23C-09 1.166597e+01 8.174477e+00 3.737224e-304
## 26: TCGA-AC-A8OS-01A-12D-A41F-09 3.226793e+01 2.847194e+01 1.852043e+01
## 27: TCGA-AN-A0FK-01A-11W-A050-09 4.675220e-136 5.434698e+01 3.013800e-322
## 28: TCGA-AN-A0FT-01A-11W-A050-09 2.329794e+01 6.405417e+01 3.668331e+01
## 29: TCGA-AN-A0XO-01A-11D-A10G-09 1.810539e+01 1.288004e+01 1.156616e+01
## 30: TCGA-AO-A1KS-01A-11D-A13L-09 1.471045e-15 3.636395e+01 1.884661e+01
## 31: TCGA-AQ-A54O-01A-11D-A25Q-09 1.998371e-110 2.479216e+01 4.475523e-01
## 32: TCGA-AQ-A7U7-01A-22D-A351-09 1.357465e+01 1.450933e+01 7.322714e+01
## 33: TCGA-AR-A0TP-01A-11D-A099-09 5.700843e+01 7.538727e+00 5.532723e+00
## 34: TCGA-AR-A0U3-01A-11D-A10G-09 1.566172e+01 2.445972e+01 0.000000e+00
## 35: TCGA-AR-A1AH-01A-11D-A12B-09 9.313898e+01 1.664222e+01 7.946685e+00
## 36: TCGA-AR-A1AJ-01A-21D-A12Q-09 7.732463e+00 2.359439e+01 2.272694e+01
## 37: TCGA-AR-A1AN-01A-11D-A12Q-09 1.050960e-43 2.694093e+01 6.145010e+00
## 38: TCGA-AR-A24N-01A-11D-A167-09 1.894249e+01 2.390942e+01 4.230534e+00
## 39: TCGA-AR-A252-01A-11D-A167-09 6.071164e+00 1.270826e+01 3.013800e-322
## 40: TCGA-AR-A2LL-01A-11D-A17W-09 1.466495e+01 2.258277e+01 3.013800e-322
## 41: TCGA-AR-A2LO-01A-31D-A18P-09 1.403040e+01 2.614092e+00 3.231288e+00
## 42: TCGA-B6-A0IE-01A-11W-A050-09 2.010311e+01 1.958096e+01 2.610397e+00
## 43: TCGA-B6-A0IM-01A-11W-A050-09 2.075968e+01 1.952527e+01 3.513353e-125
## 44: TCGA-B6-A0IP-01A-11D-A045-09 1.416886e+01 3.635690e+01 7.257260e-01
## 45: TCGA-B6-A0RV-01A-11D-A099-09 2.766768e-322 1.812611e+01 4.845000e+01
## 46: TCGA-B6-A0WZ-01A-11D-A10G-09 7.381598e+00 6.159155e+00 8.056780e+01
## 47: TCGA-B6-A0X1-01A-11D-A10G-09 4.774611e+01 2.081434e+01 2.141664e+01
## 48: TCGA-B6-A1KC-01B-11D-A159-09 1.224477e+01 2.235468e+01 6.975468e-01
## 49: TCGA-B6-A401-01A-11D-A23C-09 1.104261e+01 1.933849e+01 8.745074e-02
## 50: TCGA-B6-A40C-01A-11D-A23C-09 1.734504e+01 3.269065e+01 2.469909e+00
## 51: TCGA-BH-A0AV-01A-31D-A10Y-09 6.543456e+01 3.624715e+00 1.540206e+01
## 52: TCGA-BH-A0BT-01A-11D-A12Q-09 6.306036e+00 3.814813e+01 2.720250e+00
## 53: TCGA-BH-A0DL-01A-11D-A10Y-09 2.894770e+01 6.846251e+01 2.895576e+01
## 54: TCGA-BH-A0DO-01B-11D-A12B-09 9.969784e+00 1.446941e+01 5.233825e+00
## 55: TCGA-BH-A0DT-01A-21D-A12B-09 2.462409e+00 1.154792e+01 1.819875e+00
## 56: TCGA-BH-A0GY-01A-11W-A071-09 1.621720e+01 2.581025e+01 4.526295e-276
## 57: TCGA-BH-A0H6-01A-21W-A071-09 1.082937e+01 1.579577e+01 4.340126e-293
## 58: TCGA-BH-A18K-01A-11D-A12B-09 2.097981e+01 1.462527e+01 3.631013e+01
## 59: TCGA-BH-A1FU-01A-11D-A14G-09 6.277453e+01 2.878294e+01 2.394254e+01
## 60: TCGA-BH-A202-01A-11D-A14K-09 6.871836e+00 2.020375e+01 3.928063e-01
## 61: TCGA-BH-A5IZ-01A-11D-A27P-09 1.246154e+02 2.209061e+01 3.537264e+01
## 62: TCGA-BH-A6R8-01A-21D-A33E-09 1.164019e+01 2.430453e+01 5.236235e+00
## 63: TCGA-BH-A8G0-01A-11D-A351-09 2.597199e-102 2.048118e+01 0.000000e+00
## 64: TCGA-C8-A131-01A-11D-A10Y-09 2.590583e+01 4.370584e+01 3.640790e+00
## 65: TCGA-D8-A147-01A-11D-A10Y-09 1.161776e+02 5.212590e+00 7.266037e+01
## 66: TCGA-D8-A1JG-01B-11D-A13L-09 8.471905e+01 6.345205e+01 2.060929e+01
## 67: TCGA-D8-A1JH-01A-11D-A188-09 9.663174e+00 1.327837e+01 7.873566e-01
## 68: TCGA-D8-A1JJ-01A-31D-A14K-09 1.133959e+01 3.674766e+01 5.104066e+01
## 69: TCGA-D8-A1JT-01A-31D-A13L-09 2.090274e+01 2.128976e+01 0.000000e+00
## 70: TCGA-D8-A1JU-01A-11D-A13L-09 9.091898e+00 1.071928e+01 2.713162e-39
## 71: TCGA-D8-A1X7-01A-11D-A14K-09 1.294633e+01 1.525286e+01 3.413301e+00
## 72: TCGA-D8-A1X8-01A-11D-A14K-09 1.448665e+01 1.581697e+01 2.266142e+00
## 73: TCGA-D8-A1XL-01A-11D-A14K-09 7.589129e+01 2.279192e+01 7.395903e+00
## 74: TCGA-D8-A27V-01A-12D-A17D-09 3.423782e-80 3.137792e+01 1.880720e+02
## 75: TCGA-E2-A108-01A-13D-A10M-09 3.632974e+01 1.314449e+01 1.338054e+02
## 76: TCGA-E2-A10F-01A-11D-A10M-09 2.766768e-322 2.414387e+01 5.123782e+00
## 77: TCGA-E2-A14T-01A-11D-A10Y-09 1.661234e+01 1.927166e+01 7.476472e+00
## 78: TCGA-E2-A152-01A-11D-A12B-09 1.171920e-21 1.987249e+01 1.445783e+02
## 79: TCGA-E2-A15D-01A-11D-A10Y-09 1.162797e+01 2.447046e+01 8.456098e-02
## 80: TCGA-E2-A15L-01A-11D-A12B-09 6.564409e-266 3.705154e+01 7.227903e+00
## 81: TCGA-E2-A1BD-01A-11D-A12Q-09 1.347320e+01 2.835382e+01 7.608654e-02
## 82: TCGA-E2-A1IH-01A-11D-A188-09 1.607014e+01 2.769621e+01 4.043042e+01
## 83: TCGA-E2-A1II-01A-11D-A142-09 3.287852e+01 1.507799e+00 3.013800e-322
## 84: TCGA-E2-A1IJ-01A-11D-A142-09 6.353640e+00 1.340142e+01 1.066686e-292
## 85: TCGA-E2-A1L6-01A-11D-A13L-09 2.115141e-46 2.802838e+01 7.333578e-63
## 86: TCGA-E2-A9RU-01A-11D-A41F-09 2.027101e+01 6.333655e+01 2.100747e+01
## 87: TCGA-E9-A1NE-01A-21D-A14K-09 4.944191e+01 5.057375e+00 6.071713e+00
## 88: TCGA-E9-A22A-01A-11D-A159-09 1.889911e+01 7.690585e+00 1.009118e+01
## 89: TCGA-E9-A22E-01A-11D-A159-09 9.223014e+01 1.041757e+01 4.455073e+01
## 90: TCGA-E9-A3QA-01A-61D-A228-09 3.257514e+01 4.527811e+00 2.793381e+01
## 91: TCGA-E9-A5FL-01A-11D-A27P-09 9.051438e+01 1.322275e+01 2.905100e+01
## 92: TCGA-EW-A1PA-01A-11D-A142-09 1.887140e+01 1.923060e+01 4.231605e+00
## 93: TCGA-EW-A1PH-01A-11D-A14K-09 2.347811e+01 3.271478e+01 8.143171e+00
## 94: TCGA-GM-A2DB-01A-31D-A19Y-09 8.399491e+01 3.122550e+01 1.350770e+01
## 95: TCGA-LD-A9QF-01A-32D-A41F-09 1.456385e+01 2.328753e+01 1.357230e+00
## 96: TCGA-LL-A5YP-01A-21D-A28B-09 7.878814e+01 6.897847e+00 2.056396e+01
## 97: TCGA-LL-A73Z-01A-11D-A32I-09 2.436630e+01 2.686392e+01 2.538904e+00
## 98: TCGA-OL-A5RY-01A-21D-A28B-09 7.360216e+00 7.184128e+00 1.360407e+00
## 99: TCGA-PE-A5DD-01A-12D-A27P-09 3.562644e+00 3.773066e+01 4.313237e+01
## 100: TCGA-S3-AA17-01A-11D-A41F-09 9.349168e+01 2.892403e+01 2.042929e+01
## sample Sig1 Sig2 Sig3
5.2.2 Signature profile
A signature is composed of distinct component patterns. They can be shown by show_sig_profile()
. Of note, for different types of signature, the bar heights may have different meanings.
- SBS signatures are displayed based on the observed component frequency of the human genome, i.e., representing the relative proportions of mutations generated by each signature based on the actual trinucleotide frequencies of the reference human genome.
- Similar to SBS signatures, copy number signatures are displayed based on the observed component frequency of the human genome. Of note, considering the count process of each feature is relatively independent, the profile is row normalized by each feature, unlike Macintyre et al. (2018) did column normalization (this method is easy to mislead readers), so the bar height can be compared within/between features.
5.2.3 SBS signature profile
show_sig_profile(mt_sig, mode = "SBS", paint_axis_text = FALSE, x_label_angle = 90)
show_sig_profile(mt_sig, mode = "SBS", style = "cosmic", x_label_angle = 90)
5.2.4 Copy number signature profile
For copy number signatures from tally method “W”, you have to specify the normalize
option as “feature”, so the bar heights can be more clearly compared.
show_sig_profile(sig_w,
mode = "copynumber",
normalize = "feature",
method = "W",
style = "cosmic"
)
5.2.5 COSMIC signature profile
Users can show profile of COSMIC signatures by show_cosmic_sig_profile()
.
To see valid signature numbers, run
show_cosmic_sig_profile(sig_db = "legacy")
##
## Valid index for db 'legacy':
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
‘legacy’ is for COSMIC v2.
show_cosmic_sig_profile(sig_db = "SBS")
##
## Valid index for db 'SBS':
## 1 2 3 4 5 6 7a 7b 7c 7d 8 9 10a 10b 11 12 13 14 15 16 17a 17b 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 84 85 86 87 88 89 90
To show the plot, specify signature shortnames to sig_index
option.
show_cosmic_sig_profile(sig_index = c(1, 5, 6), style = "cosmic")
##
## Valid index for db 'legacy':
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
show_cosmic_sig_profile(sig_index = c(1, 2, 3), style = "cosmic", sig_db = "DBS")
##
## Valid index for db 'DBS':
## 1 2 3 4 5 6 7 8 9 10 11
show_cosmic_sig_profile(sig_index = c(4, 5, 6), style = "cosmic", sig_db = "ID")
##
## Valid index for db 'ID':
## 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
5.2.6 Exposure (activity) profile
show_sig_exposure(mt_sig)
show_sig_exposure(mt_sig, style = "cosmic")
show_sig_exposure(sig_w, style = "cosmic")
You can put group labels in the exposure profile.
grp <- get_groups(sig_w)
## ℹ [2022-08-29 11:59:51]: Started.
## ✔ [2022-08-29 11:59:51]: 'Signature' object detected.
## ℹ [2022-08-29 11:59:51]: Obtaining clusters from the hierarchical clustering of the consensus matrix...
## ℹ [2022-08-29 11:59:51]: Finding the dominant signature of each group...
## => Generating a table of group and dominant signature:
##
## Sig1 Sig2
## 1 0 2
## 2 8 0
## => Assigning a group to a signature with the maxium fraction (stored in 'map_table' attr)...
## ℹ [2022-08-29 11:59:51]: Summarizing...
## group #1: 2 samples with Sig2 enriched.
## group #2: 8 samples with Sig1 enriched.
## ! [2022-08-29 11:59:51]: The 'enrich_sig' column is set to dominant signature in one group, please check and make it consistent with biological meaning (correct it by hand if necessary).
## ℹ [2022-08-29 11:59:51]: 0.097 secs elapsed.
grp_label <- grp$group
names(grp_label) <- grp$sample
show_sig_exposure(sig_w, style = "cosmic", groups = grp_label)
Of note:
- For COSMIC signatures, the absolute exposure is the estimated mutation counts.
- For copy number signatures, the absolute exposure is the estimated copy number segments.
5.2.7 Consensus map
This can only support the result from sig_extract()
with multiple runs.
show_sig_consensusmap(mt_sig)
5.2.8 Catalogue profile
Based on plot method for signature, we can plot raw catalog profile.
show_catalogue(t(mt_tally$nmf_matrix), style = "cosmic", x_label_angle = 90)
At default, the function sums all samples. Users can specify sample ID.
show_catalogue(t(mt_tally$nmf_matrix), style = "cosmic", samples = "TCGA-E9-A22E-01A-11D-A159-09", x_label_angle = 90)