#+title: Overview of bcbio: validated, scalable, community developed variant calling, RNA-seq and small RNA analysis
#+author: Brad Chapman \newline Bioinformatics Core, Harvard Chan School \newline https://bcb.io \newline http://j.mp/bcbiolinks
#+date: 11 January 2016

#+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
- Motivate for using open source community resources
- Overview of bcbio validated variant calling
- Integration goals with Arvados
- Science
   - \Large Human build 38 + HLA
   - \Large Cancer calling of low frequency variants
   - \Large Structural variation

* Motivation

** We need to do science faster

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

\scriptsize
https://twitter.com/KMS_Meltzy/status/661206070308794368
\normalsize

** We need to incorporate improvements faster


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

#+BEGIN_CENTER
#+ATTR_LATEX: :width .8\textwidth
[[./images7/build38_reddit.png]]
#+END_CENTER

\tiny
https://www.reddit.com/r/genome/comments/3b3s3t/switch_from_hg19build37_to_hg20build38/

** Daily bioinformatics work

\Large
- Install tools
- Put tools together
- Test and validate
- Improve algorithms
- Scale
- Read literature
- Do biology
\normalsize

** Standard analyses not routine

\Large
#+BEGIN_QUOTE
Four major genome centers predicted single-nucleotide variants (SNVs) for The
Cancer Genome Atlas (TCGA) lung cancer samples, but only 31.0% (1,667/5,380) of
SNVs were identified by all four.
#+END_QUOTE

\scriptsize
http://www.nature.com/nmeth/journal/vaop/ncurrent/full/nmeth.3407.html
\normalsize

** Combining analyses

#+BEGIN_CENTER
#+ATTR_LATEX: :width .6\textwidth
[[./images7/cancer_multiple.png]]
#+END_CENTER

\scriptsize
http://www.cell.com/cell-systems/abstract/S2405-4712%2815%2900113-1

** Working together produces great things

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

http://exac.broadinstitute.org/about

** Solution

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

