Lectures

At the double lecture we will work on how to break down complicated probems into smaller problems that can be solved and tested seperately, and how these smaller bits are then combined to solve the larger problem.

At the single lecture we will look at list comprehensions. We will also look at what you do when your script does not behave the way you think it should — as you probably have noticed by now, this happens from time to time.

Computer exercises

Complete the Open Reading Frames exercise.

Reading material

Read this bit on list comprehensions.

Weekly assignment

Write a function, parseFasta(filename), that should read the file named filename. This file should contain multiple sequence entries in Fasta format and the function must parse this data and return a list of pairs of the form (header, sequence). Download this file and use as input.

This assignment can be solved in a lot of different ways — of varying complexity — so be inventive and after you have handed in your own assignment, have a look at what your friends have done to solve the problem.

Here is one approach: read the entire content of the file into a string using the read() method of the opened file. Then you can use the split() method to split the the string into a list of individual Fasta entries, and use splitlines() to split each of these into the individual lines of the Fasta entry. Then all that remains is to fish out the header line, concatenate the sequence lines and add the (header, sequence) pairs to a list.

Still, there are many other, and better, ways to do it.

Handing in

To hand in the assignment put the code in a file named after your self and the week. If it was me it would be Kasper_Munch_week5.py. Attach it to an email with subject "Assignment" and send it to asand@cs.au.dk before Wednesday at 10am.

Weekly evaluation

EvaluationWeek5

Index

Contact info

Office address:
Bioinformatics Research Centre (BiRC)
Aarhus University
C.F. Møllers Allé 8
DK-8000 Aarhus C
Denmark
Office phone:
+45 871 55558
Mobile phone:
3013 8342
Email:
kaspermunch@birc.au.dk