% Created 2017-12-04 Mon 12:24
\documentclass[presentation]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{minted}
\usepackage{inconsolata}
\usetheme{default}
\author{Michael Lawrence}
\date{\today}
\title{Conducting Genomic Symphonies with Bioconductor}
\hypersetup{
 pdfauthor={Michael Lawrence},
 pdftitle={Conducting Genomic Symphonies with Bioconductor},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 25.1.1 (Org mode 8.3.6)}, 
 pdflang={English}}
\begin{document}

\maketitle
\begin{frame}{Outline}
\tableofcontents
\end{frame}

\AtBeginSection[]
{
  \begin{frame}<beamer>{Outline}
    \tableofcontents[currentsection]
  \end{frame}
}

\section{Genentech}
\label{sec:orgheadline4}
\begin{frame}[plain,label={sec:orgheadline1}]{}
\includegraphics[width=11cm]{gne-1.pdf}
\end{frame}

\begin{frame}[plain,label={sec:orgheadline2}]{}
\includegraphics[width=11cm]{gne-2.pdf}
\end{frame}

\begin{frame}[plain,label={sec:orgheadline3}]{}
\includegraphics[width=11cm]{gne-3.pdf}
\end{frame}

\section{Genomic workflows}
\label{sec:orgheadline10}
\begin{frame}[label={sec:orgheadline5}]{Genomic workflows are symphonies of different tools}
\begin{block}<only@1>{}
\includegraphics[width=11cm]{symphony.pdf}
\end{block}

\begin{block}<only@2>{}
\includegraphics[width=11cm]{symphony-tools.pdf}
\end{block}
\end{frame}

\begin{frame}[label={sec:orgheadline6}]{Tweet-size example from bedtools tutorial}
\begin{block}<only@1>{}
\includegraphics[width=9cm]{tweet-question.jpg}
\end{block}

\begin{block}<only@2-3>{}
\includegraphics[width=9cm]{tweet-question-answer.jpg}
\end{block}

\begin{block}<only@4>{}
\includegraphics[width=.9\linewidth]{tweet-lose-the-awk.jpg}
\end{block}

\begin{block}<only@3->{}
\includegraphics[width=.9\linewidth]{tweet-pipeline.pdf}
\end{block}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline7}]{Typical real-world example from bedtools tutorial}
 Compute the pairwise similarity between samples of DNAse
hypersensitivity regions, according to the \texttt{bedtools} Jaccard
statistic.

\includegraphics[width=.9\linewidth]{jaccard-pipeline.pdf}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline8}]{bedtools solution}
 \begin{columns}
\begin{column}{0.3\columnwidth}
\begin{block}{Languages used}
\begin{itemize}
\item<2-> shell
\item<2-> GNU parallel
\item<2-> awk
\item<3-> sed
\item<3-> perl
\item<4-> python
\item<5-> R
\end{itemize}
\end{block}

\begin{block}{Side-effects}
\begin{itemize}
\item<2-> 400 \texttt{.jaccard}
\item<3-> \texttt{pairwise.txt}
\item<4-> \texttt{pairwise.mat}
\end{itemize}
\end{block}
\end{column}

\begin{column}{0.7\columnwidth}
\begin{block}<only@2>{Compute pairwise distances in parallel}
\begin{minted}[frame=leftline]{shell}
parallel "bedtools jaccard -a {1} -b {2} \
      | awk 'NR>1' \
      | cut -f 3 \
      > {1}.{2}.jaccard" \
      ::: `ls *.merge.bed`
      ::: `ls *.merge.bed`
\end{minted}
\end{block}

\begin{block}<only@3>{Combine jaccard files}
\begin{minted}[frame=leftline]{shell}
find . \
  | grep jaccard \
  | xargs grep "" \
  | sed -e s"/\.\///" \
  | perl -pi -e "s/.bed./.bed\t/" \
  | perl -pi -e "s/.jaccard:/\t/" \
  > pairwise.txt
\end{minted}
\end{block}

