#+title: Variant calling with validated community developed tools
#+author: Brad Chapman \newline Bioinformatics Core, Harvard Chan School \newline https://bcb.io \newline http://j.mp/bcbiolinks
#+date: 6 July 2017

#+OPTIONS: toc:nil H:2

#+startup: beamer
#+LaTeX_CLASS: beamer
#+latex_header: \usepackage{url}
#+latex_header: \usepackage{hyperref}
#+latex_header: \hypersetup{colorlinks=true}
#+BEAMER_THEME: default
#+BEAMER_COLOR_THEME: seahorse
#+BEAMER_INNER_THEME: rectangles

** Outline
\Large
- Overview of variant calling tools
- Open source community resources
- bcbio validated variant analysis
- Science
   - \Large Human build 38
   - \Large GATK4 validation
   - \Large Cancer calling of low frequency variants
   - \Large Structural variation
- Practical calling example

* Variant calling overview
** Human whole genome sequencing

[[./images5/human_genome.png]]

\footnotesize
http://ensembl.org/Homo_sapiens/Location/Genome
\normalsize

** High throughput sequencing

[[./images5/reads.png]]

** Variant calling

[[./images5/SNV_calling.png]]

\footnotesize
http://en.wikipedia.org/wiki/SNV_calling_from_NGS_data
\normalsize

** Scale: exome to whole genome

[[./images5/exome_proportion.png]]

\footnotesize
https://www.flickr.com/photos/119980645@N06/
\normalsize

* Calling methods

** SNPs and Indels

[[./images8/mutations.png]]

http://carolguze.com/text/442-2-mutations.shtml

** Structural variations

#+BEGIN_CENTER
#+ATTR_LATEX: :width .55\textwidth
[[./images8/svs.jpg]]
#+END_CENTER

\footnotesize
http://www.nature.com/nmeth/journal/v9/n2/full/nmeth.1858.html

** Germline population calling

#+ATTR_LATEX: :width .8\textwidth
[[./images8/Utah-Pedigree-1463-with-NA12878.png]]

\tiny
http://blog.goldenhelix.com/grudy/the-state-of-ngs-variant-calling-dont-panic/
\normalsize

** Genome Analysis Toolkit (GATK)

[[./images8/gatk.png]]

\vspace{0.5cm}

https://www.broadinstitute.org/gatk/

** GATK Best Practices

[[./images8/gatk-bp.png]]

\small
https://www.broadinstitute.org/gatk/guide/best-practices
\normalsize

** HaplotypeCaller

[[./images8/gatk-hc.png]]

\tiny
http://gatkforums.broadinstitute.org/discussion/5464/workshop-presentations-2015-uk-4-20-24

** Joint calling on large populations

[[./images8/gatk-joint.png]]

\tiny
http://gatkforums.broadinstitute.org/discussion/5464/workshop-presentations-2015-uk-4-20-24

** GATK4 now open source for all uses

#+BEGIN_CENTER
[[./images8/gatk4-license.png]]
#+END_CENTER

\vspace{0.5cm}

https://software.broadinstitute.org/gatk/blog?id=9645

** FreeBayes

[[./images8/freebayes.png]]

https://github.com/ekg/freebayes

** Filtering -- Variant Quality Score Recalibration

#+ATTR_LATEX: :width .9\textwidth
[[./images8/gatk-vqsr.png]]

\tiny
http://gatkforums.broadinstitute.org/discussion/5464/workshop-presentations-2015-uk-4-20-24

** Filtering -- hard cutoffs

[[./images8/hard-filters.png]]

\vspace{1cm}

http://bcb.io/2014/05/12/wgs-trio-variant-evaluation/

* Post-calling annotation and analysis
** Effects prediction

#+ATTR_LATEX: :width 1.1\textwidth
[[./images8/vep-consequences.jpg]]

\scriptsize
http://www.ensembl.org/info/genome/variation/predicted_data.html

** Tools for effects predictions

\Large
- snpEff

\small
http://snpeff.sourceforge.net/

