Note: This vignette was not evaluated.

1 Introduction

maftools provides a set of functions to facilitate copy number analysis using ASCAT for tumor-normal or tumor-only WGS datasets. Although there exists ascatNgs, it requires the installation of Perl and C modules to fetch the read counts across the markers. maftools bypass these requirements entirely within R with the C code baked in. However, maftools only generates the required read counts, BAF, and logR files. Downstream analyses have to be done with ASCAT.

ASCAT is not available on CRAN or Bioconductor and needs to be installed from GitHub

If you use maftools functions for CNV analysis, please cite the ASCAT publication

Van Loo P, Nordgard SH, Lingjærde OC, et al. Allele-specific copy number analysis of tumors. Proc Natl Acad Sci U S A. 2010;107(39):16910-16915. doi:10.1073/pnas.1009843107

2 Step-1: Get nucleotide counts for genetic markers

Below command will generate two tsv files tumor_nucleotide_counts.tsv and normal_nucleotide_counts.tsv that can be used for downstream analysis. Note that the function will process ~900K SNPs from Affymetrix Genome-Wide Human SNP 6.0 Array. The process can be sped up linearly by increasing nthreads which will launch each chromosome on a separate thread. Currently hg19 and hg38 are supported.

3 Step-2: Prepare input files for ASCAT with prepAscat()

3.1 Tumor-Normal pair

Below command takes tumor_nucleotide_counts.tsv and normal_nucleotide_counts.tsv files, filter SNPs with low coverage (default <15), estimate BAF, logR, and generates the input files for ASCAT.

Generated BAF and logR files can be processed with ASCAT functions. The below code chunk shows minimal usage with ASCAT. See here for further workflow examples.

4 Processing Mosdepth output

Mosdepth offers the fastest way to estimate coverage metrics from WGS bam files. Output generated by mosdepth can be processed with maftools function plotMosdepth and plotMosdepth_t for CNV analysis by performing segmentation and plotting.

Below mosdepth command generates tumor.regions.bed.gz and normal.regions.bed.gz that contains depth of coverage across the genome in fixed windows.

mosdepth -n -b 5000 tumor tumor.bam
mosdepth -n -b 5000 normal normal.bam

The output {prefix}.regions.bed.gz can be imported and analyzed with maftools in tumor/normal or tumor only mode.

If you use the functions for CNV analysis, please cite the mosdepth publication

Pedersen BS, Quinlan AR. Mosdepth: quick coverage calculation for genomes and exomes. Bioinformatics. 2018;34(5):867-868. doi:10.1093/bioinformatics/btx699

4.2 Tumor only

Above tumor sample without the germline control, normalized for median depth of coverage