Bioconductor for genome-scale data -- quick intro

The R language and its packages and repositories

This course assumes a good working knowledge of the R language.
The Rstudio environment is recommended. If you are jumping
directly to 5x, skipping 1x-4x, and want to
work through a tutorial before proceeding,
Try R is very comprehensive.

Why R?

R is used by many statisticians and biostatisticians to create algorithms that advance our ability to understand complex experimental data.

R is highly interoperable, and fosters reuse of software components written in other languages.

R is portable to the key operating systems running on commodity computing equipment (Linux, MacOSX, Windows) and can be used immediately by beginners with access to any of these platforms.

In summary, R’s ease-of-use and central role in statistics and “data science” make it a natural choice for a tool-set for use by biologists and statisticians confronting genome-scale experimental data. Since the Bioconductor project’s inception in 2001, it has kept pace with growing volumes
and complexity of data emerging in genome-scale biology.

Functional object-oriented programming

In functional programming, notation and program activity mimic the
concept of function in mathematics. For example

square = function(x) x^2

is valid R code that defines the symbol square as a function that
computes the second power of its input. The body of the function
is the program code x^2, in which x is a “free variable”.
Once square has been defined in this way, square(3) has
value 9. We say the square function has been evaluated on
argument 3. In R, all computations proceed by evaluation of functions.

In object-oriented programming, a strong focus is placed upon
formalizing data structure, and defining methods that take
advantage of guarantees established through the formalism. This
approach is quite natural but did not get well-established in
practical computer programming until the 1990s. As an
advanced example with Bioconductor, we will consider an
approach to defining an “object” representing on the genome
of Homo sapiens:

We say that Homo.sapiens is an instance of the OrganismDbclass. Every instance of this class will respond meaningfully
to the methods
listed above. Each method is implemented as an R function.
What the function does depends upon the class of its arguments.
Of special note at this juncture are the methods
genes, exons, transcripts which will yield information about
fundamental components of genomes.
These methods will succeed for human and
for other model organisms such as Mus musculus, S. cerevisiae,
C. elegans, and others for which the Bioconductor project and its contributors have defined OrganismDb representations.

R packages, modularity, continuous integration

This section can be skipped on a first reading.

Package structure

We can perform object-oriented functional programming with R
by writing R code. A basic approach is to create “scripts” that
define all the steps underlying processes of data import and
analysis. When scripts are written in such a way that they
only define functions and data structures, it becomes possible to
package them for convenient distribution to other users
confronting similar data management and data analysis problems.

The R software packaging protocol specifies how source code in R and other languages can be organized together with metadata and documentation to foster
convenient testing and redistribution. For example, an early
version of the package defining this document had the folder
layout given below:

The packaging protocol document “Writing R Extensions” provides
full details. The R command R CMD build [foldername] will operate on the
contents of a package folder to create an archive that can
be added to an R installation using R CMD INSTALL [archivename].
The R studio system performs these tasks with GUI elements.

Modularity and formal interdependence of packages

The packaging protocol helps us to isolate software that
performs a limited set of operations, and to
identify the version of a program collection
that is inherently changing over time. There is
no objective way to determine whether
a set of operations is the right size for packaging.
Some very useful packages carry out only a small number of
tasks, while others have very broad scope. What is important
is that the package concept permits modularization of
software. This is important in two dimensions: scope and time.
Modularization of scope is important to allow parallel independent
development of software tools that address distinct problems.
Modularization in time is important to allow identification of
versions of software whose behavior is stable.

The figure below is a snapshot of the build report for the development branch of Bioconductor.

The six-column subtable in the upper half of the display
includes a column “Installed pkgs”, with entry 1857 for
the linux platform. This number varies between platforms
and is generally increasing over time for the devel branch.

Putting it together

Bioconductor’s core developer group works hard to develop
data structures that allow users to work conveniently with
genomes and genome-scale data. Structures are devised to
support the main phases of experimentation in genome scale biology:

Parse large-scale assay data as produced by microarray or sequencer flow-cell scanners.