\vspace{0.5cm}

\Large
- Variant Effect Predictor (VEP) from Ensembl

\small
http://www.ensembl.org/info/docs/tools/vep/index.html

** Annotation and analysis -- GEMINI

[[./images9/gemini_overview.png]]

\small
https://github.com/arq5x/gemini
\normalsize

* Understanding outputs

** VCF -- overview

#+ATTR_LATEX: :width 1.05\textwidth
[[./images8/vcf-overview.png]]

http://vcftools.sourceforge.net/VCF-poster.pdf

** VCF -- representations

[[./images8/vcf-representation.png]]

http://vcftools.sourceforge.net/VCF-poster.pdf

** Learning to read VCFs

\Large
- Step by step guide from Broad
\small
https://www.broadinstitute.org/gatk/guide/article?id=1268

\vspace{0.5cm}
\Large
- Specification
\small
http://samtools.github.io/hts-specs/


* bcbio motivation
** You want to build a variant calling pipeline

#+BEGIN_CENTER
#+ATTR_LATEX: :width 1.0\textwidth
[[./images11/gatk_bp.png]]
#+END_CENTER

\scriptsize
https://software.broadinstitute.org/gatk/best-practices/

** 

#+BEGIN_CENTER
#+ATTR_LATEX: :width 0.8\textwidth
[[./images11/efficiency.png]]
#+END_CENTER
\tiny
https://commons.wikimedia.org/wiki/File:Efficiency_diagram_by_Zureks.svg

** Barriers to implementing yourself

\LARGE
- Changing tools
- Feature support burden
- Validation

** Build open source communities

***                                                           :BMCOL:
   :PROPERTIES:
   :BEAMER_col: 0.45
   :END:
#+BEGIN_CENTER
#+ATTR_LATEX: :width .8\textwidth
[[./images/community.png]]
#+END_CENTER

