R package for TrackSig, TrackSigFreq

Morris Lab, University of Toronto. R package for TrackSig, and its extension TrackSigFreq.


Coming soon

Load the package in R

Make sure you have a version of R >= 3.3.3. You can install the package using devtools. Some of TrackSig's dependencies are only available via bioconductor.



Using the example data provided in extdata/, the following code will plot the signature trajectory, and return the fitted mixture of signatures for each bin, the bins where changepoints were detected, and the ggplot object.

  1. First, restrict the list of signatures to fit exposure for. This is recommended for improving speed by making the model smaller. Here, we choose a threshold of 5%, meaning that signatures with exposure under this across all timepoints will not be fit.

vcfFile = system.file(package = "TrackSig", "extdata/Example.vcf")
cnaFile = system.file(package = "TrackSig", "extdata/Example_cna.txt")
purity = 1

detectedSigs <- detectActiveSignatures(vcfFile = vcfFile, cnaFile = cnaFile,
                                       purity = purity, threshold = 0.05)
  1. Next, we compute the trajectory for all timepoints.

# a warning will appear about not matching the refrence genome, this is because the
# example vcf file is generated by sampling random nucleotides, not real mutations. 
traj <- TrackSig(sampleID = "example", activeInSample = detectedSigs,
                 vcfFile = vcfFile, cnaFile = cnaFile, purity = purity)

The function TrackSig has three available methods for segmentation, controlled by the parameter scoreMethod. These are: + Signature (described in the TrackSig paper) + SigFreq (described in the TrackSigFreq paper) + Frequency (not explicitly described, but corresponds to the frequency likelihood in the TrackSigFreq paper).

  1. Plot the trajectory. If we plot with non-linear x-axis, then we can use the funciton addPhiHist()
plotTrajectory(traj, linearX = T) + labs(title = "Example trajectory with linear x-axis")

nonLinPlot <- plotTrajectory(traj, linearX = F, anmac = T) + labs(title = "Example trajectory with non-linear x-axis")
addPhiHist(traj, nonLinPlot)

img: example plotting output img: example plotting output

To cite

TrackSig citation

Rubanova, Y., Shi, R., Harrigan, C.F. et al. Reconstructing evolutionary trajectories of mutation signature activities in cancer using TrackSig. Nat Commun 11, 731 (2020).

TrackSigFreq citation

Harrigan, C.F., Rubanova, Y., Morris, Q. & Selega, A. TrackSigFreq: subclonal reconstructions based on mutation signatures and allele frequencies. Pac Symp Biocomput 25, 238–249 (2020).


Some users may have plotting issues with TrackSig if ggplot2 is not explicitly loaded with library(ggplot2). We are experiencing a bug that has been previously described for ggplot2.

morrislab/TrackSigFreq documentation built on June 29, 2020, 5:13 a.m.