\begin{block}<only@4>{Reshape into matrix}
\begin{minted}[frame=leftline]{shell}
awk 'NF==3' pairwise.txt \
| awk '$1 ~ /^f/ && $2 ~ /^f/' \
| python make-matrix.py \
> pairwise.mat
\end{minted}
\end{block}

\begin{block}<only@5>{Plot the matrix}
\begin{minted}[frame=leftline]{shell}
R
\end{minted}
\begin{minted}[frame=leftline]{r}
library(gplots)
library(RColorBrewer)
jaccard_df <-
    read.table('pairwise.dnase.mat')
jaccard_matrix <-
    as.matrix(jaccard_df[,-1])
heatmap.2(jaccard_matrix,
	  col = brewer.pal(9, "Blues"),
	  margins = c(14, 14),
	  density.info = "none",
	  lhei = c(2, 8),
	  trace = "none")
\end{minted}
\end{block}
\end{column}
\end{columns}
\end{frame}

\begin{frame}[label={sec:orgheadline9}]{Typical obstacles in implementing genomic data analyses}
\begin{itemize}
\item Tools are difficult to build, install and run
\item Limitations require mixing languages and semi-compatible,
inconsistently documented toolsets
\item Interoperability depends on inefficient, complex file formats
\item Analyst has to directly manipulate and manage files, instead of
focusing on the analysis
\item Reproducibility is hard
\end{itemize}

\centering{
\includegraphics[width=4cm]{obstacle-course.jpg}
}
\end{frame}

\section{R}
\label{sec:orgheadline17}
\begin{frame}[label={sec:orgheadline11}]{R is a platform and language for statistical computing}
\begin{columns}
\begin{column}{0.8\columnwidth}
\begin{itemize}
\item Core principes according to John Chambers in "Extending R":
\begin{itemize}
\item Everything is an \alert{object}
\item Everything that happens is a \alert{function} call
\item \alert{Interfaces} to other software are core to R
\end{itemize}
\item Addendum: every published extension is a \alert{package}
\begin{itemize}
\item Primary mechanism for distributing statistical computing
research
\end{itemize}
\end{itemize}
\end{column}

\begin{column}{0.2\columnwidth}
\includegraphics[width=.9\linewidth]{Rlogo.png}
\end{column}
\end{columns}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline12}]{R packages are easy to install}
 \begin{itemize}
\item CRAN, Bioconductor distribute vetted \alert{packages}
\begin{itemize}
\item Tested as a cohort
\item Standardized through \texttt{R CMD check}
\end{itemize}
\item Package installation usually just works
\begin{itemize}
\item \texttt{install.packages("gplots")}
\end{itemize}
\end{itemize}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline13}]{R has consistent, function-level documentation}
 Standalone programs provide documentation in different ways:
\begin{itemize}
\item \texttt{man bedtools}?
\item \texttt{bedtools intersect -{}-help}?
\item Google?
\end{itemize}

Every R \alert{package} provides a man page of each
\alert{function}:
\begin{minted}[frame=leftline]{r}
?brewer.pal
\end{minted}

\tiny{
\begin{verbatim}
ColorBrewer palettes

Description:

     Creates nice looking color palettes especially for thematic maps

Usage:

     brewer.pal(n, name)
     
Arguments:

       n: Number of different colors in the palette, minimum 3, maximum
          depending on palette

    name: A palette name from the lists below
\end{verbatim}
}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline14}]{R enables reproducibility}
 \begin{itemize}
\item Dependencies trackable through versioned \alert{packages}
\item Packages like switchr and packrat make it easy to record and
restore sets of package versions
\item \texttt{sessionInfo()}
\end{itemize}

\tiny{
\begin{verbatim}
R Under development (unstable) (2017-08-02 r73018)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gplots_3.0.1       RColorBrewer_1.1-2

loaded via a namespace (and not attached):
[1] compiler_3.5.0     tools_3.5.0        KernSmooth_2.23-15 gdata_2.18.0      
[5] caTools_1.17.1     bitops_1.0-6       gtools_3.5.0
\end{verbatim}
}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline15}]{R unifies workflows through object-oriented interfaces}
 An \alert{object} affords interoperability and abstraction:
