knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Getting started

The TrackSig package implements models for subclonal reconstruction, as described by Rubanov et al.[^1] Subclones can be identified by a segmentation aglorithm, where we look for a change in distribution over mutational signatures, or in variant allele frequencies. We use variant calling data in VCF format for this segmentation.

Mutational signatures

Scoring methods

Plotting options

Workflow

Demonstration of a putative usecase

First, we show the

library(TrackSig)
library(ggplot2)
set.seed(1224)

# paths to data
vcfFile <- system.file("extdata/Example.vcf", package = "TrackSig")
cnaFile <- system.file("extdata/Example_cna.txt", package = "TrackSig")

# find active signatures in the sample
# 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.
counts <- vcfToCounts(vcfFile, cnaFile, purity = 1)
activeInSample <- detectActiveSignatures(counts$countsPerBin)

# get TrackSig results
# expect same warning as before
trajectory <- TrackSig(vcfFile = vcfFile, 
                    activeInSample = activeInSample, 
                    cnaFile = cnaFile, 
                    purity = 1, 
                    referenceSignatures = TrackSig:::alex_merged,
                    scoreMethod = "SigFreq")

plotTrajectory(trajectory)

The TrackSig function is a wrapper for two main activities; first the timeline of mutation counts is constructed, and secondly a model is fit using thre PELT algorithm to find changepoints and mixtures of mutational signatures across the timeline of counts. We can repeat the exact same behaviour as above, with just the functions that TrackSig() calls. This will not return the slotted object that TrackSig() does, but may be useful for advanced users with non-putative usecases.

vcfToCounts() returns a list with named elements vcaf (Variant Copy number abberation And Frequencies) and countsPerBin, these two objects taken together are used to create the trajectory according to mutation's bin assignments.

library(TrackSig)
library(ggplot2)
set.seed(1224)

# paths to data
vcfFile <- system.file("extdata/Example.vcf", package = "TrackSig")
cnaFile <- system.file("extdata/Example_cna.txt", package = "TrackSig")

# make trajectory of mutation counts
counts <- vcfToCounts(vcfFile = vcfFile, cnaFile = cnaFile, purity = 1)

# subset referenceSignatures with active signatures to speed up trajectory computation
activeInSample <- detectActiveSignatures(counts$countsPerBin)
activeSubset <- TrackSig:::alex_merged[,activeInSample]

# segment trajectory with changepoints
trajectory <- getChangepointsPELT(counts$vcaf, counts$countsPerBin, 
                                  referenceSignatures = activeSubset, 
                                  scoreMethod = "SigFreq")
plotTrajectory(trajectory)

References

[^1]: Rubanova, Y. et al. TrackSig: reconstructing evolutionary trajectories of mutation signature exposure. bioRxiv (PREPRINT), (2019).



harrig12/TrackSigFreq-dev documentation built on July 5, 2021, 4:21 a.m.