\vspace{1cm}
\tiny
[[http://www.amazon.com/Community-Structure-Belonging-Peter-Block/dp/1605092770]]

***                                                           :BMCOL:
   :PROPERTIES:
   :BEAMER_col: 0.55
   :END:
#+BEGIN_CENTER
#+ATTR_LATEX: :width 0.9\textwidth
[[./images11/bosc2017.png]]
#+END_CENTER
\vspace{1cm}

\scriptsize
http://www.open-bio.org/wiki/BOSC_2017


** Overview

#+ATTR_LATEX: :width 1.0\textwidth
[[./images3/bcbio_nextgen_highlevel.png]]

\vspace{1cm}
https://github.com/chapmanb/bcbio-nextgen

** Supported analysis types

#+BEGIN_CENTER
#+ATTR_LATEX: :width 0.4\textwidth
[[./images9/bcbio_pipelines.png]]
#+END_CENTER

\scriptsize
https://bcbio-nextgen.readthedocs.org/en/latest/contents/pipelines.html



* Changing tools

** We made a pipeline -- so what?

\tiny
#+BEGIN_QUOTE
There have been a number of previous efforts to create publicly available
analysis pipelines for high throughput sequencing data. Examples include
Omics-Pipe, bcbio-nextgen, TREVA and NGSane. These pipelines
offer a comprehensive, automated process that can analyse raw sequencing reads
and produce annotated variant calls. However, the main audience for these
pipelines is the research community. Consequently, there are many features
required by clinical pipelines that these examples do not fully address. Other
groups have focused on improving specific features of clinical pipelines. The
Churchill pipeline uses specialised techniques to achieve high performance,
while maintaining reproducibility and accuracy. However it is not freely
available to clinical centres and it does not try to improve broader clinical
aspects such as detailed quality assurance reports, robustness, reports and
specialised variant filtering. The Mercury pipeline offers a comprehensive
system that addresses many clinical needs: it uses an automated workflow system
(Valence) to ensure robustness, abstract computational resources and
simplify customisation of the pipeline. Mercury also includes detailed coverage
reports provided by ExCID, and supports compliance with US privacy laws
(HIPAA) when run on DNANexus, a cloud computing platform specialised for
biomedical users. Mercury offers a comprehensive solution for clinical users,
however it does not achieve our desired level of transparency, modularity and
simplicity in the pipeline specification and design. Further, Mercury does not
perform specialised variant filtering and prioritisation that is specifically
tuned to the needs of clinical users.
#+END_QUOTE

\scriptsize
http://www.genomemedicine.com/content/7/1/68

** Sustainability

\Large
A piece of software is being sustained if people are using it, fixing it, and
improving it rather than replacing it.

\vspace{0.5cm}

\normalsize
http://software-carpentry.org/blog/2014/08/sustainability.html

** Complex, rapidly changing baseline functionality

[[./images8/gatk_changes_gatk4.png]]

* Feature support burden

** Feature support burden

#+BEGIN_CENTER
#+ATTR_LATEX: :width 0.55\textwidth
[[./images11/nextflow_comparison.png]]
#+END_CENTER

\scriptsize
http://www.nature.com/nbt/journal/v35/n4/full/nbt.3820.html

** Community: sustainability and support

#+ATTR_LATEX: :width 0.9\textwidth
[[./images11/bcbio_commits_apr2017.png]]

\vspace{0.5cm}

#+ATTR_LATEX: :width 0.9\textwidth
[[./images11/bcbio_issues_apr2017.png]]

\vspace{0.5cm}

[[https://github.com/chapmanb/bcbio-nextgen]]




* Value of validation
** Value of validation
\LARGE
- Integration tests for pipelines
- Unbiased algorithm comparisons
- Baseline for improving methods

** Reference materials

#+BEGIN_CENTER
#+ATTR_LATEX: :width .5\textwidth
[[./images/giab.png]]

#+ATTR_LATEX: :width .7\textwidth
[[./images7/ga4gh.png]]

#+ATTR_LATEX: :width .9\textwidth
[[./images7/dream_challenge.png]]
#+END_CENTER

http://www.genomeinabottle.org/
http://ga4gh.org/\#/benchmarking-team
https://www.synapse.org/\#!Synapse:syn312572

** GATK and Genome in a Bottle
\Large
- Collaboration with GATK methods development
- Compare HaplotypeCaller to other methods
- Germline validation
- Genome in a Bottle reference materials
  - \Large NA12878 -- Caucasian
  - \Large NA24385 -- Ashkenazim Jewish
  - \Large NA24631 -- Chinese

** Validation graphs

#+ATTR_LATEX: :width 1.0\textwidth
[[./images10/grading-example.png]]

** NA12878

#+ATTR_LATEX: :width 1.0\textwidth
[[./images10/gatk-giab-NA12878.png]]

** NA24385

#+ATTR_LATEX: :width 1.0\textwidth
[[./images10/gatk-giab-NA24385.png]]

** Validation results

\Large
- Good performance for GATK HaplotypeCaller
- Other good performing callers: FreeBayes
- Consistency across diverse samples
- Identify potential problem areas for tuning
   - \Large samtools Indel false positive rates
   - \Large Platypus SNP sensitivity
- PrecisionFDA: https://precision.fda.gov/


* Build 38

** Outline: Science

\Large
- \textbf{Human build 38}
- GATK4 validation
- Low frequency somatic calling
- Structural variation

** GRCh37/hg19

#+ATTR_LATEX: :width .9\textwidth
[[./images8/GRCh37.jpg]]

\small
http://www.ncbi.nlm.nih.gov/books/NBK153600/?report=reader

** GRCh38 -- graph based, many more alternative loci

#+ATTR_LATEX: :width .9\textwidth
[[./images8/GRCh38.jpg]]

\footnotesize
http://www.slideshare.net/GenomeRef/transitioning-to-grch38

** GRCh38 -- advantage for variant calling

#+ATTR_LATEX: :width .9\textwidth
[[./images8/GRCh38-advantages.jpg]]

\footnotesize
http://www.slideshare.net/GenomeRef/transitioning-to-grch38

** Avoiding collapsed repeats

#+ATTR_LATEX: :width 0.8\textwidth
[[./images7/hg38_collapsed_repeats.jpg]]

\tiny
http://www.slideshare.net/kmsteinberg/the-importance-of-high-quality-reference-genome-assemblies-to-personal-and-medical-genomics

** Comparison

\Large
- Build 37 and 38
- Validation sets: Genome in a Bottle, Illumina Platinum Genomes
- 38 builds: with/without alternative alleles
- Variant callers: FreeBayes, GATK HaplotypeCaller

\normalsize
http://bcb.io/2015/09/17/hg38-validation/

** 

#+BEGIN_CENTER
#+ATTR_LATEX: :width .9\textwidth
[[./images7/hg38_val.png]]
#+END_CENTER

** Small variant results

\Large
- SNPs: build 38 more sensitive
- SNPs: build 38 reduces false positives
- Indels: build 38 detected more
- Indels: work on sensitivity and precision


* GATK4 validation

** Outline: science

\Large
- Human build 38
- \textbf{GATK4 validation}
- Low frequency somatic calling
- Structural variation

** 
[[./images8/gatk4_na12878_hg38_validation.png]]

** GATK4 validation results

\Large
- Comparable sensitivity and specificity to GATK3
- Removed a recommended filter
  - \Large Strand Odds Ratio (SOR) -- strand bias
  - \Large Improves sensitivity
  - \Large ~6000 TPs vs ~2000 FPs
- Indels in GATK need additional tuning
   - \Large Sensitivity/specificity tradeoff
   - \Large ~26k TPs vs ~11k FPs

* Somatic calling

** Outline: science

\Large
- Human build 38
- GATK4 validation
- \textbf{Low frequency somatic calling}
- Structural variation

** Cancer somatic calling

[[./images8/cancer-somatic.png]]

\vspace{0.5cm}
\scriptsize
http://www.nature.com/nmeth/journal/v10/n8/fig_tab/nmeth.2562_F1.html
\normalsize

** Cancer heterogeneity

[[./images8/Treatment_bottleneck.pdf]]

\small
http://en.wikipedia.org/wiki/Tumour_heterogeneity
\normalsize

** VarDict

\Large
- AstraZeneca
- Germline + Cancer calling
- SNP + Insertion/Deletions
- Whole genome + exome
- Also works on deep targeted data

\vspace{1cm}
\small
https://github.com/AstraZeneca-NGS/VarDictJava
http://nar.oxfordjournals.org/content/early/2016/04/07/nar.gkw227.full
\normalsize

** DREAM synthetic dataset 4

#+BEGIN_CENTER
#+ATTR_LATEX: :width 1.0\textwidth
[[./images7/dream_syn4.png]]
#+END_CENTER

\footnotesize
https://www.synapse.org/\#!Synapse:syn312572/wiki/62018

** VarDict sensivitity/precision before

#+BEGIN_CENTER
#+ATTR_LATEX: :width 1.0\textwidth
[[./images7/vardict_val_orig.png]]
#+END_CENTER

** VarDict sensivitity/precision after

#+BEGIN_CENTER
#+ATTR_LATEX: :width 1.0\textwidth
[[./images7/vardict_val.png]]
#+END_CENTER

** How? Filter summary

\Large
#+BEGIN_SRC sh
((AF * DP < 6) &&
 ((MQ < 55.0 && NM > 1.0) ||
  (MQ < 60.0 && NM > 2.0) ||
  (DP < 10) ||
  (QUAL < 45)))
#+END_SRC

** Example filter: mapping quality and number of mismatches

#+BEGIN_CENTER
#+ATTR_LATEX: :width 1.0\textwidth
[[./images7/vardict_filter_nmmq.png]]
#+END_CENTER

* Structural variation

** Outline: science

\Large
- Human build 38
- GATK4 validation
- Low frequency somatic calling
- \textbf{Structural variation}

** Structural variants critical in cancer

#+ATTR_LATEX: :width 1.0\textwidth
[[./images9/nature14169-sf2.jpg]]

\scriptsize
http://www.nature.com/nature/journal/v518/n7540/full/nature14169.html

** Improvements in speed, sensitivity and precision

- \Large Manta: \footnotesize https://github.com/Illumina/manta
- \Large CNVkit: \footnotesize https://github.com/etal/cnvkit
- \Large Lumpy: \footnotesize https://github.com/arq5x/lumpy-sv
- \Large WHAM: \footnotesize https://github.com/zeeev/wham
- \Large MetaSV: \footnotesize https://github.com/bioinform/metasv

** Results: Somatic deletions

#+BEGIN_CENTER
#+ATTR_LATEX: :width 0.9\textwidth
[[./images7/sv_dream_del.png]]
#+END_CENTER

** Prioritize in previously known regions

#+ATTR_LATEX: :width 1.0\textwidth
[[./images9/prioritize-overview.png]]

** Public cancer variant databases

- CIViC: https://civic.genome.wustl.edu
- IntOGen: http://www.intogen.org

#+BEGIN_CENTER
#+ATTR_LATEX: :width 0.3\textwidth
[[./images9/biology-of-cancer.jpg]]
#+END_CENTER
\vspace{0.01cm}
\scriptsize
http://www.amazon.com/The-Biology-Cancer-Robert-Weinberg/dp/0815340761
\normalsize

* Practical

** Practical overview

\Large
- Small dataset -- single chromosome, exome
- Cancer sample from DREAM synthetic dataset 3
- Call against build 38

\footnotesize
https://www.synapse.org/\#!Synapse:syn312572/wiki/58893

** Demonstrates

\Large
- Somatic tumor/normal samples
- SNP and indel calling at lower frequency
- Structural variant detection
- Prioritization with CIViC
- HLA typing

** bcbio configuration file

#+BEGIN_SRC yaml
---
details:
  - analysis: variant2
    genome_build: hg38
    algorithm:
      aligner: bwa
      mark_duplicates: true
      recalibrate: false
      realign: false
      variantcaller: [vardict, mutect, freebayes]
      ensemble:
        numpass: 2
      svcaller: [lumpy, manta]
#+END_SRC

\footnotesize
https://bcbio-nextgen.readthedocs.org/en/latest/contents/configuration.html

** bcbio template file -- CSV

#+BEGIN_SRC sh
samplename,description,batch,phenotype,sex,variant_regions
sample1,ERR256785,batch1,normal,female,/path/to/regions.bed
sample2,ERR256786,batch1,tumor,,/path/to/regions.bed
#+END_SRC

\vspace{1cm}
\scriptsize
https://bcbio-nextgen.readthedocs.org/en/latest/contents/configuration.html#automated-sample-configuration

** Template to full configuration

#+BEGIN_SRC sh
bcbio_nextgen.py -w template \
   tumor-paired.yaml project1.csv \
   sample1.bam sample2_1.fq sample2_2.fq
#+END_SRC

\vspace{1cm}
\scriptsize
https://bcbio-nextgen.readthedocs.org/en/latest/contents/configuration.html#automated-sample-configuration

** Running bcbio

\Large
#+BEGIN_SRC sh
bcbio_nextgen.py project1.yaml -n 8
#+END_SRC

\vspace{1cm}
\scriptsize
https://bcbio-nextgen.readthedocs.org/en/latest/contents/testing.html

** AWS example configuration and output

https://bcbio-nextgen.readthedocs.org/en/latest/contents/teaching.html

\vspace{0.5cm}

\Large
- Pre-downloaded and analysis run
- AMI (ami-5e84fe34)
* Summary
** Summary
\Large
- Overview of variant calling tools
- Open source community resources
- bcbio validated variant analysis
- Science
   - \Large Human build 38
   - \Large GATK4 validation
   - \Large Cancer calling of low frequency variants
   - \Large Structural variation
- Practical calling example

\vspace{0.5cm}
http://bcb.io