\begin{minted}[frame=leftline]{r}
library(gplots)
library(RColorBrewer)
jaccard_df <- utils::read.table('pairwise.mat')
jaccard_matrix <- as.matrix(jaccard_df[,-1])
heatmap.2(jaccard_matrix, col = brewer.pal(9, "Blues"))
\end{minted}

\includegraphics[width=3cm]{heatmap.jpg}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline16}]{R is improving}
 \framesubtitle{Pushing object orientation down to the C level}

\begin{columns}
\begin{column}{0.7\columnwidth}
R 3.5 will add:
\begin{itemize}
\item Object-oriented mechanism for custom implementations of R vectors
\begin{description}
\item[{Compact representations}] Run-length encodings, \texttt{1:10} sequences
\item[{External storage}] Spark, databases, HDF5, Arrow, etc
\end{description}
\item Notions of sortedness and any missingness to the vector API
\item Heuristics that construct compact vectors when it makes sense
\end{itemize}

Luke Tierney, Gabe Becker, Tomas Kalibera
\end{column}

\begin{column}{0.3\columnwidth}
\includegraphics[width=.9\linewidth]{wolf-as-sheep.jpg}
\end{column}
\end{columns}
\end{frame}

\section{Bioconductor}
\label{sec:orgheadline28}
\begin{frame}[label={sec:orgheadline18}]{Bioconductor}
\begin{columns}
\begin{column}{0.7\columnwidth}
A unified platform for the analysis and comprehension of high-throughput
genomic data.
\begin{itemize}
\item Started 2002
\item Led by Martin Morgan
\item Core infrastructure maintained by about 8 people, based in
Roswell Park CRC in Buffalo, NY
\item 1476 \R{} software packages that form a unified platform
\item Well-used and respected.
\begin{itemize}
\item 53k unique IP downloads / month.
\item 21,700 PubMedCentral citations.
\end{itemize}
\item Embraces the R principles of \alert{object}, \alert{function},
\alert{interface} and \alert{package}
\end{itemize}
\end{column}

\begin{column}{0.3\columnwidth}
\begin{center}
\includegraphics[width=.8\textwidth]{bioconductor_logo_rgb.pdf}
\bigskip\par
\includegraphics[width=.3\textwidth]{nid61380-a1-rpci-cmyk-black.pdf}
\bigskip\par
\includegraphics[width=!, height=2em]{logo_nhgri.png}
\bigskip\par
\includegraphics[width=.8\textwidth]{nci-logo-full.png}
\bigskip\par
\includegraphics[width=.6\textwidth]{sound_wordmark.png}
\end{center}
\end{column}
\end{columns}
\end{frame}

\begin{frame}[label={sec:orgheadline19}]{Bioconductor is growing}
\includegraphics[width=.9\linewidth]{packages-per-release.png}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline20}]{Bioconductor qualities}
 \begin{columns}
\begin{column}{0.3\columnwidth}
\begin{itemize}[<alert@+>]
\item Discoverable
\item Installable
\item Reliable
\item Documented
\item Supported
\item Integrated
\item Scalable
\item State of the art
\item Community-driven
\end{itemize}
\end{column}

\begin{column}{0.7\columnwidth}
\begin{block}<only@1>{}
\includegraphics[width=.9\linewidth]{biocviews.jpg}
\bigskip
\par
\includegraphics[width=.9\linewidth]{badges.jpg}
\end{block}

\begin{block}<only@2>{}
\small{
\begin{minted}[frame=leftline]{r}
source("https://bioconductor.org/biocLite.R")
biocLite()
biocLite("Gviz")
\end{minted}
}
\end{block}

\begin{block}<only@3>{}
\includegraphics[width=.9\linewidth]{build-report.jpg}
\end{block}

\begin{block}<only@4>{}
\includegraphics[width=.9\linewidth]{documentation.jpg}
\end{block}

\begin{block}<only@5>{}
\includegraphics[width=.9\linewidth]{support.png}
\end{block}

\begin{block}<only@6>{}
\includegraphics[width=.9\linewidth]{bioc-ecosystem.png}
\end{block}