\scriptsize
[[http://www.amazon.com/Community-Structure-Belonging-Peter-Block/dp/1605092770]]
\normalsize


* Open source bioinformatics

** Large scale infrastructure development

\Large
- Shared problems -- academic, industry, startups
- Community developed analyses
- Validation
- Scaling
- Supporting a community of users
\normalsize

** White box software

[[./images5/clear_box.jpg]]

** Overview

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

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

** Uses

\Large
- Aligners: bwa, novoalign, bowtie2, HISAT2
- Variantion: FreeBayes, GATK, VarDict, MuTecT, Scalpel, SnpEff, VEP, GEMINI,
  Lumpy, Manta, CNVkit, WHAM
- RNA-seq: Tophat, STAR, Cufflinks, Sailfish
- Quality control: fastqc, bamtools, Qualimap
- Manipulation: bedtools, bcftools, biobambam, sambamba, samblaster, samtools,
  vcflib, vt
\normalsize

** Provides

\Large
- Community -- collected set of expertise
- Tool integration
- Validation -- outputs + automated evaluation
- Scaling
- Installation of tools and data
\normalsize

** Quality differences between methods

#+ATTR_LATEX: :width .7\textwidth
[[./images/gcat_comparison.png]]

[[http://www.bioplanet.com/gcat]]
** 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

[[./images2/gatk_changes.png]]
** Community: sustainability

#+ATTR_LATEX: :width 1.1\textwidth
[[./images7/bcbio_commits.png]]

\vspace{1cm}

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

** Community: support

#+ATTR_LATEX: :width 1.1\textwidth
[[./images7/bcbio_issues.png]]

\vspace{1cm}

[[https://bcbio-nextgen.readthedocs.org]]

** Community: contribution

[[./images5/bcbio_github.png]]

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

** Community: documentation

[[./images/community-docs.png]]

[[https://bcbio-nextgen.readthedocs.org]]


* Integration with Arvados
** Integration with Arvados
\Large
- Replace bcbio internal workflow with CWL
- bcbio generates CWL
- Arvados/Crunch runs generated CWL with bcbio Docker container
- Plug in sections of bcbio code into Arvados

** Integration overview

[[./images9/bcbio-cwl.png]]

** Current status
\Large
- Standard command line interface to call bcbio sub-function
- Docker container (bcbio/bcbio) with all tools installed
- Generates CWL for small pipelines, with sample-level parallelization
- Runs with cwltool

\small
https://github.com/chapmanb/bcbio-nextgen/tree/master/cwl

** CWL ToDo -- Arvados
\Large
- Run with CWL enabled Crunch
- Work on ways to integrate bcbio data with Keep
- Provide standard pipelines in bcbio as part of Arvados
- Plug in sections of bcbio code to interoperate with other tools

** CWL ToDo -- bcbio
\Large
- Advanced parallelization (split samples, genomic regions)
- Port remaining bcbio functionality (define inputs/outputs for each step)
- Testing with other CWL implementations (Galaxy, Seven Bridges)

* Build 38

** Outline: Science

\Large
- \textbf{Human build 38 + HLA}
- Low frequency somatic calling
- Structural variation

** Currently: 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
- Lift-over methods: CrossMap/LiftOver, NCBI Remap
- 38 builds: with/without alternative alleles
- Variant callers: FreeBayes, GATK HaplotypeCaller

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

** 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

** 

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

** 

#+BEGIN_CENTER
#+ATTR_LATEX: :width .8\textwidth
[[./images7/hg38_val_giab.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

** Remapping results

\Large
Need conversion approaches for resources not yet available on build 38

\Large
- CrossMap: \newline
  \normalsize http://crossmap.sourceforge.net/
\Large
- NCBI remap: \newline
  \normalsize http://www.ncbi.nlm.nih.gov/genome/tools/remap
\Large
- Both performed well
- NCBI remap has additional sensitivity, but requires tuning

** Major histocompatibility complex (MHC) -- HLAs

[[./images8/MHC.png]]

\small
\vspace{1cm}
http://www.ebi.ac.uk/ipd/imgt/hla/ \\
\scriptsize
http://sciscogenetics.com/technology/human-leukocyte-antigen-complex/

** Alignment: bwa alternative allele support

#+ATTR_LATEX: :width .9\textwidth
[[./images8/bwa-alts.png]]

\small
https://github.com/lh3/bwa/blob/master/README-alt.md

** HLA typing

\Large
- 1000 genomes: build 38 + IMGT/HLA-3.18.0
- bwa mem extracts HLA reads
- Map reads only to HLA sequences
- OptiType: Call HLA types

\vspace{0.5cm}
\footnotesize
https://github.com/lh3/bwa/blob/master/README-alt.md\#hla-typing \newline
https://github.com/FRED-2/OptiType

** HLA nomenclature

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

https://www.ebi.ac.uk/ipd/imgt/hla/
http://hla.alleles.org/alleles/p_groups.html

** Validations

\Large
- Omixon example data
- Exome (1000 genomes) and deep targeted data
- P-group resolution
- HLA type I calls (A, B, C)
- Great results across exome and targeted

\footnotesize
http://www.omixon.com/hla-typing-example-data/ \newline
https://gist.github.com/chapmanb/8f994618a7fc5e88f893

** HLA complexity

#+ATTR_LATEX: :width 1.0\textwidth
[[./images9/hla-vg-graph.png]]

\scriptsize
https://docs.google.com/presentation/d/1hPZv6M3N3kQ2LYVHX1dpqe--bxvWOXOPB5kM32Q3B5s
\normalsize

** Genome graphs and variation

#+ATTR_LATEX: :width .9\textwidth
[[./images8/discovar-graphs.jpg]]

\footnotesize
http://www.nature.com/ng/journal/v46/n12/fig_tab/ng.3121_SF6.html
\normalsize

** vg -- tools for working with variant graphs

#+BEGIN_CENTER
#+ATTR_LATEX: :width .5\textwidth
[[./images8/vg-graphs.png]]
#+END_CENTER

\tiny
\scriptsize
https://docs.google.com/presentation/d/1bbl2zY4qWQ0yYBHhoVuXb79HdgajRotIUa_VEn3kTpI
\normalsize

** vg -- future variant calling

#+ATTR_LATEX: :width 1.0\textwidth
[[./images9/vg-variant-calls.png]]

\scriptsize
https://docs.google.com/presentation/d/1hPZv6M3N3kQ2LYVHX1dpqe--bxvWOXOPB5kM32Q3B5s
\normalsize


* Somatic calling

** Outline: science

\Large
- Human build 38 + HLA
- \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
- SNP + Insertion/Deletions
- Works on very deep targeted data

\vspace{1cm}
\small
https://github.com/AstraZeneca-NGS/VarDictJava
\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

** Filter: mapping quality and number of mismatches

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

** Filter: low depth

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

** Filter: low quality

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

** How can we improve?

\Large
- Incorporate machine learning methods
- Generalize with additional datasets
- AML31: http://aml31.genome.wustl.edu/

* Structural variation

** Outline: science

\Large
- Human build 38 + HLA
- 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 Lumpy: \footnotesize https://github.com/arq5x/lumpy-sv
- \Large Manta: \footnotesize https://github.com/Illumina/manta
- \Large CNVkit: \footnotesize https://github.com/etal/cnvkit
- \Large WHAM: \footnotesize https://github.com/zeeev/wham
- \Large MetaSV: \footnotesize https://github.com/bioinform/metasv

** Last year: Somatic deletions

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

** Results: Germline deletions

#+BEGIN_CENTER
#+ATTR_LATEX: :width 0.8\textwidth
[[./images7/sv_giab_del.png]]
#+END_CENTER

** Results: Somatic deletions

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

** Results: Somatic insertions

#+BEGIN_CENTER
#+ATTR_LATEX: :width 0.9\textwidth
[[./images7/sv_dream_ins.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


** Summary
\Large
- Open source community resources
- bcbio validated variant calling
- Science
   - \Large Human build 38 + HLA
   - \Large Cancer calling of low frequency variants
   - \Large Structural variation

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