Harvard:Biophysics 101/2007/02/06

From OpenWetWare
Revision as of 09:31, 8 February 2007 by ShawnDouglas (talk | contribs) (Tasks to complete by Feb 8)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Biophysics 101: Genomics, Computing, and Economics


Home        People        Schedule        Project        Python        Help       


  • Q1: "When I'm editing a page on the wiki, is there any way to do it in a box that is bigger than the single-line tiny editing box that comes up at first?"
  • A1: Visit the my preferences link in the upper right-hand corner of the page. Under the "Editing" tab, set Rows: 25, Columns: 80.
  • Q2: "How do I install BioPython on OS X?"
  • A2: The Python page has been updated with more detailed instructions.
  • Q3: "I've installed Python and can see programs like "Build Applet", "IDLE", and "Launcher". How do I actually run a Python script?
  • A3: The simplest route is probably to use IDLE, or the Python ""Integrated DeveLopment Environment". A nice intro for complete beginners can be found here. Full documentation is here.
  • Q4: "Can I edit Python scripts in [some editor]?"
  • A4: IDLE comes with a built-in editor. However, you can use pretty much any editor you want. Just make sure you are saving your files as plain text (as opposed to rtf or doc). Here is a list of editors that are known to be compatible with Python. I use an OS X editor called TextMate which costs money but has amazing features and shortcuts (see screencasts 1 and 2).

Tasks to complete by Feb 8

  • Complete Feb 1 tasks
  • Write a python script that generates 10,000 strings of 10 random coinflips (H or T) and outputs the tally of continguous (overlapping) stretches of 2, 3, 4, 5, 6, 7, 8, 9, and 10 H's or T's in that set of 10,000 10-mers.
  • Post your code to your personal calendar entry for Feb 8, along with the output when it is run.
  • Hints
    • The assignment calls for processing 10,000 strings. For easier debugging, you can initially write your code to process a smaller number.
    • You may find it useful to read about the random module, specifically "choice()"
    • You can reuse a modified version of substring the matching "Method 2" from the first assignment
    • If you have programming experience, try to do the exercise on your own
    • If you have no idea where to start, you can look at this template.
  • General
    • If you are feeling really lost,check out the Beginner's Guide to Python for more gentle introductions than we've provided so far. It includes tutorials especially for non-programmers, like this one.
    • Try to read the Python tutorial. Specifically, chapters 3 and 4.
    • Practice trying out different things that you do not understand.
    • Modify code and see if it does what you expect.
    • Use lots of print statements.
    • The range() Function is covered in chapter 4
    • List comprehensions and loops are covered in chapter 5
    • Spice up your I/O code by reading chapter 7