Posts Tagged ‘script’

Applied Programming: Course plan

Thursday, September 25th, 2008

Søren and I spent this afternoon planning our upcoming course, Applied Programming (essentially a Python programming class with focus on bioinformatics applications).  See my previous thoughts on the class here and here.

Course plan

The class runs for seven weeks, and this is the plan we came up with is listed below.  There is eight weeks there, since the first and last week are really half-weeks.

Week 1: Introduction to Python

One lecture:

  • Logging into the department’s computers and running Python there (plus how to use Idle).
  • Installing Python on your own computer.
  • Interactive Python sessions
    • expressions
    • comparisons
    • assignments
    • multiple-assignments
  • Using help() to learn more
  • built-in data types
  • scripts in files (and how to execute them)

Week 2: Control structures

First lecture:

  • branching
  • looping
  • indentation

Second lecture:

  • functions
  • (list comprehension)
  • generators
  • exceptions

Hand-in exercise:

  • Locate ORFs in a string
  • Translate them into proteins
  • Calculate frequencies of AA

Week 3: Parsing

First lecture:

  • files and IO
  • string operations

Second lecture:

  • regular expressions

Hand-in exercise:

  • parse table of genes (GFF)
  • parse sequences from FASTA
  • calculate AA frequencies

Week 4: Structuring code

First lecture:

  • modules
  • classes

Second lecture:

  • “Design by Contract”
  • Unit testing

Hand-in exercise:

  • write a class containing a multiple sequence alignment
  • add a method for iterating through the columns of the alignment
  • add a method to restrict to subset of species
  • add a method to slice the alignment
  • add a method to remove all-gaps columns

Week 5: BioPython

First lecture:

  • Introduction to BioPython (and Bio*)

Second lecture:

  • Sequences and sequence parsers
  • NCBI access
  • Blast

Hand-in exercise:

  • Read a list of human genes (or IDs) from a table
  • Download them from NCBI
  • Blast them against the mouse

Week 6: SciPy

First lecture:

  • Plotting using matplotlib (pylab)

Second lecture:

  • Fitting functions
  • Linear regression

Week 7: Go faster stripes (profiling and optimizing)

First lecture:

  • cProfile
  • Timing code-chunks

Second lecture:

  • Algorithmic complexity
  • “Big O” notation (and roughly how to figure it out)

Hand-in exercise:

  • Implement a program that builds a string by appending vs. using join()
  • Measure the running time on both solutions
  • plot and fit to O(n) and O(n2)

Week 8: Introducing the exam project

We still haven’t decided on the exam project, but it is a take-home exam where they will need to write a small program and then hand it in together with a short report.

Teaching material

We had a discussion about the teaching material.  We would really like to have a text book for this, but we have been looking for a while without finding one that fits our needs.

We also thought about using one of the many online introductions.  There are some pretty good ones.

Still, they are typically more or less at the tutorial level, and that we could just as easily write ourselves, and then get it exactly the way we want it.

I wrote my own lecture notes in previous classes (see e.g. here).  It is a lot of work, but it is nice to taylor it exactly to the needs of the class.

The downside is, of course, that the first time the class runs the notes will be pretty short and not proofread in sufficient detail.