\begin{block}<only@7>{}
\tiny{
\begin{minted}[frame=leftline]{r}
se <- TENxBrainData()
se
\end{minted}

\begin{verbatim}
## class: SingleCellExperiment 
## dim: 27998 1306127 
## metadata(0):
## assays(1): counts
## rownames: NULL
## rowData names(2): Ensembl Symbol
## colnames(1306127): AAACCTGAGATAGGAG-1 AAACCTGAGCGGCTTC-1 ...
##   TTTGTCAGTTAAAGTG-133 TTTGTCATCTGAAAGA-133
## colData names(4): Barcode Sequence Library Mouse
## reducedDimNames(0):
## spikeNames(0):
\end{verbatim}

\begin{minted}[frame=leftline]{r}
libSize <- colSums(assay(se)[, 1:1000])
range(libSize)
\end{minted}

\begin{verbatim}
## [1]  1453 34233
\end{verbatim}
}
\end{block}

\begin{block}<only@8>{}
\includegraphics[width=2cm]{limma.png}
\includegraphics[width=2cm]{DESeq2.png}
\bigskip
\par
\includegraphics[width=2cm]{edgeR.png}
\includegraphics[width=2cm]{scater.png}
\end{block}

\begin{block}<only@9>{}
\begin{itemize}
\item 1064 unique package maintainers
\item Web users by country:
\end{itemize}

\includegraphics[width=.6\textwidth]{web-users-country.png}
\end{block}
\end{column}
\end{columns}
\end{frame}


\begin{frame}[label={sec:orgheadline21}]{Bioconductor is built on shared infrastructure}
\includegraphics[width=8cm]{sticker-integration.pdf}
\end{frame}

\begin{frame}[label={sec:orgheadline22}]{Central data structures of Bioconductor}
\begin{columns}
\begin{column}{0.5\columnwidth}
\begin{block}{Data on genomic ranges}
\includegraphics[width=.9\linewidth]{karyogram.png}
\end{block}
\end{column}

\begin{column}{0.5\columnwidth}
\begin{block}{Summarized data}
\includegraphics[width=.9\linewidth]{summarized.jpg}
\end{block}
\end{column}
\end{columns}
\end{frame}

\begin{frame}[label={sec:orgheadline23}]{GRanges: data on genomic ranges}
\includegraphics[width=.9\linewidth]{granges.pdf}


\begin{center}
\begin{tabular}{lrrll}
seqnames & start & end & strand & \ldots{}\\
\hline
chr1 & 1 & 10 & + & \\
chr1 & 15 & 24 & - & \\
\end{tabular}
\end{center}

\begin{itemize}
\item Plus, sequence information (lengths, genome, etc)
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgheadline24}]{SummarizedExperiment: the central data model}
\includegraphics[width=.9\linewidth]{se.jpg}   
\end{frame}

\begin{frame}[label={sec:orgheadline25}]{Bioconducting the tweeted workflow}
\begin{block}<only@1>{}
\includegraphics[width=11cm]{tweet-pipeline.pdf}
\end{block}

\begin{block}<only@2>{}
\includegraphics[width=11cm]{tweet-pipeline-bioc.pdf}
\end{block}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline26}]{Bioconducting the pairwise Jaccard workflow}
 \begin{block}<only@1>{Define a function for the Jaccard statistic}
\begin{minted}[frame=leftline]{r}
jaccard <- function(x, y) {
    gr_x <- import(x)
    gr_y <- import(y)
    intersects <- intersect(gr_x, gr_y, ignore.strand=TRUE)
    unions <- union(gr_x, gr_y, ignore.strand=TRUE)
    sum(width(intersects)) / sum(width(unions))
}
\end{minted}
\end{block}

\begin{block}<only@2>{Compute the statistics in parallel}
\begin{minted}[frame=leftline]{r}
files <- Sys.glob("*.merge.bed")
jaccard_matrix <- outer(files, files, 
      function(a, b) mcmapply(jaccard, a, b))
\end{minted}
\end{block}

\begin{block}<only@3>{Make the plot}
\begin{minted}[frame=leftline]{r}
library(gplots)
library(RColorBrewer)
heatmap.2(jaccard_matrix, col = brewer.pal(9, "Blues"))
\end{minted}

