#+title: Validated variant calling, clouds and containers
#+author: Brad Chapman \\ Bioinformatics Core, Harvard Chan School \\ https://github.com/chapmanb/bcbio-nextgen \\ http://bcb.io \\ http://j.mp/bcbiolinks
#+date: 23 January 2015

#+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

* bcbio overview

** Summary

\Large
- What is bcbio?
- Validation
- Variant management
- Docker and AWS

** 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-mem, novoalign, bowtie2
- Variantion: FreeBayes, GATK, Platypus, MuTecT, scalpel, SnpEff, VEP, GEMINI, Lumpy, Delly
- RNA-seq: Tophat, STAR, cufflinks, HTSeq
- Quality control: fastqc, bamtools, RNA-SeQC
- Manipulation: bedtools, bcftools, biobambam, sambamba, samblaster, samtools,
  vcflib
\normalsize

** Provides

\Large
- Community -- collected set of expertise
- Validation -- outputs + automated evaluation
- Scaling
- Ready to run parallel processing on AWS
- Local installation of tools and data
\normalsize

* Community

** Complex, rapidly changing pipelines

[[./images2/gatk_changes.png]]

** Large number of specialized dependencies

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

[[https://github.com/StanfordBioinformatics/HugeSeq]]

** Quality differences between methods

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

[[http://www.bioplanet.com/gcat]]

** Benefits of improved filtering

#+BEGIN_CENTER
#+ATTR_LATEX: :width 0.8\textwidth
[[./images7/freebayes_improve-syn3-tumor.png]]
#+END_CENTER

http://j.mp/cancervalpre

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

** Community: contribution

[[./images5/bcbio_github.png]]

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

** Community: documentation

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

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

* Variant quality

** Validation

\Large
Tests for implementation and methods

- Family/population calling
- Structural variations
- Cancer tumor/normal
\normalsize

** Reference materials

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

[[http://www.genomeinabottle.org/]]
#+END_CENTER

** Joint variant calling definitions

\Large
- Joint calling
- Squaring off/backfilling
- Pooled calling
- Single sample calling

\vspace{1cm}
http://j.mp/bcbiojoint

** Squared off VCF

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

\scriptsize
http://gatkforums.broadinstitute.org/discussion/4150/should-i-analyze-my-samples-alone-or-together

** Implementation

\Large
- GATK HaplotypeCaller -- gVCFs
- FreeBayes -- recalling
- Platypus -- recalling
- samtools 1.x -- recalling

\vspace{1cm}
\normalsize
https://github.com/chapmanb/bcbio.variation.recall

** Scaling and analysis flexibility

\Large
- Parallelize: call samples individually
- Add single new sample to analysis
- Combine existing populations
- Inform calls based on previously known variants

** Multiple approaches work well

#+BEGIN_CENTER
#+ATTR_LATEX: :width 1.1\textwidth
[[./images7/joint.png]]
#+END_CENTER

** Joint vs batch vs single

#+BEGIN_CENTER
#+ATTR_LATEX: :width 0.9\textwidth
[[./images7/method_compare-gatk-NA12878.png]]
#+END_CENTER

** Validation enables scaling

\Large
- Little value in realignment when using haplotype aware caller
- Little value in recalibration when using high quality reads
- Streaming de-duplication approaches provide same quality without disk IO

\vspace{1.0cm}
[[http://j.mp/bcbioeval2]]
\normalsize

** Known unknowns

\LARGE
- Coverage: summarize what you can't assess
- Structural: large, complex rearrangements
\normalsize

** Coverage: Chanjo

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

http://www.chanjo.co

** Structural variations

\Large
- Goal: identify regions with potential issues
- Rough boundaries for additional analysis
- Ensemble: union of all calls
- Understand sensitivity and precision

\vspace{1.0cm}
http://j.mp/bcbiosv

** Structural variant callers

- \Large LUMPY \small https://github.com/arq5x/lumpy-sv
\vspace{0.1cm}
- \Large Delly \small https://github.com/tobiasrausch/delly
\vspace{0.1cm}
- \Large cn.mops \small http://www.bioconductor.org/packages/release/bioc/html/cn.mops.html
\vspace{0.1cm}
- \Large CNVkit \small http://cnvkit.readthedocs.org/
\vspace{0.1cm}
- \Large WHAM \small https://github.com/jewmanchue/wham

** Structural variant evaluation

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

* Variant analysis

** Variant analysis

\Large
- Associate with external annotations
- Manage large numbers of samples
- Query
- Visualize
\normalsize

** Analyze: GEMINI

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

http://gemini.readthedocs.org

** GEMINI: scaling

\Large
- PostgreSQL: \\
   \normalsize https://github.com/arq5x/gemini/tree/postgresql
   - \Large Improved genotype representation
\vspace{0.1cm}
- \Large CitusDB: \\
    \normalsize http://www.citusdata.com/
   - \Large PostgreSQL compatible
   - \Large Sharing and replication
\normalsize

** ADAM: distributed analysis

\Large
- Distributed data schema: Avro + Parquet
- Distributed computation: Spark
- Conversion to and from VCF
- GA4GH: http://ga4gh.org/#/fileformats-team

\vspace{0.3cm}

http://bdgenomics.org/
\normalsize

* AWS + Docker

** Making bcbio easy to use

#+ATTR_LATEX: :width 0.65\textwidth
[[./images2/install_want.png]]

*** Automated Install                                                 :block:
    :PROPERTIES:
    :BEAMER_env: exampleblock
    :END:

We made it easy to install a large number of biological tools. \\
Good or bad idea?

** Need a consistent support environment

[[./images4/install_issues.png]]

** Docker lightweight containers

#+BEGIN_CENTER
#+ATTR_LATEX: :width .6\textwidth
[[./images/homepage-docker-logo.png]]
#+END_CENTER

http://docker.com

** Docker benefits

\Large
- Fully isolated
- Reproducible -- store full environment with analysis (1Gb)
- Improved installation -- single download + data

** bcbio with Docker

\Large
- External Python wrapper
   - \Large Installation
   - Start and run containers
   - Mount external data into containers
   - Parallelize
- All analysis tools inside Docker
\normalsize

\vspace{0.5cm}
https://github.com/chapmanb/bcbio-nextgen-vm
http://j.mp/bcbiodocker

** bcbio + Docker + AWS

\Large
- Bootstrap from plain AMIs to cluster
- Pull/push data from S3
- Easy interface to start/stop clusters
- Lustre and NFS filesystems

\vspace{0.5cm}
http://bcb.io/2014/12/19/awsbench/

** AWS architecture

\Large
- Code/tools isolated in Docker containers
- Mounted filesystem + Docker for processing
- SLURM scheduler managed with Elasticluster
- Future targets: Amazon EC2 Container Service
\normalsize

** AWS benchmarking

|                           | AWS (Lustre) |
|---------------------------+--------------+
| Total                     |         4:42 |
|---------------------------+--------------+
| genome data preparation   |         0:04 |
| alignment preparation     |         0:12 |
| alignment                 |         0:29 |
| callable regions          |         0:44 |
| alignment post-processing |         0:13 |
| variant calling           |         2:35 |
| variant post-processing   |         0:05 |
| prepped BAM merging       |         0:03 |
| validation                |         0:05 |

100X cancer tumor/normal exome on 64 cores (2 c3.8xlarge)

** Resource usage plots

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

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

* Summary

** Summary

\Large
- bcbio -- quality community built variant calling and RNA-seq analyses
- Validation -- methods and scaling
- Variant management and analysis
- Ready to run implementation -- Docker and AWS

\vspace{0.3cm}
\Large
https://github.com/chapmanb/bcbio-nextgen
\normalsize