Preprocess the (relatively) raw data to support reliable statistical interpretation.

Combine assay quantifications with sample-level data to test hypotheses about relationships between molecular processes and organism-level characteristics such as growth, disease state.

In this course we will review the objects and functions that
you can use to perform these and related tasks in your own
research.

Basic premise and overview of 5x

You know to manipulate and analyze data using R, and
you understand a considerable amount about statistical modeling.
The Bioconductor project demonstrates that R is an effective
vehicle for performing many – but not all – tasks that
arise in genome-scale computational biology.

Some of the fundamental concepts that distinguish Bioconductor from other
software systems addressing genome-scale data are

commitment to interoperable structures for genomic annotation, from nucleotide to population scale;

continuous integration discipline for release and development cycles, withdaily testing on multiple widely used compute platforms.
The purpose of this four-week module is to build appreciation for and
expertise in the use of this system for many aspects of genome scale
data analysis.

This module, 525.5x, breaks into four main pieces, with one week
devoted to each of

Motivation and techniques: what we measure and why, and how we manage the measurements with R

Genomic annotation, with particular attention to the role of ranges in genomic coordinates in identifying genomic structures

Subsections of this chapter will sketch the concepts to
be covered, along with some illustrative computations.

Motivation and techniques

The videos in “What we measure and why” provide schematic
illustrations of the basic biological processes that can now
be studied computationally. We noted that recipes for
all the proteins that are
fundamental to life processes of an organism are coded
in the organism’s genomic DNA. Studies of differences
between organisms, and certain changes within organisms (for
example, development of tumors), often rely on computations involving
genomic DNA sequence.

Bioconductor provides tools for working
directly with genomic DNA sequence for many organisms.
One basic approach uses computations on a “reference sequence”,
another focuses on differences between the genomic sequence
of a given individual, and the reference.

Reference sequence access

It is very easy to use Bioconductor to work with the
reference sequence for Homo sapiens.
Here we’ll have a look at chromosome 17.

the name of the package indicates the curating source (UCSC) and reference version (hg19)

familiar R syntax $ for selecting a list element is reused to select a chromosome

Representing DNA variants

A standard representation for individual departures from reference sequence
is Variant Call Format.
The VariantAnnotation package includes an example. We have two
high-level representations of some DNA variants – a summary of the
VCF content in the example, and the genomic addresses of
the sequence variants themselves.

the example data are “built-in” to the package, for illustration and testing

the variable vcf has a concise display to the user

the variant locations, extracted using rowRanges, are shown with a tag indicating their context in the hg19 reference build

Measures of gene expression

We’ll conclude this brief discussion of motivation and technique
with a look at measurements on gene expression in the model
organism Sacchomyces cerevisiae, baker’s yeast. A highly influential
experiment undertook to use genome-wide measurement of mRNA abundance
over a series of time points in the reproductive cycle. Again
we use an R package to manage the data, and we use a special
Bioconductor-defined data structure to provide access to
information about the experiment and the results.

After a bit of massaging, a topic on which you will become expert
in the next few weeks, we can visualize the time course of a
cell-cycle regulated gene.

Of note:

Informative metadata about the experiment are bound right to the data (pubmed ID and abstract accessible through experimentData)

Simple syntax can be used to select components of complex experimental designs; in this case spYCCES[, spYCCES$syncmeth=="alpha"] picks out just the colonies whose cell cycling was controlled using alpha pheromone

R’s plotting tools support general plot annotation and enhancement

Statistical modeling tools to help distinguish cycling and non-cycling genes can be used immediately

Wrap-up

You’re about to engage with a few high-level lectures on genome
structures and molecular biological techniques for measuring them.
As you encounter these concepts, keep in mind what sorts of computations
you consider relevant to understanding the structures and processes
being studied. Find the tools to perform these
computations in Bioconductor, and become expert in their
use. And if you don’t find them, let us know, and perhaps we
can point them out, or, if they don’t exist, build them together.