\includegraphics[width=3cm]{heatmap.jpg}
\end{block}
\end{frame}

\begin{frame}[label={sec:orgheadline27}]{GenomicWidgets: interactive genomic plots for Shiny/RMD}
\framesubtitle{by Alicia Schep, Sarah Kummerfeld at Genentech}
\includegraphics[width=.9\linewidth]{genomic-widgets.jpg}
\end{frame}

\section{Usability}
\label{sec:orgheadline45}
\begin{frame}[label={sec:orgheadline29}]{The Ranges infrastructure is an incubator}
\includegraphics[width=.9\linewidth]{insights.pdf}
\begin{itemize}
\item Should be accessible to the average Bioconductor user
\end{itemize}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline30}]{Is the transition happening?}
 \begin{itemize}
\item From a typical package submission:
\begin{quote}
\texttt{Imports: checkmate, dplyr, ggplot2, tidyr}
\end{quote}
\item A typical initial response:
\includegraphics[width=10cm]{martin-comment.jpg}
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgheadline31}]{Aspects of software quality: the ilities}
\includegraphics<1>[width=8cm]{ilities.png}
\includegraphics<2>[width=8cm]{ilities-usability.png}
\end{frame}

\begin{frame}[label={sec:orgheadline32}]{Cognitive Dimensions of Notations}
\begin{itemize}
\item Thomas Green and Marian Petre (1996) proposed 14 dimensions of
usability in the context of visual programming
\item Many are interrelated and in balance with each other
\item Guide for evaluating usability and as a framework for discussing
interface design trade-offs
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgheadline33}]{Green's cognitive dimensions}
\begin{columns}
\begin{column}{0.5\columnwidth}
\begin{itemize}
\item \alert{Abstraction gradient}
\item \alert{Closeness of mapping}
\item Consistency
\item \alert{Diffuseness}
\item Error-proneness
\item \alert{Hard mental operations}
\item Hidden dependencies
\end{itemize}
\end{column}

\begin{column}{0.5\columnwidth}
\begin{itemize}
\item Provisionality
\item Premature commitment
\item Progressive evaluation
\item Role-expressiveness
\item Secondary notation
\item Viscosity (robustness)
\item \alert{Visibility}
\end{itemize}
\end{column}
\end{columns}
\end{frame}

\begin{frame}[label={sec:orgheadline34}]{Abstraction}
\begin{block}{Procedural abstraction}
A compound operation that enables the \alert{user} tell the computer
what to do without telling it how to do it.
\end{block}

\begin{block}{Data abstraction}
\begin{quote}
"A methodology that enables us to isolate how a compound data
object is \alert{used} from the details of how it is constructed from
more primitive data objects"
\end{quote}
Structure and Interpretation of Computer Programs (1979)
\end{block}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline35}]{In the absence of abstraction}
 \begin{itemize}
\item We often start with a BED file:
\begin{minted}[frame=leftline]{bash}
bash-3.2$  ls *.bed
\end{minted}
\begin{verbatim}
my.bed
\end{verbatim}

\item And we turn to R to analyze the data
\begin{minted}[frame=leftline]{r}
df <- read.table("my.bed", sep="\t")
colnames(df) <- c("chrom", "start", "end")
\end{minted}
\begin{verbatim}
  chrom     start       end
1  chr7 127471196 127472363
2  chr7 127472363 127473530
3  chr7 127473530 127474697
4  chr9 127474697 127475864
5  chr9 127475864 127477031
\end{verbatim}
\end{itemize}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline36}]{But file formats differ in important ways}
 Now for a GFF file:
\begin{minted}[frame=leftline]{r}
df <- read.table("my.bed", sep="\t")
colnames(df) <- c("chr", "start", "end")
\end{minted}

\begin{columns}
\end{columns}

\begin{columns}
\begin{column}{0.5\columnwidth}
\begin{block}{GFF}
\begin{verbatim}
   chr     start       end
1 chr7 127471197 127472363
2 chr7 127472364 127473530
3 chr7 127473531 127474697
4 chr9 127474698 127475864
5 chr9 127475865 127477031
\end{verbatim}
\end{block}
\end{column}

