A computational perspective on the exploration and analysis of genomic and genome-scale information. Provides an integrated introduction to genome biology, algorithm design and analysis, and probabilistic and statistical modeling. Topics include genome sequencing, genome sequence assembly, read mapping, local and global sequence alignment, sequence database search, gene finding, phylogenetic tree construction, and elementary gene expression analysis. Methods include dynamic programming, indexing, hidden Markov models, and elementary supervised machine learning. Focuses on foundational algorithmic principles. Development of practical experience with handling, analyzing, and visualizing genomic data using the computer language Python.
The course requires students to program often in Python. Students coming in to the course must already know how to program in some computer language, but it need not be Python. If it is not Python, students will be expected to come quickly up to speed in Python on their own. Additionally, students should be comfortable with mathematical thinking and formulas, and should have had some exposure to basic probability as well as molecular or cellular biology; however, the course has no formal course prerequisites, and quick refreshers of relevant background will be provided. Please speak to the instructor if you are unsure about your background. This course is a valid elective in both biology and computer science.
Professor Alex Hartemink
|Derrick Adam, TA||
Email: derrick.adam at duke.edu
|Kyle Pinheiro, TA||
Email: kyle.pinheiro at duke.edu
|Nhat Duong, TA||
Email: nhat.duong at duke.edu
|Abbey List, UTA||
Email: abbey.list at duke.edu
|Andrew Lee, UTA||
Email: andrew.j.lee at duke.edu
|Angela Yoon, UTA||
Email: angela.yoon at duke.edu
|Bianca Saputra, UTA||
Email: bianca.saputra at duke.edu
|Caleb Watson, UTA||
Email: caleb.watson at duke.edu
|Cynthia Wang, UTA||
Email: cynthia.wang2 at duke.edu
|Jake Spruance, UTA||
Email: jacob.spruance at duke.edu
|Kash Sreeram, UTA||
Email: kashyap.sreeram at duke.edu
|Matthew Lee, UTA||
Email: matthew.h.lee at duke.edu
|Vin Somasundaram, UTA||
Email: vineethsubbu.somasundaram at duke.edu
Office hours with TAs and UTAs will be held at the following times, starting on Thursday 13 January; most days of the week have either two or three sessions available, with the exceptions of Tuesday (no sessions) and Wednesday (one session). We have arranged for a balanced mix of online sessions (which will be conducted over Zoom) and in-person sessions (which will take place in Perkins Link Group Study 8: PLGS8). Note that in accordance with current university guidance about remote learning at the start of the semester, all office hours from 13–17 January will be conducted over Zoom; any in-person session listed below will start to be held in-person on 18 January.
Directions for how to access office hours over Zoom will be posted on Ed. Remember that you will get help quickest by asking your questions on Ed (in fact, your question may already be answered there).
If you would like to speak with the instructor about anything, you are welcome to stick around after lecture to chat, or you can send an email to schedule a meeting at a time that is convenient for you.
The class meets on Tuesdays and Thursdays 10:15–11:30AM in 111 BioSci. Duke has announced that class sessions before January 18 will be virtual. These and any other virtual sessions will be held over Zoom. The Zoom link can be found on the COMPSCI 260 site within Sakai.
Note: The course schedule may change subtly from time to time. Always check the web page for the most up-to-date schedule.
|1||Thu 06 Jan||AH||Course introduction; SARS-CoV-2 genome introduction||PS0 out|
|2||Tue 11 Jan||AH||Molecular biology primer: DNA, RNA, and protein|
|3||Thu 13 Jan||AH||Gene/genome organization; SARS-CoV-2 genome revisited||PS0 due; PS1 out|
|4||Tue 18 Jan||AH||Algorithm introduction; Time and space resources|
|5||Thu 20 Jan||AH||Analyzing algorithms; Designing efficient algorithms|
|6||Tue 25 Jan||AH||Divide-and-conquer introduction and exploration||PS1 due; PS2 out|
|7||Thu 27 Jan||AH||Divide-and-conquer fails; Memoization|
|8||Tue 01 Feb||AH||Dynamic programming; DNA sequencing||PS2 due; PS3 out|
|9||Thu 03 Feb||AH||Genome assembly; Human Genome Project (HGP)|
|10||Tue 08 Feb||AH||HGP and Celera; Short-read mapping; Prefix trees||PS3 due|
|11||Thu 10 Feb||AH||Suffix trees and arrays; BWT||PS4 out|
|12||Tue 15 Feb||AH||FM-index: Introduction and details|
|13||Thu 17 Feb||AH||Sequence variation and alignment; Global alignment|
|14||Tue 22 Feb||AH||Global alignment and traceback; Affine gap penalties||PS4 due; PS5 out|
|15||Thu 24 Feb||AH||Affine gap alignment and traceback; Local alignment intro|
|16||Tue 01 Mar||AH||Local alignment and traceback; FASTA and BLAST heuristics||PS5 due|
|17||Thu 03 Mar||AH||Phylogenetic trees; Time and distance||PS6 out|
|Tue 08 Mar||SPRING BREAK — enjoy!|
|Thu 10 Mar||SPRING BREAK — enjoy!|
|18||Tue 15 Mar||AH||Building phylogenetic trees with UPGMA|
|19||Thu 17 Mar||AH||Building phylogenetic trees with NJ; Random variables|
|20||Tue 22 Mar||AH||Probability; Discrete and continuous; Joint, marginal, conditional||PS6 due; PS7 out|
|21||Thu 24 Mar||AH||Bayes Rule; Models; Parameter estimation: ML, MAP, PME|
|22||Tue 29 Mar||AH||Factoring; Graphical models; Markov models||PS7 due; PS8 out|
|23||Thu 31 Mar||AH||Hidden Markov models|
|24||Tue 05 Apr||AH||Viterbi decoding and traceback||PS8 due; PS9 out|
|25||Thu 07 Apr||AH||Posterior decoding and traceback|
|26||Tue 12 Apr||AH||Estimating HMM parameters; Baum-Welch; GENSCAN||PS9 due; PS10 out|
|27||Thu 14 Apr||AH||GENSCAN; Profile HMMs and other HMM extensions|
|28||Tue 19 Apr||AH||Course summary; Open time for questions||PS10 due|
AH: Alex Hartemink
An overview of the DFS and BFS algorithms for visiting the nodes of a graph.
The example presented in class illustrating the Burrows-Wheeler Transform (BWT) of a short genomic text, and relating that to the simplest version of a suffix array, as well as to the beginnings of the FM-index data structure.
A careful description of the algorithm for finding the closest pair of points in O(n log n) time. This is from the 2nd edition of “Introduction to Algorithms” (fondly known as CLRS).
If you'd like to learn a bit more about sorting—how different algorithms work and how they compare in practical terms for specific kinds of inputs—check out this cool demo site. Also, here are some fun videos: quickly visualizing the execution of 15 sorting algorithms and a Hungarian folk dance version of bubble sort (if you can't get enough of that, there are many more).
The recurrence relations that arise in analyzing divide-and-conquer algorithms commonly take on a certain form in which the running time for a problem of size n can be expressed in terms of the running time of a copies of a problem that is b times smaller (i.e., size n/b), plus some extra work (which might depend on n). In such cases, a powerful master theorem can help you solve just such a recurrence.
Here are the two videos I showed in class illustrating replication, transcription, and translation if you want to rewatch them:
All the PDF slides, Python exercises, and solutions we provided during the Python tutorials, Parts 1 and 2, are available for download on Sakai.
Here are a few different kinds of resources for those with less biology background, ranging from the comprehensive to a basic overview:
Please note that none of these books is required for the class (or even used in the class!), but I include this list because some students may benefit from having one or more of them to which to refer, whether during the semester or in the future. Each of the books summarized here is linked to Amazon where you can read more (these are not affiliate links). As for books that can serve as Python references, many resources can be found for free online, even complete textbooks downloadable as PDFs (you'll save trees that way (unless you print them)).
In this class, we will write all our code using Python 3.9, the latest version of which can be downloaded free for any OS from Anaconda. Anaconda (or its minimalist cousin Miniconda) sets up Python in a special environment to prevent it from conflicting with other versions of Python you may have installed. It includes a command-line tool called conda for managing Python environments and adding new packages (though we will not be using any extra packages in this course).
We encourage everyone to develop their Python code using the PyCharm IDE from JetBrains, which is free for educational use (even the Professional Version). We provide clear directions for setting up the PyCharm IDE, and can offer assistance for students that use it, but if you prefer to develop your code using another IDE, you are free to go your own way.
Complete directions for setting all this up can be found here.
Once you have set up a Python 3.9 environment, and have the PyCharm IDE configured to use it, you are ready to complete a “toy” problem set, which we call PS0. This will familiarize you with how course problem sets are structured, and will confirm that you are ready to download problem sets, write Python code, and submit your work to Gradescope. Completing PS0 on time is worth 3% of your final course grade.
All problem sets will be available within the Resources section of Sakai and their release will be announced on Ed, so to work on PS0, be sure to configure access to Ed and then look for the post announcing its release.
When you are ready to submit a problem set, you will do so directly to our course Gradescope site.
All students are expected to abide by standards of academic integrity. This includes all the various aspects of Duke's Community Standard. In particular, be reminded that it is not acceptable to take the ideas/work of another and represent it as one's own, even if paraphrased. Ideas/work taken from others—including Internet sources, peers in the class, peers from outside the class—must always be appropriately cited.
Violations of academic integrity will be taken very seriously. At a minimum, assignments in which a student either receives inappropriate input from others or provides inappropriate input to others will be graded as 0. In addition, all violations will be communicated to the Dean who directs the Office of Student Conduct.
Unless expressly granted otherwise, the entirety of every problem set should be completed individually; no collaboration is permitted, nor is access to solutions or another student's work. If you have worked for a while on a particular problem and have encountered a mental wall, and if you have banged your head against said wall for a while, please post a question on Ed, or speak to the instructor or TAs.
If for any reason you consult your peers outside of Ed, such an interaction must be one of consultation and not collaboration: clarification of general concepts is fine, but nothing specific about the answer should be communicated, and afterward, it is expected that you should still have plenty of thinking to do. In addition, if you do happen to consult with another student, both of you must cite this.
Note that posting your work or our course materials, especially our solutions, onto a repository accessible to other students—whether a publicly accessible one like GitHub or a less public one nevertheless accessible to other students, now or in the future—is a violation of the collaboration policy (and copyright law). Be considerate to other students: don't post materials that might tempt others to violate the course collaboration policy and thereby their academic integrity..
You will generally have one week to work on each problem set (although in a few cases, we will give you an early start). All problem sets will be due on Tuesday evening at 5pm. If you turn in work after the 5pm deadline, there will be a late penalty amounting to 10% of the total number of available points if you are 0–12 hours late, and 20% if you are 12–24 hours late. No work will be graded if it is more than 24 hours late.
That said, this semester will be challenging for everyone in different ways and at different times, and in acknowledgement of that, we want to be flexible and accommodating. To that end, all students will have their two largest late penalties waived. Put another way, you may elect to turn in your work up to 24 hours late twice this semester without penalty.
We have designed problem sets in the class to permit you to explore the material, and to develop deeper understanding of the material through that exploration. I ask you to focus on the ideas and the learning rather than on the points and the credit; put another way, please adopt a perspective of working to satisfy your own expectations rather than working to satisfy the instructor's expectations.
That said, we still need to assign points and credit when evaluating work: this is unfortunately unavoidable. However, we have designed our approach to evaluating work to be consistent with the perspective of the previous paragraph; the approach is perhaps a little different from what you may be familiar with in other classes. Specifically, I have asked the graders to frame their grading in terms of ‘positive earning’ rather than ‘negative error’.
What do I mean by this? Well, a ‘negative error’ approach is one in which one assumes one's work will earn full credit unless there are mistakes present. Under such an approach, graders are negatively tasked with finding mistakes and errors, and taking away points for any they find.
I have inverted this by choosing to adopt a ‘positive earning’ approach in which an empty problem set earns no points, and students earn more points as they demonstrate deeper levels of mastery of the material and challenge. Under such an approach, graders are instead positively tasked with finding ways that students should earn credit for deeply engaging the material.
A corollary of the ‘negative error’ approach is that unless a student makes a mistake, they are entitled to the highest number of points possible. Conversely, a corollary of the ‘positive earning’ approach is that it is possible for a student to not make any mistakes yet still not earn the highest number of points possible. For example, this can happen if a student minimally engages the material, and while not making any mistakes, never demonstrates mastery or depth of understanding. Our ‘positive earning’ approach not only focuses on the positive instead of the negative, but it also leaves room to grant more credit to students who engage the material more deeply.
I write all this because if you find that you did a problem without making a mistake, but got only +3 when some other student may have gotten +4, it doesn't necessarily mean that something is wrong (though it might be). It could mean that there were some interesting ways to engage the problem you didn't explore that the other student did. An analogy might be from a video game like Mario Brothers: you can successfully rescue the princess but still not end up with the highest score because someone can score higher if they take the time to explore a pipe that leads in a new direction. Analogously, earning the highest number of points possible usually requires more than just ‘no mistakes’; it also requires demonstration of mastery and engagement. We use rubrics to apply these judgments consistently across the class, and the rubrics are not pre-determined: our rubrics adapt to give credit for new ways we see students engaging a problem.
Students will submit their problem set work directly to our course Gradescope site. After each assignment is graded, scores will be available to students within Gradescope. Once those are finalized in Gradescope, they will move into the gradebook on Sakai, where they will accumulate throughout the semester. Importantly, note that scores in Gradescope and Sakai do not take into account late penalties. Those are assessed at the end of the semester, after the largest two late penalties are waived (see above).
This class uses Ed for course announcements, communication, and discussion. The Ed system is catered to getting you help quickly and efficiently from classmates, the TAs, and the instructor. Rather than emailing questions to the teaching staff, please post your questions on Ed so everyone can provide responses, as well as benefit from those responses.
Posting a question to Ed is the fastest way to get help, and it's also the most efficient way for us to provide help, because if two people have the same question, we only need to answer it once. On that note, don't forget to do a quick keyword search to see if your question has already been answered before posting it: the fastest answer is the one that's already there!
To enroll yourself in the Ed site for this class, you will first need to log in to the COMPSCI 260 site on Sakai. Once in Sakai, you should select Ed from the menu on the left: You will be taken to Ed in a new tab and prompted to log in there (or create a new Ed account if you do not yet have one).
Once you have enrolled yourself in the Ed site by accessing it via Sakai, you no longer need to go through Sakai to access it in the future. You can instead visit our Ed class discussion board directly.
This is an optional challenge for students interested in applying what we have learned in class to a real computational genomics research problem; practicing the skills of using Python or R (or any other tool you wish) to visualize, analyze, model, and interpret real genomic data; and exploring the science linking chromatin structure and transcriptional regulation. Since this problem represents an open challenge for the genomics community, you are free to choose the approaches you use to analyze the data, as well as the questions you explore. Creative projects are highly encouraged. You may work in small teams (2-3 is ideal). For all submissions we receive by the deadline of 15 Dec 2022, we will provide feedback, and will also designate a best project as well as a most creative project. There will be (simple) prizes!
In this data expedition challenge, we will explore next-generation sequencing reads from MNase-seq experiments in yeast. The data was generated to detect genome-wide binding locations of various kinds of DNA-binding proteins. The MNase-seq data sets were collected at Duke as part of our ongoing computational genomic research collaboration with the lab of Prof. David MacAlpine in the Department of Pharmacology and Cancer Biology.
DNA-binding proteins, including nucleosomes and transcription factors (TFs), play essential roles in gene regulation, and their locations along the genome help give us clues about how genes are regulated. Recently, a new MNase-seq protocol was developed by the MacAlpine group at Duke in conjunction with the Henikoff group at the University of Washington.  The basic idea is that genomic locations not bound by proteins are accessible to micrococcal nuclease (MNase) and are therefore more sensitive to MNase digestion. Conversely, genomic locations bound by proteins are less sensitive to MNase digestion.
Consequently, if we sequence the ends of the fragments that remain after MNase digestion, and map the paired sequencing reads that arise, we should be able to see where MNase was able to digest/cut the genome, revealing something about the binding locations of DNA-binding proteins along the genome. It is important to note that the genome of each individual cell in a population may be in a slightly different occupancy/protection state. We collect data from a population of cells so this experiment is sampling the different protection states present in the cell population.
Complicating the issue further, MNase is also known to have a nucleotide-specific bias as it digests DNA, meaning that it tends to cleave/digest certain sequences more than others. For example, it prefers to digest A/T nucleotides compared to G/C (its bias is actually a bit more subtle/complex than that, which is a nice model selection challenge you can explore: what is the simplest model that captures well this bias?). To give you further information about this sequence bias, we are also providing MNase digestion data of naked (deproteinized) DNA in vitro which will allow for the development of models to quantify such bias (because with this data, the variation in cutting that you see is only the result of the MNase interacting with the naked DNA and is not influenced by protein protection).
Usually, sequencing reads are stored in files of fastq format. In this case, we downloaded two large yeast MNase-seq read fastq files: in vivo yeast MNase-seq read files generated by Henikoff et al. , and in vitro yeast MNase-seq read files generated by Deniz et al.  for use in quantifying MNase digestion bias. Both files contain short sequencing reads, of length 25 and 54 base pairs, respectively. The total number of reads in each file is on the order of 100 million. For reference, the yeast genome contains 16 chromosomes whose total size is approximately 12.5 million base pairs.
To analyze those sequencing reads, you would typically first need to map the reads to a reference genome, using tools like BOWTIE. However, to simplify this challenge, we have already performed this mapping step for you. We are thus providing you one tab-delimited text file for each of the first 12 yeast chromosomes, named with ChrI to ChrXII (yeast geneticists like Roman numerals); we will reserve the remaining 4 yeast chromosomes to evaluate your submitted results. Each file contains the start and end genome coordinates of all the reads mapped to that chromosome, one read per line. You may notice that the distances between the start and end coordinates are larger than 25 or 54 base pairs. That is because the MNase-seq experiments produce paired-end reads and we are indicating the coordinates of the spanned fragment from which the two reads come. So the provided coordinates are the start coordinate of one read, along with the start coordinate of its mated read on the opposite strand; or, put another way, the first and last nucleotide of the fragment.
It is reasonable to think of the start and end coordinates as nucleotides just beyond which MNase cleaved the DNA, while the sequence between the start and end coordinates was not digested by MNase. We also provide the whole yeast genome sequence (sacCer2 2008 version, in separate fasta files) if you wish to extract the actual sequence around the cleavage sites based on the provided coordinates.
All data files for this challenge are available from:
You will need to do some independent exploration to figure out what to do next. You may want to read more about the MNase enzyme and how it works, or what is known about it. You probably want to get more info about the MNase-seq protocol, as described in the original paper.  Then you can start exploring one or multiple of the following, depending on what suits your fancy, or you may have other ideas of your own:
Good luck, and have fun on this expedition!