BIO/CSC295 2011F, Class 03: Programming Bioinformatics Overview: * Reflections on the web exploration. * About algorithm design. * A sample algorithm. * More Python basics. * Lab: Project 1.4. * Reflection. Admin: * We have posted answers to your questions on the introductory survey. * We will soon post answers to your more administrative questions. * A note on Piazza. * For the next class, read Chapter 2 of Exploring Bioinformatics and bring questions. (You don't need to do the chapter 2 Web exploration yet, and you certainly don't need to understand all of the code.) * As you may have noted, we will use a different language in class than they use in the book. We will explore the differences in the lab and reflection. * EC: CS Extra today at 4:30 - HCI for Peace. * EC: Bio Grad School seminar Friday at noon. * No EC: Bio picnic! Signup going around. * No EC: Biochem picnic! On Monday. Signup on ChemDiscuss * No EC for the not-yet-scheduled Math/Stats/CS picnic. * Chase will hold a mentor session Sunday at 9pm and will have office hours Sunday and Wednesday nights. Time TBD. He will email you with information on where and exactly when. * About the dinosaur papers. * Deal. It's fun. What did you learn doing the Web exploration? * Many pages have more information than you can easily look at. You need to learn how to mentally filter. * There are a lot of databases out there that will do a lot of the work for you. * Efficiency in searching - An outline of techniques to try when you're looking for information. * You have not just data, but publications that use the data. * Navigating NCBI. * Multiple heads can help you figure out complex things * As can talking it out * The opportunity to act as an expert * More generally: You can learn by being an expert * Share! * There's a reason that Google makes so much money. Cool things about Favism. Why did Vida pick it? * Common allele - Yet many of us have not heard about it * Resistance to malaria * A tradeoff: While it has this benefit, it also has problems * Or vice versa Algorithms * What did you learn about what computer scientists do from reading section 1.4 (and the other stuff in chapter that deals with algorithms)? * Computer scientists start with problems, generalize the problems, and then write "algorithms" that "solve" the problem. * An algorithm is a sequence of steps that can depend on the input * An algorithm is typically used to "solve" a problem (achieve a goal) * An algorithm is like a recipe * We do lots of things with them * On the CS side of things * We will be designing algorithms * We will be representing those algorithms in a way that the computer can run them. An example (no programming, yet): * There are a group of people at the front of the room. * We want to put them in order of distance of their "home" to Grinnell. * The one with the closest home will be at the left side of the group * The one with the furthest home will be at the right side of the group * Each other person will be closer than the person on their right, and further than the person on their left The compute froze while Sam was talking. Sentient and Malicious. Sample algorithms * Tie your shoes * Complementary DNA strands Programming langauge Python * Use Wing 101 to run Python * Typical algorithm (function, procedure) def NAME(INPUTS): INSTRUCTIONS * Instructions we know * Assignment NAME = EXPRESSION def circleCircumference(r): c = 2 * math.pi * r * When you're done with an algorithm, you can use return to send back a value def circleCircumference(r): c = 2 * math.pi * r return c * Sequences are collections of values indexed by numbers from 0 to ... seq[5] = 'D' c = seq[0] + seq[1] * help(something) Today: New things * Conditionals "If TEST ..." if (TEST): CONSEQUENT else: ALTERNATE if (distance[0] > distance[1]): tmp = distance[0] distance[0] = distance[1] distance[1] = tmp$a * Repetition for NAME in SEQUENCE: ACTION for i in [1,2,3,4,5]: print i Lab! Reflection on the lab * Some of you need to read XKCD #792 http://xkcd.com/792/ Note: Sam uses LastPass to deal with this problem. It's free (except on your iPhone). * Testing of base_pair * Did you check things that are not bases? * Did you check lowercase? * Did you check things that are not characters? * Test of opposite_strand * Did you test lists that contained the things above? * Did you test strings? * Did you test things that aren't lists or strings? * A program you run vs. the interactions pane? * Perl vs. Python