\begin{column}{0.5\columnwidth}
\begin{block}{BED}
\begin{verbatim}
  chrom     start       end
1  chr7 127471196 127472363
2  chr7 127472363 127473530
3  chr7 127473530 127474697
4  chr9 127474697 127475864
5  chr9 127475864 127477031
\end{verbatim}
\end{block}
\end{column}
\end{columns}
\end{frame}

\begin{frame}[label={sec:orgheadline37}]{Abstraction lets us focus on the important}
\includegraphics[width=.9\linewidth]{evolution.pdf}

\begin{itemize}
\item Abstraction is semantic enrichment
\begin{itemize}
\item Enables the user to think of data in terms of the problem domain
\item Hides implementation details
\item Unifies frameworks
\end{itemize}
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgheadline38}]{Semantic slack with adjectives}
\includegraphics[width=.9\linewidth]{mcols-bridge.pdf}

\begin{itemize}
\item Science defies rigidity: we define flexible objects that combine
strongly typed fields with arbitrary user-level metadata
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgheadline39}]{Diffuseness (vs expressiveness)}
\begin{itemize}
\item Relates to the information density of the code and how well it
communicates the \emph{intent} of the programmer
\item Enable the user to convey more meaning with less code
\item Terseness for its own sake makes code obscure, difficult to
unpack
\item For genomic data, we want the user to express computations in
terms of the biology
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgheadline40}]{Our workflow could be more expressive}
\begin{block}<only@1>{}
\includegraphics[width=11cm]{tweet-pipeline-just-bioc.pdf}
\end{block}

\begin{block}<only@2>{}
\includegraphics[width=11cm]{tweet-pipeline-expr.pdf}
\end{block}
\end{frame}

\begin{frame}[label={sec:orgheadline41}]{Hard mental operations}
How hard the user has to think about things other than the
motivating task
\end{frame}

\begin{frame}[label={sec:orgheadline42}]{Bioconductor is intrinsically complex}
\begin{block}<only@1>{}
\includegraphics[width=11cm]{tweet-pipeline-just-bioc.pdf}
\end{block}

\begin{block}<only@2>{}
\includegraphics[width=11cm]{tweet-pipeline-complex.pdf}
\end{block}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline43}]{Language complexity}
 \begin{itemize}
\item Bioconductor has large, complex APIs
\begin{minted}[frame=leftline]{r}
library(VariantAnnotation)
length(methods(class="GRanges"))
\end{minted}

\begin{verbatim}
[1] 278
\end{verbatim}

\item Bioconductor has large, complex class hierarchies
\begin{minted}[frame=leftline]{r}
pkgs <- package_dependencies("rtracklayer",
			     installed.packages())[[1L]]
pkgs <- setdiff(pkgs, c("methods", "XML", "RCurl"))
cl <- unlist(lapply(pkgs,
	     function(p) getClasses(getNamespace(p))))
length(cl)
\end{minted}

\begin{verbatim}
[1] 243
\end{verbatim}

\item In total, 2239 methods on 422 generics
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgheadline44}]{What needs to improve?}
\begin{itemize}
\item Education?
\item Documentation?
\item The software?
\item All of the above?
\end{itemize}
\end{frame}

\section{HelloRanges}
\label{sec:orgheadline49}
\begin{frame}[fragile,label={sec:orgheadline46}]{HelloRanges: an onramp to Bioconductor}
 \begin{itemize}
\item \texttt{bedtools} has a low barrier to entry but lacks the supporting
ecosystem to cleanly handle realistic workflows
\item We want to teach new users how to perform \texttt{bedtools}-style
operations within R/Bioconductor
\item HelloRanges compiles R code from \texttt{bedtools} invocations, so the
student can learn by:
\begin{itemize}
\item studying the output,
\item integrating it into the workflow,
\item and potentially customizing it
\end{itemize}
\item Output prompts the user to fill in details like the genome build
\item Supports all \texttt{bedtools} operations and arguments
\item Research goal: comparative analysis of \texttt{bedtools} and
Bioconductor
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgheadline47}]{HelloRanges exposes the complexity of Bioconductor}
\begin{block}<only@1>{}
\includegraphics[width=11cm]{tweet-pipeline-hello-ranges-zero.pdf}
\end{block}

