Why Computation?

BIOL 5/6800 — Intro to Comp Bio

Today’s objectives

  • Why computational biology?
  • Intro to Python & marimo notebooks
  • Exercise 4
    • Learning Python and notebooks

Why computational biology?

Origins of Comp Bio

  • 1952: Fred Sanger sequenced first protein (insulin)
  • Margaret Dayhoff & colleagues stored protein sequences in the Protein Information Resource (1960s & 70s)
  • 1960s: Dayhoff & others use computers to infer phylogenies

Picture of Margaret Dayhoff

Margaret Dayhoff

Phylogeny of eukaryotes

McLaughlin & Dayhoff 19731

Biology became a data science

  • One human genome: ~3.1 billion base pairs
  • One NovaSeq run: tens of billions of reads
  • GenBank, SRA, UniProt, PDB: petabytes, doubling every couple of years
  • Sequencing costs have fallen faster than computing has gotten cheaper

The bottleneck in modern biology is rarely generating data. It is deciding what to do with it.

Example 1 — Reading a genome you never see

You sequence a bacterial isolate and get back 4 million short reads, each ~150 bp, in random order, with errors.

The question: what is the genome?

The problem: this is a jigsaw puzzle with millions of pieces, no picture on the box, some pieces duplicated, and some pieces wrong.

Nobody solves this by hand. An assembly algorithm does — by building a graph of overlapping k-mers and finding a path through it.

Example 2 — Pathogen surveillance in real time

During SARS-CoV-2, sequences were deposited daily and phylogenies were rebuilt continuously to track which lineages were spreading where

That pipeline is a stack of algorithms:

  • align millions of genomes to a reference
  • infer a tree relating them
  • map the tree onto geography and time

If the tree takes six weeks to compute, the answer is useless. Speed is not a convenience here — it is the whole point.

The takeaway

A biological question becomes a computational question when we have to specify exactly how to get from data to answer.

Comp Bio is also a mindset

Diagram of transcription factor binding DNA to initiate transcription

Biology: GATGAG sequence is necessary and sufficient to induce expression

Comp Bio:

  • What is probability of TF binding given GATGAG?
    • \(P\)(TF binding | GATGAG)
  • What is the probability of gene expression?
    • \(P\)( expression | GATGAG & TF)

Biology isn’t black & white: Think probabilistically using models!

Intro to Python

What is Python?

It’s a programming language that is
  • Interpreted
  • Largely procedural, but flexible
  • Terse and clear
    • “Pseudocode that works”
  • Comes with standard libraries for interacting with the OS
  • Diverse, stable libraries for work across many domains
  • Industry standard in many fields: Machine learning, data science

What is a Python notebook?

  • An interactive web-based document that allows you to combine runnable Python code, formatted text, and visualizations in one place.
  • Composed of modular building blocks called “cells”
    • Instead of running a whole script of Python code, snippets of code in each cell run individually

Types of cells

Code (Python) cells
Snippets of Python code that run individually; output of code appears underneath the cell
Markdown cells:
Formatted text and images created using Markdown syntax; used to explain/document the code

What is marimo?

  • One type of Python notebook
  • Jupyter is another type that is more popular

So, why marimo?

Why marimo?

IMHO, marimo solved two big problems with other types of notebooks:

  • Results can vary depending on the order cells are run
    • marimo solves this by being “reactive”
  • The plain text files of other notebooks are illegible (nested in JSON syntax)
    • marimo is pure Python

What is molab?

  • A free, cloud-hosted workspace for running marimo Python notebooks
  • The name is a play on Google colab, a popular service for Jypyter notebooks
  • It will be our primary means of practicing comp bio

Ten simple rules

For biologists learning to program1

  1. Begin with the end in mind
  2. Baby steps are steps
  3. Immersion is the best learning tool
  4. Phone a friend
  5. Learn how to ask questions

Ten simple rules

For biologists learning to program1

  1. Don’t reinvent the wheel
  2. Develop good habits early on
  3. Practice makes perfect
  4. Teach yourself
  5. Just do it

Exercise 4

Intro to Python & marimo

We are transitioning to marimo Python notebooks in molab as our primary environment for learning comp bio

The class website (aub.ie/icb) has instructions for Python notebook exercises:

  1. Go to molab and make sure you’re logged in
  2. Click the notebook link on the class website
  3. Click the “Fork” button

References

Carey, Maureen A., and Jason A. Papin. 2018. “Ten Simple Rules for Biologists Learning to Program.” PLOS Computational Biology 14 (1): 1–11. https://doi.org/10.1371/journal.pcbi.1005871.
McLaughlin, P. J., and M. O. Dayhoff. 1973. “Eukaryote Evolution: A View Based on Cytochrome c Sequence Data.” Journal of Molecular Evolution 2 (2): 99–116. https://doi.org/10.1007/BF01653990.