\begin{block}<only@2->{}
\includegraphics[width=11cm]{tweet-pipeline-hello-ranges.pdf}
\end{block}

\begin{block}<3>{}
Data structures required:
\begin{itemize}
\item \emph{Seqinfo}
\item \emph{GAlignments}
\item \emph{GRanges}
\item \emph{RleList}
\item \emph{Pairs}
\end{itemize}
\end{block}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline48}]{Lesson learned}
 \begin{itemize}
\item Better onramps only help to a point
\item Simplifying the software would make everything easier
\item The \texttt{bedtools} approach of "everything is a BED file" motivates
the axiom:
\end{itemize}

\begin{block}{Everything is a GRanges (or SummarizedExperiment)}
Consolidating to a small number of data structures enables:
\begin{itemize}
\item comprehension,
\item endomorphism, and thus
\item fluency and chainability
\end{itemize}
\end{block}
\end{frame}

\section{plyranges}
\label{sec:orgheadline56}
\begin{frame}[label={sec:orgheadline50}]{Simplify, but keep the semantics}
\begin{quote}
It can scarcely be denied that the supreme goal of
all theory is to make the irreducible basic elements as simple and
as few as possible without having to surrender the adequate
representation of a single datum of experience. -- Albert Einstein
\end{quote}

\begin{quote}
Everything Should Be Made as Simple as Possible, But Not Simpler \\
-- Apocryphal Einstein quote, paraphasing above
\end{quote}
\end{frame}

\begin{frame}[fragile,label={sec:orgheadline51}]{Taking cues from the dplyr package}
 \begin{itemize}
\item dplyr is a API for tabular data manipulation
\item Inspired by relational algebra, SQL
\item Unified about a single, data model: the tibble
\item Operations are:
\begin{itemize}
\item Cohesive (do a single thing)
\item Endomorphic (return the same type as their input)
\item Verb-oriented in syntax
\end{itemize}
\item Fluency emerges from chaining of verbs
\end{itemize}

\begin{minted}[frame=leftline]{r}
genes %>%
    group_by(seqnames) %>%
    summarize(count_per_chr=n())
\end{minted}
\end{frame}

\begin{frame}[label={sec:orgheadline52}]{Goal}
Extend dplyr to genomics, a more complex problem domain, to achieve
the accessibility of bedtools
\end{frame}

\begin{frame}[label={sec:orgheadline53}]{plyranges}
\framesubtitle{https://github.com/sa-lee/plyranges}
\begin{itemize}
\item A dplyr-based API for computing on genomic ranges
\item Extending the relational algebra with genomic notions
\item Large set of visible verbs acting only on the core data structures:
\begin{description}
\item[{GRanges}] represents annotated genomic ranges
\item[{SummarizedExperiment}] coordinates experimental assay data
with sample and feature annotations
\end{description}
\item Collaboration with \alert{Stuart Lee} and Di Cook @ Monash
\end{itemize}
\end{frame}

\begin{frame}[label={sec:orgheadline54}]{plyranges is simple and expressive}
\begin{block}<only@1>{}
\includegraphics[width=11cm]{tweet-pipeline-plyranges-0.pdf}
\end{block}

\begin{block}<only@2>{}
\includegraphics[width=11cm]{tweet-pipeline-plyranges.pdf}
\end{block}

\begin{block}<only@3>{}
\includegraphics[width=11cm]{tweet-pipeline-hello-ranges-simple.pdf}
\end{block}

\begin{block}<only@4>{}
\includegraphics[width=11cm]{tweet-pipeline-hello-ranges-plyranges.pdf}
\end{block}
\end{frame}

\begin{frame}[label={sec:orgheadline55}]{The ever evolving Bioconductor}
\begin{block}<only@1>{}
\includegraphics[width=11cm]{symphony.pdf}
\end{block}

\begin{block}<only@2>{}
\includegraphics[width=11cm]{symphony-emerging.pdf}
\end{block}
\end{frame}
\end{document}