<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://teaching.healthtech.dtu.dk:443/22116/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=WikiSysop</id>
	<title>22116 - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://teaching.healthtech.dtu.dk:443/22116/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=WikiSysop"/>
	<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php/Special:Contributions/WikiSysop"/>
	<updated>2026-10-04T20:39:36Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Programme&amp;diff=353</id>
		<title>Programme</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Programme&amp;diff=353"/>
		<updated>2026-10-01T09:15:19Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;[[Collection of files]]&#039;&#039;&#039; &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;used in the exercises and lessons&amp;lt;/font&amp;gt; - all gathered here.&lt;br /&gt;
&lt;br /&gt;
* 31/08 Lesson 1: [[Python recap]]&lt;br /&gt;
* 07/09 Lesson 2: [[The path and simple file reading]]&lt;br /&gt;
* 14/09 Lesson 3: [[Pseudocode and comments]]&lt;br /&gt;
* 21/09 Lesson 4: [[String manipulation]]&lt;br /&gt;
* 28/09 Lesson 5: [[Exceptions and bug handling]]&lt;br /&gt;
* 05/10 Lesson 6: [[Stateful parsing]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 1. The evaluation is about the course, not you.&lt;br /&gt;
* Fall holidays&lt;br /&gt;
* 19/10 Lesson 7 [[List manipulation]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 2&lt;br /&gt;
* 26/10 Lesson 8: [[Functions]]&lt;br /&gt;
* 02/11 Lesson 9: [[Simple pattern matching]]&lt;br /&gt;
* 09/11 Lesson 10: [[Set techniques]]&lt;br /&gt;
* 16/11 Lesson 11: [[Dict techniques]]&lt;br /&gt;
* 23/11 Lesson 12: [[Regular expressions]]&lt;br /&gt;
* 30/11 Lesson 13: [[Python object model]]&lt;br /&gt;
* 09/12 Exam - [http://eksamensplan.dtu.dk/ the official DTU exam plan] [https://student.dtu.dk/eksamen/eksamensdatoer Exam dates]&lt;br /&gt;
&lt;br /&gt;
== Curious about the exam ==&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/index.php/How_the_course_is_conducted#Preparation_for_exam Read this]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=The_path_and_simple_file_reading&amp;diff=352</id>
		<title>The path and simple file reading</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=The_path_and_simple_file_reading&amp;diff=352"/>
		<updated>2026-09-07T12:41:41Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Python recap]]&lt;br /&gt;
|Next: [[Pseudocode and comments]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_02-PathFile.ppt The path &amp;amp; simple file reading]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - File Reading]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
The file system, folder hierarchies, the path &amp;amp; the library os.path&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;with&#039;&#039; statement, just a simple use of it.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;open&#039;&#039; and &#039;&#039;close&#039;&#039; function for opening and closing files for access. File handles.&amp;lt;br&amp;gt;&lt;br /&gt;
Reading and writing files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advice ==&lt;br /&gt;
You might want to consider what would happen if you feed an empty file to your program.&amp;lt;br&amp;gt;&lt;br /&gt;
Are you looking for files? See the top line of the [[Programme]] page.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
Again, any use of list is a fail. Why? Because it is overkill and too memory consuming for these kind of tasks. It is also good thinking practice.&lt;br /&gt;
&lt;br /&gt;
# Construct a program first asks for a file name and subsequently counts the number of lines in the input file, and displays the result. Try it with the file &#039;&#039;ex1.dat&#039;&#039;, which you have put in the same folder as the program. Then you just give the file name and not the full path. There are 1675 lines.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Have you wondered how the &#039;&#039;&#039;sum()&#039;&#039;&#039; function works? Wonder no longer. Make a Python program that sums numbers from ONE input file and displays the sum of the numbers. I have created 3 input files with the columns from &#039;&#039;ex1.dat&#039;&#039;; &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039;. Use the 3 files as input ONE AT A TIME and see the sums. The sums are approx. Col 1; -904.4143, Col 2; 482.8410, Col 3; 292.05150 for the three columns. BTW, the file name can be the full path or a relative path if the file is not in the same folder as the program.&amp;lt;br&amp;gt;To be clear, you do NOT use the sum function in this exercise - or the max in the next.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Did you also wonder about the &#039;&#039;&#039;max()&#039;&#039;&#039; function? Make a program that finds the maximum number in a file. Display the result. This is quite tricky. Hint: The &#039;&#039;&#039;None&#039;&#039;&#039; built-in no-value could be useful. The max in &#039;&#039;ex1_1.dat&#039;&#039; is 10.4155.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Ask for some input - it could be a word or a number or a sentence. Then ask for a file name - any file will do, but &#039;&#039;mixedlines.txt&#039;&#039; or &#039;&#039;ex5.acc&#039;&#039; are good. Now read the file and determine if one (or more) of the lines in the file matches your input precisely. Display &amp;quot;Match&amp;quot; or &amp;quot;No match&amp;quot; accordingly. Hint: A line from a file has a newline at the end, but using the &#039;&#039;&#039;input&#039;&#039;&#039; function does not result in this newline.&amp;lt;br&amp;gt;For extra difficulty, make the program only say &amp;quot;Match&amp;quot; or &amp;quot;No match&amp;quot; once, no matter how many matches there are. Make your own test file, with lots of the same number or word.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Move or copy &#039;&#039;mixedlines.txt&#039;&#039; to some other folder for testing with this program. You are not supposed to implement some kind of search file function, just use a relative or absolute path when you input the filename.&amp;lt;br&amp;gt;Write a program that asks for just a file name and then adds the full (or relative) path (stored in a variable like a constant) to the file name and then opens file and count the number of empty lines and non-empty lines in the file. Display the two counts. &amp;lt;br&amp;gt;Warning: Just because you can not see it, it does not mean it does not exists. Invisible characters have long been a curse of programmers. So do not make them yourself. Hint: &#039;&#039;mixedlines.txt&#039;&#039; has 19 empty lines and 66 non-empty lines.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Ask for a number - this is your target number. Now ask for a filename - &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good options. Open the file and compute two sums from the numbers in the file; the sum of the numbers that are higher than your target number and the sum of the numbers that are lower than your target number. Any number in the file that is equal to your target number is ignored. Display the result.&amp;lt;br&amp;gt;Using the file &#039;&#039;ex1_1.dat&#039;&#039; and the target number 0, the 2 sums are; -1523.1255 and 618.7112.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=The_path_and_simple_file_reading&amp;diff=351</id>
		<title>The path and simple file reading</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=The_path_and_simple_file_reading&amp;diff=351"/>
		<updated>2026-09-07T12:39:55Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Python recap]]&lt;br /&gt;
|Next: [[Pseudocode and comments]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_02-PathFile.ppt The path &amp;amp; simple file reading]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - File Reading]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
The file system, folder hierarchies, the path &amp;amp; the library os.path&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;with&#039;&#039; statement, just a simple use of it.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;open&#039;&#039; and &#039;&#039;close&#039;&#039; function for opening and closing files for access. File handles.&amp;lt;br&amp;gt;&lt;br /&gt;
Reading and writing files.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advice ==&lt;br /&gt;
You might want to consider what would happen if you feed an empty file to your program.&amp;lt;br&amp;gt;&lt;br /&gt;
Are you looking for files? See the top line of the [[Programme]] page.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
Again, any use of list is a fail. Why? Because it is overkill and too memory consuming for these kind of tasks. It is also good thinking practice.&lt;br /&gt;
&lt;br /&gt;
# Construct a program first asks for a file name and subsequently counts the number of lines in the input file, and displays the result. Try it with the file &#039;&#039;ex1.dat&#039;&#039;, which you have put in the same folder as the program. Then you just give the file name and not the full path. There are 1675 lines.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Have you wondered how the &#039;&#039;&#039;sum()&#039;&#039;&#039; function works? Wonder no longer. Make a Python program that sums numbers from ONE input file and displays the sum of the numbers. I have created 3 input files with the columns from &#039;&#039;ex1.dat&#039;&#039;; &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039;. Use the 3 files as input ONE AT A TIME and see the sums. The sums are approx. Col 1; -904.4143, Col 2; 482.8410, Col 3; 292.05150 for the three columns. BTW, the file name can be the full path or a relative path if the file is not in the same folder as the program.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Did you also wonder about the &#039;&#039;&#039;max()&#039;&#039;&#039; function? Make a program that finds the maximum number in a file. Display the result. This is quite tricky. Hint: The &#039;&#039;&#039;None&#039;&#039;&#039; built-in no-value could be useful. The max in &#039;&#039;ex1_1.dat&#039;&#039; is 10.4155.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Ask for some input - it could be a word or a number or a sentence. Then ask for a file name - any file will do, but &#039;&#039;mixedlines.txt&#039;&#039; or &#039;&#039;ex5.acc&#039;&#039; are good. Now read the file and determine if one (or more) of the lines in the file matches your input precisely. Display &amp;quot;Match&amp;quot; or &amp;quot;No match&amp;quot; accordingly. Hint: A line from a file has a newline at the end, but using the &#039;&#039;&#039;input&#039;&#039;&#039; function does not result in this newline.&amp;lt;br&amp;gt;For extra difficulty, make the program only say &amp;quot;Match&amp;quot; or &amp;quot;No match&amp;quot; once, no matter how many matches there are. Make your own test file, with lots of the same number or word.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Move or copy &#039;&#039;mixedlines.txt&#039;&#039; to some other folder for testing with this program. You are not supposed to implement some kind of search file function, just use a relative or absolute path when you inout the filename.&amp;lt;br&amp;gt;Write a program that asks for just a file name and then adds the full (or relative) path (stored in a variable like a constant) to the file name and then opens file and count the number of empty lines and non-empty lines in the file. Display the two counts. &amp;lt;br&amp;gt;Warning: Just because you can not see it, it does not mean it does not exists. Invisible characters have long been a curse of programmers. So do not make them yourself. Hint: &#039;&#039;mixedlines.txt&#039;&#039; has 19 empty lines and 66 non-empty lines.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Ask for a number - this is your target number. Now ask for a filename - &#039;&#039;ex1_1.dat&#039;&#039;, &#039;&#039;ex1_2.dat&#039;&#039; &amp;amp; &#039;&#039;ex1_3.dat&#039;&#039; are good options. Open the file and compute two sums from the numbers in the file; the sum of the numbers that are higher than your target number and the sum of the numbers that are lower than your target number. Any number in the file that is equal to your target number is ignored. Display the result.&amp;lt;br&amp;gt;Using the file &#039;&#039;ex1_1.dat&#039;&#039; and the target number 0, the 2 sums are; -1523.1255 and 618.7112.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Example_code_-_exam_form&amp;diff=350</id>
		<title>Example code - exam form</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Example_code_-_exam_form&amp;diff=350"/>
		<updated>2026-09-04T08:03:10Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;At this and the next lesson plus the exam, you will have to do the exercises differently. This is both an example and an explanation.&amp;lt;br&amp;gt;&lt;br /&gt;
How you will achieve it using your tools - VScode, Jupyter Notebook, text editor, WSL2, command line, etc - is your problem to solve.&lt;br /&gt;
&lt;br /&gt;
You get a number of assignments or exercises that you have to solve. In this example it is demonstrated with a single task.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Make a function that accepts two parameters; an input file name and and output filename. The input file contains one value per line, but the value might be anything, string, integer, float, positive or negative. The function must read the input file, discard any value that is not positive, and output the log of the non-discarded numbers to the output file.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You will as a template for your hand-in get a file that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python3&lt;br /&gt;
# Above is the shebang line - which tells which program should interpret the rest of the file&lt;br /&gt;
&lt;br /&gt;
# The libraries necessary for the exercises - use no other&lt;br /&gt;
import os, sys, re, math&lt;br /&gt;
&lt;br /&gt;
####################################################################################&lt;br /&gt;
# You must fill the functions with code that does the job mentioned.               #&lt;br /&gt;
# All the functions must work together coherently for the exercise to be complete. #&lt;br /&gt;
# The main exercise function should call the other functions in it&#039;s group.        #&lt;br /&gt;
# You can add your own functions, but you still need to make the ones described.   #&lt;br /&gt;
# Any personal functions should follow the naming pattern demonstrated.            #&lt;br /&gt;
# You are expected the delete the &amp;quot;pass&amp;quot; statements as they are present only for   #&lt;br /&gt;
# syntax reasons. The template won&#039;t run without them.                             #&lt;br /&gt;
####################################################################################&lt;br /&gt;
&lt;br /&gt;
################################&lt;br /&gt;
### FUNCTIONS FOR EXERCISE 1 ###&lt;br /&gt;
################################&lt;br /&gt;
&lt;br /&gt;
def exercise_1(filenamein:str, filenameout:str) -&amp;gt; None:&lt;br /&gt;
    # Read file, discards line with non-positive numbers, output the log&lt;br /&gt;
    pass&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
############################&lt;br /&gt;
# Main program starts here #&lt;br /&gt;
# Not necessary to change  #&lt;br /&gt;
############################&lt;br /&gt;
&lt;br /&gt;
# Below if statement allows you to execute the main code when the file runs as a script,&lt;br /&gt;
# but not when it is imported as a module.&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # First exercise&lt;br /&gt;
    exercise_1(&#039;values.txt&#039;, &#039;log_values.txt&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You should now fill out the code in the function &#039;&#039;exercise_1&#039;&#039; that accomplishes the task. You can add your own helper functions to use in &#039;&#039;exercise_1&#039;&#039;, if you want - call them &#039;&#039;ex1_myhelperfunctionname&#039;&#039;. Sometimes I have decided that you need helper functions (to clarify the task) and then they are just about the main exercise function using the same naming scheme.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python3&lt;br /&gt;
# Above is the shebang line - which tells which program should interpret the rest of the file&lt;br /&gt;
&lt;br /&gt;
# The libraries necessary for the exercises - use no other&lt;br /&gt;
import os, sys, re, math&lt;br /&gt;
&lt;br /&gt;
####################################################################################&lt;br /&gt;
# You must fill the functions with code that does the job mentioned.               #&lt;br /&gt;
# All the functions must work together coherently for the exercise to be complete. #&lt;br /&gt;
# The main exercise function should call the other functions in it&#039;s group.        #&lt;br /&gt;
# You can add your own functions, but you still need to make the ones described.   #&lt;br /&gt;
# Any personal functions should follow the naming pattern demonstrated.            #&lt;br /&gt;
# You are expected the delete the &amp;quot;pass&amp;quot; statements as they are present only for   #&lt;br /&gt;
# syntax reasons. The template won&#039;t run without them.                             #&lt;br /&gt;
####################################################################################&lt;br /&gt;
&lt;br /&gt;
################################&lt;br /&gt;
### FUNCTIONS FOR EXERCISE 1 ###&lt;br /&gt;
################################&lt;br /&gt;
&lt;br /&gt;
def exercise_1(filenamein:str, filenameout:str) -&amp;gt; None:&lt;br /&gt;
    # Read file, discards line with non-positive numbers, output the log&lt;br /&gt;
    infile = open(filenamein, &#039;r&#039;)&lt;br /&gt;
    outfile = open(filenameout, &#039;w&#039;)&lt;br /&gt;
    for line in infile:&lt;br /&gt;
        try:&lt;br /&gt;
            no = float(line)&lt;br /&gt;
        except:&lt;br /&gt;
            continue&lt;br /&gt;
        if no &amp;gt; 0:&lt;br /&gt;
            print(math.log(no), file=outfile)&lt;br /&gt;
    infile.close()&lt;br /&gt;
    outfile.close()&lt;br /&gt;
&lt;br /&gt;
############################&lt;br /&gt;
# Main program starts here #&lt;br /&gt;
# Not necessary to change  #&lt;br /&gt;
############################&lt;br /&gt;
&lt;br /&gt;
# Below if statement allows you to execute the main code when the file runs as a script,&lt;br /&gt;
# but not when it is imported as a module.&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # First exercise&lt;br /&gt;
    exercise_1(&#039;values.txt&#039;, &#039;log_values.txt&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
As you notice, only the &#039;&#039;exercise_1&#039;&#039; function was changed - nothing else in the template.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Example_code_-_exam_form&amp;diff=349</id>
		<title>Example code - exam form</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Example_code_-_exam_form&amp;diff=349"/>
		<updated>2026-09-03T08:45:08Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: Created page with &amp;quot;At this and the next lesson plus the exam, you will have to do the exercises differently. This is both an example and an explanation.&amp;lt;br&amp;gt; How you will achieve it using your tools - VScode, Jupyter Notebook, text editor, WSL2, command line, etc - is your problem to solve.  You get a number of assignments or exercises that you have to solve. In this example it is demonstrated with a single task.  Make a function that accepts two parameters; an input file name and and outpu...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;At this and the next lesson plus the exam, you will have to do the exercises differently. This is both an example and an explanation.&amp;lt;br&amp;gt;&lt;br /&gt;
How you will achieve it using your tools - VScode, Jupyter Notebook, text editor, WSL2, command line, etc - is your problem to solve.&lt;br /&gt;
&lt;br /&gt;
You get a number of assignments or exercises that you have to solve. In this example it is demonstrated with a single task.&lt;br /&gt;
&lt;br /&gt;
Make a function that accepts two parameters; an input file name and and output filename. The input file contains one value per line, but the value might be anything, string, integer, float, positive or negative. The function must read the input file, discard any value that is not positive, and output the log of the non-discarded numbers to the output file.&lt;br /&gt;
&lt;br /&gt;
You will as a template for your hand-in get a file that looks like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env python3&lt;br /&gt;
# Above is the shebang line - which tells which program should interpret the rest of the file&lt;br /&gt;
&lt;br /&gt;
# The libraries necessary for the exercises - use no other&lt;br /&gt;
import os, sys, re&lt;br /&gt;
&lt;br /&gt;
####################################################################################&lt;br /&gt;
# You must fill the functions with code that does the job mentioned.               #&lt;br /&gt;
# All the functions must work together coherently for the exercise to be complete. #&lt;br /&gt;
# The main exercise function should call the other functions in it&#039;s group.        #&lt;br /&gt;
# You can add your own functions, but you still need to make the ones described.   #&lt;br /&gt;
# Any personal functions should follow the naming pattern demonstrated.            #&lt;br /&gt;
# You are expected the delete the &amp;quot;pass&amp;quot; statements as they are present only for   #&lt;br /&gt;
# syntax reasons. The template won&#039;t run without them.                             #&lt;br /&gt;
####################################################################################&lt;br /&gt;
&lt;br /&gt;
################################&lt;br /&gt;
### FUNCTIONS FOR EXERCISE 1 ###&lt;br /&gt;
################################&lt;br /&gt;
&lt;br /&gt;
def exercise_1(filenamein:str, filenameout:str) -&amp;gt; None:&lt;br /&gt;
    # Read file, discards line with non-positive numbers, output the log&lt;br /&gt;
    pass&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
############################&lt;br /&gt;
# Main program starts here #&lt;br /&gt;
# Not necessary to change  #&lt;br /&gt;
############################&lt;br /&gt;
&lt;br /&gt;
# Below if statement allows you to execute the main code when the file runs as a script,&lt;br /&gt;
# but not when it is imported as a module.&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
    # First exercise&lt;br /&gt;
    exercise_1(&#039;values.txt&#039;, &#039;log_values.txt&#039;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=348</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=348"/>
		<updated>2026-09-03T08:29:58Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Required course material for the lesson */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - exam form]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot; &amp;quot;1-1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Make a function that reads the input fasta file and determine the consensus sequence of the alignment, which you return. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Make a function that accepts an input SwissProt filename and and output fasta filename, and uses regular repressions to extract the ID and the protein sequence from each entry in the input file and save them in an output fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. You did something similar back in the [[Stateful parsing]] lesson, exercise 6.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV be creating a function that accepts an input fasta filename and and output epitope file name. The functions reads the input &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and creates a single set consisting of all possible epitopes for all sequences. Save the epitopes in the output file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitopes left are dissimilar to each other. Create a function that accepts an input epitope file and an output epitope file to perform the job, possibly also creating other helper functions in the process.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance, [[Functions]] exercise 1. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=347</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=347"/>
		<updated>2026-09-02T12:58:57Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot; &amp;quot;1-1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Make a function that reads the input fasta file and determine the consensus sequence of the alignment, which you return. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Make a function that accepts an input SwissProt filename and and output fasta filename, and uses regular repressions to extract the ID and the protein sequence from each entry in the input file and save them in an output fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. You did something similar back in the [[Stateful parsing]] lesson, exercise 6.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV be creating a function that accepts an input fasta filename and and output epitope file name. The functions reads the input &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and creates a single set consisting of all possible epitopes for all sequences. Save the epitopes in the output file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitopes left are dissimilar to each other. Create a function that accepts an input epitope file and an output epitope file to perform the job, possibly also creating other helper functions in the process.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance, [[Functions]] exercise 1. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=346</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=346"/>
		<updated>2026-09-02T12:43:25Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Make a function that reads the input fasta file and determine the consensus sequence of the alignment, which you return. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Make a function that accepts an input SwissProt filename and and output fasta filename, and uses regular repressions to extract the ID and the protein sequence from each entry in the input file and save them in an output fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. You did something similar back in the [[Stateful parsing]] lesson, exercise 6.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV be creating a function that accepts an input fasta filename and and output epitope file name. The functions reads the input &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and creates a single set consisting of all possible epitopes for all sequences. Save the epitopes in the output file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitopes left are dissimilar to each other. Create a function that accepts an input epitope file and an output epitope file to perform the job, possibly also creating other helper functions in the process.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance, [[Functions]] exercise 1. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=345</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=345"/>
		<updated>2026-09-02T12:40:38Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Make a function that reads the input fasta file and determine the consensus sequence of the alignment, which you return. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Make a function that accepts an input fasta filename and and output fasta filename, and uses regular repressions to extract the ID and the protein sequence from each entry in the input file and save them in an output fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. You did something similar back in the [[Stateful parsing]] lesson, exercise 6.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV be creating a function that accepts an input fasta filename and and output epitope file name. The functions reads the input &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and creates a single set consisting of all possible epitopes for all sequences. Save the epitopes in the output file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitopes left are dissimilar to each other. Create a function that accepts an input epitope file and an output epitope file to perform the job, possibly also creating other helper functions in the process.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance, [[Functions]] exercise 1. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=344</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=344"/>
		<updated>2026-09-02T12:11:09Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Make a function that reads the input fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Make a function that accepts an input fasta filename and and output fasta filename, and uses regular repressions to extract the ID and the protein sequence from each entry in the input file and save them in an output fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. You did something similar back in the [[Stateful parsing]] lesson, exercise 6.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV be creating a function that accepts an input fasta filename and and output epitope file name. The functions reads the input &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and creates a single set consisting of all possible epitopes for all sequences. Save the epitopes in the output file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitopes left are dissimilar to each other. Create a function that accepts an input epitope file and an output epitope file to perform the job, possibly also creating other helper functions in the process.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance, [[Functions]] exercise 1. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=343</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=343"/>
		<updated>2026-09-02T12:05:54Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Make a function that reads the input fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Make a function that accepts an input fasta filename and and output fasta filename, and uses regular repressions to extract the ID and the protein sequence from each entry in the input file and save them in an output fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. You did something similar back in the [[Stateful parsing]] lesson, exercise 6.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV be creating a function that accepts an input fasta filename and and output epitope file name. The functions reads the input &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and creates a single set consisting of all possible epitopes for all sequences. Save the epitopes in the output file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitopes left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance, [[Functions]] exercise 1. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=342</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=342"/>
		<updated>2026-09-02T12:02:45Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Make a function that reads the input fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Make a function that accepts an input fasta filename and and output fasta filename, and uses regular repressions to extract the ID and the protein sequence from each entry in the input file and save them in an output fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. You did something similar back in the [[Stateful parsing]] lesson, exercise 6.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV be creating a function that accepts an input fasta filename and and output epitope file name. The functions reads the input &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and creates a single set consisting of all possible epitopes for all sequences. Save the epitopes in the output file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitopes left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=341</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=341"/>
		<updated>2026-09-02T11:57:39Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Make a function that reads the input fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Make a function that accepts an input fasta filename and and output fasta filename, and uses regular repressions to extract the ID and the protein sequence from each entry in the input file and save them in an output fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. You did something similar back in the [[Stateful parsing]] lesson, exercise 6.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=340</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=340"/>
		<updated>2026-09-02T11:54:18Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Make a function that reads the input fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Make a function that accepts an input fasta filename and and output fasta filename, and uses regular repressions to extract the ID and the protein sequence from each entry in the input file and save them in an output fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. YouThis job is not new to you. and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=339</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=339"/>
		<updated>2026-09-02T11:49:08Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;You are welcome to use the &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in other exercises if appropriate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Make a function that reads the input fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Using regular repressions you must extract the ID and the protein sequence from each entry and save them in a fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. This job is not new to you and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=338</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=338"/>
		<updated>2026-09-02T11:42:56Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that takes as input an input-fasta-filename and and output-fastafilename. The function reads the input fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output fasta file, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Read the fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Using regular repressions you must extract the ID and the protein sequence from each entry and save them in a fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. This job is not new to you and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=337</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=337"/>
		<updated>2026-09-02T11:39:31Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that reads a fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output file &#039;&#039;fastaout.fsa&#039;&#039;, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Read the fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Using regular repressions you must extract the ID and the protein sequence from each entry and save them in a fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. This job is not new to you and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=336</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=336"/>
		<updated>2026-09-02T11:38:53Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 5. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - otherwise look it up.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function in exercise 6. Start with inserting that function in the python file at the designated place. Building on your experience with the previous exercise, make a function that reads a fasta file, discard entries that do not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output file &#039;&#039;fastaout.fsa&#039;&#039;, in such a way that the normal 60 chars per line is followed with no spaces in between. The function must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Read the fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Using regular repressions you must extract the ID and the protein sequence from each entry and save them in a fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. This job is not new to you and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=335</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=335"/>
		<updated>2026-09-02T11:35:15Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function. Start with inserting that function in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - or that you are able to look it up.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Building on your experience with the previous exercise, make a program that reads a fasta file, discard entries that can not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output file &#039;&#039;fastaout.fsa&#039;&#039;, in such a way that the normal 60 chars per line is followed with no spaces in between. The program must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Read the fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Using regular repressions you must extract the ID and the protein sequence from each entry and save them in a fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. This job is not new to you and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=334</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=334"/>
		<updated>2026-09-02T11:34:42Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [[Functions]] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function. Start with inserting that in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - or that you are able to look it up.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Building on your experience with the previous exercise, make a program that reads a fasta file, discard entries that can not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output file &#039;&#039;fastaout.fsa&#039;&#039;, in such a way that the normal 60 chars per line is followed with no spaces in between. The program must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Read the fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Using regular repressions you must extract the ID and the protein sequence from each entry and save them in a fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. This job is not new to you and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=333</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=333"/>
		<updated>2026-09-02T11:34:07Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# In the [Functions] lesson you made a &#039;&#039;&#039;fastaread()&#039;&#039;&#039; function. Start with inserting that in the python file at the designated place. Now a function that accepts a filename as parameter and reads and verifies a fasta file. Use your  &#039;&#039;&#039;fastaread()&#039;&#039;&#039; for the reading part. The verification here means that the function prints &amp;quot;filename is DNA fasta&amp;quot; or &amp;quot;filename is protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;filename is not fasta&amp;quot; if unsuccessfully verified. Test the function with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - or that you are able to look it up.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Building on your experience with the previous exercise, make a program that reads a fasta file, discard entries that can not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output file &#039;&#039;fastaout.fsa&#039;&#039;, in such a way that the normal 60 chars per line is followed with no spaces in between. The program must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Read the fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Using regular repressions you must extract the ID and the protein sequence from each entry and save them in a fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. This job is not new to you and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=332</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=332"/>
		<updated>2026-09-02T11:24:51Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Output is &amp;quot;X is a valid email address&amp;quot; or &amp;quot;X is not a valid email address&amp;quot;. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Make a program that can read and verify a fasta file. Use your previous function &#039;&#039;&#039;fastaread()&#039;&#039;&#039; Test the program with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. Verification here means that the program prints &amp;quot;DNA fasta&amp;quot; or &amp;quot;Protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;Not fasta&amp;quot; if unsuccessfully verified. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - or that you are able to look it up.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Building on your experience with the previous exercise, make a program that reads a fasta file, discard entries that can not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output file &#039;&#039;fastaout.fsa&#039;&#039;, in such a way that the normal 60 chars per line is followed with no spaces in between. The program must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Read the fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Using regular repressions you must extract the ID and the protein sequence from each entry and save them in a fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. This job is not new to you and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=331</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=331"/>
		<updated>2026-09-02T11:21:12Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a function that accepts a string (X) as parameter. Use regular expressions (RE) to determine if the string is a number and outputs either &amp;quot;X is a number&amp;quot; or &amp;quot;X is not a number&amp;quot; depending on the string content. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a function that takes a string as input, and checks if it is in a proper format for an email address. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Make a program that can read and verify a fasta file. Use your previous function &#039;&#039;&#039;fastaread()&#039;&#039;&#039; Test the program with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. Verification here means that the program prints &amp;quot;DNA fasta&amp;quot; or &amp;quot;Protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;Not fasta&amp;quot; if unsuccessfully verified. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - or that you are able to look it up.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Building on your experience with the previous exercise, make a program that reads a fasta file, discard entries that can not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output file &#039;&#039;fastaout.fsa&#039;&#039;, in such a way that the normal 60 chars per line is followed with no spaces in between. The program must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Read the fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Using regular repressions you must extract the ID and the protein sequence from each entry and save them in a fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. This job is not new to you and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=330</id>
		<title>Regular expressions</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Regular_expressions&amp;diff=330"/>
		<updated>2026-09-02T11:14:23Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Exercises to be handed in */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{| width=500  style=&amp;quot;font-size: 10px; float:right; margin-left: 10px; margin-top: -56px;&amp;quot;&lt;br /&gt;
|Previous: [[Dict techniques]]&lt;br /&gt;
|Next: [[Python object model]]&lt;br /&gt;
|}&lt;br /&gt;
== Required course material for the lesson ==&lt;br /&gt;
Powerpoint: [https://teaching.healthtech.dtu.dk/material/22116/22116_12-Regex.ppt Regular expressions in Python]&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=04cb2b80-d941-42a5-a632-af27012cd0d7 Regular Expressions] Monday&amp;lt;br&amp;gt; --&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=738d525b-a6c1-4973-b6cc-af27012ca86e An (unfortunately) true story]&amp;lt;br&amp;gt;&lt;br /&gt;
Resource: [[Example code - Regex]]&amp;lt;br&amp;gt;&lt;br /&gt;
Video: [https://panopto.dtu.dk/Panopto/Pages/Viewer.aspx?id=2952d382-7059-4691-8170-af27012bc9a1 Live Coding]&amp;lt;br&amp;gt;&lt;br /&gt;
PDF: [https://teaching.healthtech.dtu.dk/material/22116/regular-expressions-cheat-sheet-v2.pdf Regular Expressions Cheat Sheet]&amp;lt;br&amp;gt;&lt;br /&gt;
WWW: [http://regex101.com/ Web page where you can test your regular expressions]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Subjects covered ==&lt;br /&gt;
* Regular expressions, duh.&lt;br /&gt;
* Patterns, how to design and use them - and not use them.&lt;br /&gt;
&lt;br /&gt;
== Exercises to be handed in ==&lt;br /&gt;
&#039;&#039;&#039;Important - read this before starting&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This exercise set will be similar to the format of the exam. The content will obviously be different.&amp;lt;br&amp;gt;&lt;br /&gt;
You have to download [https://teaching.healthtech.dtu.dk/material/22116/22116_12.py this python file.] It contains some frame work code, but mostly some unfinished functions.&lt;br /&gt;
Each exercise is about finishing one of the function groups in the file. You can write the functions directly in the python file, or use VScode or other Jupyter Notebook editor to write it, but then it has to be copied over to the python file. You must hand in the finished python file, &#039;&#039;&#039;not&#039;&#039;&#039; a .ipynb file.&amp;lt;br&amp;gt;&lt;br /&gt;
Inability to understand or perform this process will make you fail the exam, so it is worth spending some time on the procedure.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercise 6 to 8 has strong taste of something I would do at an exam. It is also an interesting beginning of the making a HIV vaccine. The data is real and the methods are real.&lt;br /&gt;
&lt;br /&gt;
# Make a program that accepts a string as input from the keyboard. Use regular expressions (RE) to determine if the input is a number. The goal is to do this with a SINGLE regex.&amp;lt;br&amp;gt; These should all be considered as numbers: &amp;quot;4&amp;quot;   &amp;quot;-7&amp;quot;   &amp;quot;0.656&amp;quot;   &amp;quot;-67.35555&amp;quot;&amp;lt;br&amp;gt; These are not numbers: &amp;quot;5.&amp;quot;  &amp;quot;56F&amp;quot;  &amp;quot;.32&amp;quot;  &amp;quot;-.04&amp;quot;  &amp;quot;1+1&amp;quot;&amp;lt;br&amp;gt; Note: The program is very simple, but it is likely the most difficult regular expression, you will have to make in this set of exercises. Perhaps you should do the following exercises before attempting this one - just to get some experience first.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Regex is often used for validation. This time make a small program that ask for an email address, and checks if it is in a proper format. Quite similar to the previous exercise, just a different thing to validate.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Make a program that can read and verify a fasta file. Use your previous function &#039;&#039;&#039;fastaread()&#039;&#039;&#039; Test the program with &#039;&#039;dna7.fsa&#039;&#039; and &#039;&#039;dnanoise.fsa&#039;&#039;. Verification here means that the program prints &amp;quot;DNA fasta&amp;quot; or &amp;quot;Protein fasta&amp;quot; if the file is successfully verified for either dna or protein sequence, and &amp;quot;Not fasta&amp;quot; if unsuccessfully verified. You can find a description of fasta format in [[Biological knowledge needed in the course]]. You are expected to know which symbols are used for DNA and protein sequence - or that you are able to look it up.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Building on your experience with the previous exercise, make a program that reads a fasta file, discard entries that can not conform to DNA or protein sequence, and rewrite (using your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function) the acceptable entries in the output file &#039;&#039;fastaout.fsa&#039;&#039;, in such a way that the normal 60 chars per line is followed with no spaces in between. The program must inform the user how many entries was kept and how many discarded. Hint: Test on &#039;&#039;dnanoise.fsa&#039;&#039;, which contains 3 entries that should be discarded (V00179, J00265, J02989).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# [[File:consensus.png|50px|right]] In the file &#039;&#039;alignment.fsa&#039;&#039; is a protein alignment of part of the insulin gene from different organisms. Read the fasta file and determine the consensus sequence of the alignment, which you print. The consensus sequence is simply the most frequent occurring amino acid on each position.&amp;lt;br&amp;gt;Consensus: MALWMRLLPLLALLALWEPDPAGAFVNGHLCGSHLVEALYLVCGERGFFYTPKSRREVEDPGVGGLELGGGP&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# All HIV envelope proteins from various HIV strains in SwissProt have been identified and collected in the file &#039;&#039;HIVenvelope.txt&#039;&#039;. Using regular repressions you must extract the ID and the protein sequence from each entry and save them in a fasta file named &#039;&#039;HIVenv.fsa&#039;&#039;. This job is not new to you and you can use your &#039;&#039;&#039;fastawrite()&#039;&#039;&#039; function if you want to.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# Continuing the investigation in HIV. Read the &#039;&#039;HIVenv.fsa&#039;&#039; fasta file and create a single set consisting of all possible epitopes for all sequences. Save the epitopes in the file &#039;&#039;HIVepitopes.txt&#039;&#039; - one epitope per line. An epitope is simply a k-mer 9 residues long, which can possibly elicit a immune system response. So save all unique 9-mers in the sequences in the file. To generate a file that you can verify against my file, you must sort the epitopes alphabetically before saving them.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
# You must prepare the epitopes in &#039;&#039;HIVepitopes.txt&#039;&#039; for machine learning. A common ML problem is when you have many data points (here epitopes) that look like each other. This introduces an unwanted bias in the ML predictions. Your job is to eliminate epitopes that are too similar using the Hobohm-1 algorithm. Hobohm-1 works like this: Look a the first epitope in the list. Compare it sequentially with the rest of the epitopes. If an epitope is too similar with the first, throw it away. Now no epitopes looks like the first. Proceed to the second epitope and repeat the comparing and possibly throwing away of the subsequent epitopes. Proceed to the third epitope in the list. Repeat this pattern until you have reached the end of the list. Now all epitope left are dissimilar to each other.&amp;lt;br&amp;gt;How to determine if two epitopes are too similar? Easy - you earlier learned about the Hamming distance. Just compute the Hamming distance between two epitopes and if the distance is 3 or less, they are too similar. Save the &amp;quot;surviving&amp;quot; epitopes in the file &#039;&#039;HIVepitopesML.txt&#039;&#039;.&amp;lt;br&amp;gt;Hint: Think about the Hobohm-1 algorithm before you implement it. You can easily run into problems.&amp;lt;br&amp;gt;You should see a reduction from 15909 epitopes to 3842 in 30-60 seconds.&lt;br /&gt;
&lt;br /&gt;
== Exercises for extra practice ==&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=AI_guidelines_for_the_course&amp;diff=329</id>
		<title>AI guidelines for the course</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=AI_guidelines_for_the_course&amp;diff=329"/>
		<updated>2026-06-24T13:30:24Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
It is strongly preferred that you do &#039;&#039;&#039;not&#039;&#039;&#039; use AI in the course. The skills you need to acquire are best acquired by your own effort or perhaps in a discussion with a fellow student or TA/teacher.&amp;lt;br&amp;gt;&lt;br /&gt;
However, a proper responsible use of AI can to some extent replace a discussion with a fellow human.&lt;br /&gt;
&lt;br /&gt;
The purpose of AI in the course is to help you learn - not to solve your problems for you - possibly (likely) in a way you do not understand.&amp;lt;br&amp;gt;&lt;br /&gt;
DTU&#039;s honour code is to be followed in all DTU activities; courses and exams among them. The honour code has little or no influence if you are employing &amp;quot;good use&amp;quot; of AI, but upon employing &amp;quot;bad use&amp;quot; of AI, you have to cite your source every time.&lt;br /&gt;
&lt;br /&gt;
A simple way for yourself to determine if you have used AI wrong is: &lt;br /&gt;
* Can you explain how your solution works?&lt;br /&gt;
* Do you think &#039;&#039;&#039;I&#039;&#039;&#039; (the teacher) will be happy with the explanation? (a bit subjective)&lt;br /&gt;
* Have functions/methods been used which were not intended for the lesson?&lt;br /&gt;
&lt;br /&gt;
== Good use ==&lt;br /&gt;
Query the AI for knowledge:&lt;br /&gt;
Asking questions like &amp;quot;how does this function/method work?&amp;quot;, &amp;quot;what is the significance of this?&amp;quot;, &amp;quot;explain that&amp;quot; &amp;quot;why is this a good/bad idea&amp;quot; are good types of questions. They help you learn.&lt;br /&gt;
* Critical thinking&lt;br /&gt;
* Judgement&lt;br /&gt;
* Analysis&lt;br /&gt;
&lt;br /&gt;
== Bad use ==&lt;br /&gt;
Query the AI for solutions: Asking questions like &amp;quot;how do I do this?&amp;quot;, &amp;quot;can you make python code that does this?&amp;quot; simply solves a problem for you - maybe in a way that is not intended in the course progression and you do not really understand, because it is either outside or too early in the curriculum.&amp;lt;br&amp;gt;&lt;br /&gt;
* Copy/paste behavior&lt;br /&gt;
* Potential for over-reliance - not developing problem-solving skills&lt;br /&gt;
&lt;br /&gt;
== Enforcement ==&lt;br /&gt;
* AI is not allowed at exam&lt;br /&gt;
* Exercises made by AI are voided&lt;br /&gt;
How will exercises be recognized as AI generated?&amp;lt;br&amp;gt;&lt;br /&gt;
As AI is trained on &amp;quot;the code available on the internet&amp;quot; almost all AI generated code will contain elements not in the curriculum or not yet gone through in the course progression. Any code that contains these elements is therefore voided.&amp;lt;br&amp;gt;&lt;br /&gt;
This may as a side effect hit advanced students who know more python than expected. If you want to use these elements to show your skill, fine. But do ALSO make a solution without the elements. If you can not do that, maybe you need to study the subject some more and think a bit better.&lt;br /&gt;
&lt;br /&gt;
== Consideration ==&lt;br /&gt;
The exam will evaluate how good your programming skills are.&amp;lt;br&amp;gt;&lt;br /&gt;
Not how good your skills are in making the AI code for you.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=328</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=328"/>
		<updated>2026-06-24T12:30:06Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;background-color:yellow&amp;quot;&amp;gt;&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; Course 02002: It is &#039;&#039;&#039;STRONGLY&#039;&#039;&#039; recommended to test yourself against the [https://02002.compute.dtu.dk/additional/previous_exams.html#previous-exams exams of 02002] before taking this course, if you come from abroad.&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
Using AI can actively prevent you from acquiring the skills.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=327</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=327"/>
		<updated>2026-06-24T12:19:19Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* How much is required to pass? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Monday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 7 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;There will be some hand-in time irregularity at the end of the semester, due to exams. Pay attention.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. You can only evaluate if you have handed in exercises, so the hand-in is required.&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a Jupyter Notebook for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation. Many people use VScode for this, but it is up to you. In the last part of the course, this is changed to a &#039;&#039;&#039;.py&#039;&#039;&#039; file, to get you used to how the exam will be.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
DTU Learn does not allow for late hand-in. Set an alarm on your phone to remember.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements for taking the course ==&lt;br /&gt;
&#039;&#039;&#039;You must take this seriously. Half of the students failed the course first year it ran.&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This course requires that you have previously taken 5 ECTS in a beginner course in programming. DTU students have taken [https://kurser.dtu.dk/course/02002 02002 Computer Programming (Polytechnical Foundation)], however foreign Master students are more of a mixed group. This course can NOT be treated as your first real programming course - it is your second, and the difficulty of the course and exam reflects that. I have tried to make the course accessible to people with a moderate background in programming, but it is not a free ride. I have an obsolete beginner course [https://teaching.healthtech.dtu.dk/22101/ 22101 Introduction to programming in Life Science using Python] which you can learn from on your own, if your background is insufficient and you want to take this course anyway.&lt;br /&gt;
&lt;br /&gt;
Using AI/ChatGPT is a bad idea. From my observations and exam results, the use of AI hinders the acquisition of &amp;quot;programmatic thinking&amp;quot;. This skill is what the course is about - the core competence. When asking AI about a problem, you are usually served a solution. Even if you understand the solution, then you have not gone through the process of thinking the solution. It weakens your thinking enormously, you don&#039;t &amp;quot;own&amp;quot; the solution and you are not getting used to thinking about programming problems. This becomes a big problem at exam time, because you think you are OK, but you have not acquired the correct thinking and the exam will seem very hard. Yes, there are a number of elements in the exam that we have been going through in the course, but there are also new elements (not python elements, but logic problems) where you have to think your way through.&lt;br /&gt;
&lt;br /&gt;
You can read these American studies showing how the use of AI damages your thinking:&lt;br /&gt;
[https://www.microsoft.com/en-us/research/wp-content/uploads/2025/01/lee_2025_ai_critical_thinking_survey.pdf The Impact of Generative AI on Critical Thinking: Self-Reported Reductions in Cognitive Effort and Confidence Effects From a Survey of Knowledge Workers] and [https://arxiv.org/abs/2506.08872 Your Brain on ChatGPT: Accumulation of Cognitive Debt when Using an AI Assistant for Essay Writing Task].&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, you will be asked many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes. &#039;&#039;They can be found on DTU Learn under Discussions&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using python elements not in the curriculum ==&lt;br /&gt;
Most people sooner or later use python not in the curriculum, or not yet covered by the course progression. There are several reasons for that: They know some python from other courses, they have been using AI to create solutions, they have been reading ahead or they have searched the internet for answers.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While knowledge is good, then there is a reason for why the exercises and the learning materials (powerpoint) are as they are - it is a designed course progression. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
By not following the course progression, then you are not learning to analyze or formulate strategies.&lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Also, it brings problems to peer evaluation, as not everyone knows python that is outside the curriculum.&lt;br /&gt;
&lt;br /&gt;
If you want to show some fancy python (i.e. outside the curriculum/progression), then make TWO solutions to the exercise. One that shows the fancy python and one that follows the curriculum and the course progression. The last one can then be used for peer evaluation. If you find yourself unable to make a solution that follows the course progression, then maybe you should study the subject some more.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a 4 hour written exam. You will get the assignments, the input files that you have to use/read/parse, and the output files that you have to create. Most importantly, you will also get a &#039;&#039;&#039;.py&#039;&#039;&#039; file that you will have to fill out. That is basically a text file with python code, that mostly contains empty functions. You have to fill out the functions with python code that solves the assignments.&amp;lt;br&amp;gt;YOU CAN NOT HAND IN A JUPYTER NOTEBOOK FILE. Your exam hand-in is only the filled out &#039;&#039;&#039;.py&#039;&#039;&#039; file. &lt;br /&gt;
&lt;br /&gt;
The last lesson [[Python object model]]&#039;s exercises is an example of the exam format - not the exam content. All the exercises has to be handed in in one single .py file. Every exercise is one individual python function, which calls some specified other functions which together solves the exercise. You can add your own functions, if you feel some functionality is missing, but you must fill and use those given by the exam &#039;&#039;&#039;.py&#039;&#039;&#039; file. Follow the naming scheme for your own functions - it should be obvious.&lt;br /&gt;
&lt;br /&gt;
You are expected to solve the assignments using the course curriculum. In particular, it means &amp;quot;pure&amp;quot; python, maybe using standard libraries like os, sys, re, math and others, but not 3rd party libraries like pandas or numpy. It also means use of comments to explain what you are doing, and employ code modularization.&lt;br /&gt;
&lt;br /&gt;
Comments that just explains your intentions, but are not supported by code, are disregarded. You can not &amp;quot;talk&amp;quot; your way to a pass, you must code your way to a pass.&lt;br /&gt;
&lt;br /&gt;
At the exam there will be 2 assignments - &#039;&#039;&#039;not&#039;&#039;&#039; 6 exercises - that you have to solve.&lt;br /&gt;
&lt;br /&gt;
Exam aids: You can bring your computer with all the material from the course; powerpoints, exercises, solutions, etc. There is NO INTERNET and NO AI allowed. In the end, it is the programming skill you acquired during the course, that will make you pass - not any aid you bring. That is why we are doing so many difficult exercises.&lt;br /&gt;
&lt;br /&gt;
=== How much is required to pass? ===&lt;br /&gt;
The &#039;&#039;&#039;.py&#039;&#039;&#039; file is mostly structure and does not give much advice in how to solve the assignments. It is for you to show that you have learned to analyze a programming problem and come up with a solution. As you will be given both the input files and the output files, you can check how well you have succeeded. A correct solution to both assignments is an automatic pass. A correct solution to only one assignment, without any constructive work (in my evaluation) on the other assignment is not enough for a pass. No correct solutions, but writing good sensible code (again in my evaluation) can pass, as it shows you have learned essential things in the course. Comments are part the the essential things.&amp;lt;br&amp;gt;&lt;br /&gt;
In the end, unless you passed automatically, it comes down to a overall evaluation of your hand-in. You are required to have worked on all assignments to pass - no matter the weight of the assignments.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There are usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=326</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=326"/>
		<updated>2026-06-24T12:11:19Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Requirements for taking the course */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Monday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 7 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;There will be some hand-in time irregularity at the end of the semester, due to exams. Pay attention.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. You can only evaluate if you have handed in exercises, so the hand-in is required.&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a Jupyter Notebook for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation. Many people use VScode for this, but it is up to you. In the last part of the course, this is changed to a &#039;&#039;&#039;.py&#039;&#039;&#039; file, to get you used to how the exam will be.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
DTU Learn does not allow for late hand-in. Set an alarm on your phone to remember.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements for taking the course ==&lt;br /&gt;
&#039;&#039;&#039;You must take this seriously. Half of the students failed the course first year it ran.&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This course requires that you have previously taken 5 ECTS in a beginner course in programming. DTU students have taken [https://kurser.dtu.dk/course/02002 02002 Computer Programming (Polytechnical Foundation)], however foreign Master students are more of a mixed group. This course can NOT be treated as your first real programming course - it is your second, and the difficulty of the course and exam reflects that. I have tried to make the course accessible to people with a moderate background in programming, but it is not a free ride. I have an obsolete beginner course [https://teaching.healthtech.dtu.dk/22101/ 22101 Introduction to programming in Life Science using Python] which you can learn from on your own, if your background is insufficient and you want to take this course anyway.&lt;br /&gt;
&lt;br /&gt;
Using AI/ChatGPT is a bad idea. From my observations and exam results, the use of AI hinders the acquisition of &amp;quot;programmatic thinking&amp;quot;. This skill is what the course is about - the core competence. When asking AI about a problem, you are usually served a solution. Even if you understand the solution, then you have not gone through the process of thinking the solution. It weakens your thinking enormously, you don&#039;t &amp;quot;own&amp;quot; the solution and you are not getting used to thinking about programming problems. This becomes a big problem at exam time, because you think you are OK, but you have not acquired the correct thinking and the exam will seem very hard. Yes, there are a number of elements in the exam that we have been going through in the course, but there are also new elements (not python elements, but logic problems) where you have to think your way through.&lt;br /&gt;
&lt;br /&gt;
You can read these American studies showing how the use of AI damages your thinking:&lt;br /&gt;
[https://www.microsoft.com/en-us/research/wp-content/uploads/2025/01/lee_2025_ai_critical_thinking_survey.pdf The Impact of Generative AI on Critical Thinking: Self-Reported Reductions in Cognitive Effort and Confidence Effects From a Survey of Knowledge Workers] and [https://arxiv.org/abs/2506.08872 Your Brain on ChatGPT: Accumulation of Cognitive Debt when Using an AI Assistant for Essay Writing Task].&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, you will be asked many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes. &#039;&#039;They can be found on DTU Learn under Discussions&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using python elements not in the curriculum ==&lt;br /&gt;
Most people sooner or later use python not in the curriculum, or not yet covered by the course progression. There are several reasons for that: They know some python from other courses, they have been using AI to create solutions, they have been reading ahead or they have searched the internet for answers.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While knowledge is good, then there is a reason for why the exercises and the learning materials (powerpoint) are as they are - it is a designed course progression. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
By not following the course progression, then you are not learning to analyze or formulate strategies.&lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Also, it brings problems to peer evaluation, as not everyone knows python that is outside the curriculum.&lt;br /&gt;
&lt;br /&gt;
If you want to show some fancy python (i.e. outside the curriculum/progression), then make TWO solutions to the exercise. One that shows the fancy python and one that follows the curriculum and the course progression. The last one can then be used for peer evaluation. If you find yourself unable to make a solution that follows the course progression, then maybe you should study the subject some more.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a 4 hour written exam. You will get the assignments, the input files that you have to use/read/parse, and the output files that you have to create. Most importantly, you will also get a &#039;&#039;&#039;.py&#039;&#039;&#039; file that you will have to fill out. That is basically a text file with python code, that mostly contains empty functions. You have to fill out the functions with python code that solves the assignments.&amp;lt;br&amp;gt;YOU CAN NOT HAND IN A JUPYTER NOTEBOOK FILE. Your exam hand-in is only the filled out &#039;&#039;&#039;.py&#039;&#039;&#039; file. &lt;br /&gt;
&lt;br /&gt;
The last lesson [[Python object model]]&#039;s exercises is an example of the exam format - not the exam content. All the exercises has to be handed in in one single .py file. Every exercise is one individual python function, which calls some specified other functions which together solves the exercise. You can add your own functions, if you feel some functionality is missing, but you must fill and use those given by the exam &#039;&#039;&#039;.py&#039;&#039;&#039; file. Follow the naming scheme for your own functions - it should be obvious.&lt;br /&gt;
&lt;br /&gt;
You are expected to solve the assignments using the course curriculum. In particular, it means &amp;quot;pure&amp;quot; python, maybe using standard libraries like os, sys, re, math and others, but not 3rd party libraries like pandas or numpy. It also means use of comments to explain what you are doing, and employ code modularization.&lt;br /&gt;
&lt;br /&gt;
Comments that just explains your intentions, but are not supported by code, are disregarded. You can not &amp;quot;talk&amp;quot; your way to a pass, you must code your way to a pass.&lt;br /&gt;
&lt;br /&gt;
At the exam there will be 2 assignments - &#039;&#039;&#039;not&#039;&#039;&#039; 6 exercises - that you have to solve.&lt;br /&gt;
&lt;br /&gt;
Exam aids: You can bring your computer with all the material from the course; powerpoints, exercises, solutions, etc. There is NO INTERNET and NO AI allowed. In the end, it is the programming skill you acquired during the course, that will make you pass - not any aid you bring. That is why we are doing so many difficult exercises.&lt;br /&gt;
&lt;br /&gt;
=== How much is required to pass? ===&lt;br /&gt;
The &#039;&#039;&#039;.py&#039;&#039;&#039; file is mostly structure and does not give much advice in how to solve the assignments. It is for you to show that you have learned to analyze a programming problem and come up with a solution. As you will be given both the input files and the output files, you can check how well you have succeeded. A correct solution to both assignments is an automatic pass. A correct solution to only one assignment, without any constructive work (in my evaluation) on the other assignment is not enough for a pass. No correct solutions, but writing good sensible code (again in my evaluation) can pass, as it shows you have learned essential things in the course. Comments are part the the essential things.&amp;lt;br&amp;gt;&lt;br /&gt;
In the end, unless you passed automatically, it comes down to a overall evaluation of your hand-in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There are usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=325</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=325"/>
		<updated>2026-06-24T11:40:59Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;background-color:yellow&amp;quot;&amp;gt;&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; Course 02002: It is &#039;&#039;&#039;STRONGLY&#039;&#039;&#039; recommended to test yourself against the [https://02002.compute.dtu.dk/additional/previous_exams.html#previous-exams exams of 02002] before taking this course, if you come from abroad.&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
Using AI can actively prevent you from acquiring the skills.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=324</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=324"/>
		<updated>2026-06-24T11:40:09Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;bgcolor:yellow&amp;quot;&amp;gt;&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; Course 02002: It is &#039;&#039;&#039;STRONGLY&#039;&#039;&#039; recommended to test yourself against the [https://02002.compute.dtu.dk/additional/previous_exams.html#previous-exams exams of 02002] before taking this course, if you come from abroad.&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
Using AI can actively prevent you from acquiring the skills.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=323</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=323"/>
		<updated>2026-06-24T11:39:04Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;span&amp;gt;&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; Course 02002: It is &#039;&#039;&#039;STRONGLY&#039;&#039;&#039; recommended to test yourself against the [https://02002.compute.dtu.dk/additional/previous_exams.html#previous-exams exams of 02002] before taking this course, if you come from abroad.&amp;lt;/span&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
Using AI can actively prevent you from acquiring the skills.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=322</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=322"/>
		<updated>2026-06-24T11:38:02Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; Course 02002: It is &#039;&#039;&#039;STRONGLY&#039;&#039;&#039; recommended to test yourself against the [https://02002.compute.dtu.dk/additional/previous_exams.html#previous-exams exams of 02002] before taking this course, if you come from abroad.&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
Using AI can actively prevent you from acquiring the skills.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=321</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=321"/>
		<updated>2026-06-24T11:37:37Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font bgcolor=&amp;quot;#00ffff&amp;quot;&amp;gt;&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; Course 02002: It is &#039;&#039;&#039;STRONGLY&#039;&#039;&#039; recommended to test yourself against the [https://02002.compute.dtu.dk/additional/previous_exams.html#previous-exams exams of 02002] before taking this course, if you come from abroad.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
Using AI can actively prevent you from acquiring the skills.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=320</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=320"/>
		<updated>2026-06-24T11:37:09Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font bgcolor=&amp;quot;yellow&amp;quot;&amp;gt;&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; Course 02002: It is &#039;&#039;&#039;STRONGLY&#039;&#039;&#039; recommended to test yourself against the [https://02002.compute.dtu.dk/additional/previous_exams.html#previous-exams exams of 02002] before taking this course, if you come from abroad.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
Using AI can actively prevent you from acquiring the skills.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=319</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=319"/>
		<updated>2026-06-23T09:13:18Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Competences */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; Course 02002: It is &#039;&#039;&#039;STRONGLY&#039;&#039;&#039; recommended to test yourself against the [https://02002.compute.dtu.dk/additional/previous_exams.html#previous-exams exams of 02002] before taking this course, if you come from abroad.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
Using AI can actively prevent you from acquiring the skills.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=318</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=318"/>
		<updated>2026-06-23T09:09:56Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; Course 02002: It is &#039;&#039;&#039;STRONGLY&#039;&#039;&#039; recommended to test yourself against the [https://02002.compute.dtu.dk/additional/previous_exams.html#previous-exams exams of 02002] before taking this course, if you come from abroad.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=317</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=317"/>
		<updated>2026-06-23T09:09:36Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; Course 02002: It is &#039;&#039;&#039;STRONGLY&#039;&#039;&#039; recommended to test yourself against the [https://02002.compute.dtu.dk/additional/previous_exams.html#previous-exams exams of 02002] before taking this course, if you come from abroad.&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Programme&amp;diff=316</id>
		<title>Programme</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Programme&amp;diff=316"/>
		<updated>2026-06-23T09:03:30Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;[[Collection of files]]&#039;&#039;&#039; &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;used in the exercises and lessons&amp;lt;/font&amp;gt; - all gathered here.&lt;br /&gt;
&lt;br /&gt;
* 31/08 Lesson 1: [[Python recap]]&lt;br /&gt;
* 07/09 Lesson 2: [[The path and simple file reading]]&lt;br /&gt;
* 14/09 Lesson 3: [[Pseudocode and comments]]&lt;br /&gt;
* 21/09 Lesson 4: [[String manipulation]]&lt;br /&gt;
* 28/09 Lesson 5: [[Exceptions and bug handling]]&lt;br /&gt;
* 05/10 Lesson 6: [[Stateful parsing]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 1&lt;br /&gt;
* Fall holidays&lt;br /&gt;
* 19/10 Lesson 7 [[List manipulation]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 2&lt;br /&gt;
* 26/10 Lesson 8: [[Functions]]&lt;br /&gt;
* 02/11 Lesson 9: [[Simple pattern matching]]&lt;br /&gt;
* 09/11 Lesson 10: [[Set techniques]]&lt;br /&gt;
* 16/11 Lesson 11: [[Dict techniques]]&lt;br /&gt;
* 23/11 Lesson 12: [[Regular expressions]]&lt;br /&gt;
* 30/11 Lesson 13: [[Python object model]]&lt;br /&gt;
* 09/12 Exam - [http://eksamensplan.dtu.dk/ the official DTU exam plan] [https://student.dtu.dk/eksamen/eksamensdatoer Exam dates]&lt;br /&gt;
&lt;br /&gt;
== Curious about the exam ==&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/index.php/How_the_course_is_conducted#Preparation_for_exam Read this]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Programme&amp;diff=315</id>
		<title>Programme</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Programme&amp;diff=315"/>
		<updated>2026-06-23T09:02:41Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;[[Collection of files]]&#039;&#039;&#039; &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;used in the exercises and lessons&amp;lt;/font&amp;gt; - all gathered here.&lt;br /&gt;
&lt;br /&gt;
* 31/08 Lesson 1: [[Python recap]]&lt;br /&gt;
* 07/09 Lesson 2: [[The path and simple file reading]]&lt;br /&gt;
* 14/09 Lesson 3: [[Pseudocode and comments]]&lt;br /&gt;
* 21/09 Lesson 4: [[String manipulation]]&lt;br /&gt;
* 28/09 Lesson 5: [[Exceptions and bug handling]]&lt;br /&gt;
* 05/10 Lesson 6: [[Stateful parsing]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 1&lt;br /&gt;
* Fall holidays&lt;br /&gt;
* 19/10 Lesson 7 [[List manipulation]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 2&lt;br /&gt;
* 26/10 Lesson 8: [[Functions]]&lt;br /&gt;
* 02/11 Lesson 9: [[Simple pattern matching]]&lt;br /&gt;
* 09/11 Lesson 10: [[Set techniques]]&lt;br /&gt;
* 16/11 Lesson 11: [[Dict techniques]]&lt;br /&gt;
* 23/11 Lesson 12: [[Regular expressions]]&lt;br /&gt;
* 30/11 Lesson 13: [[Python object model]]&lt;br /&gt;
* 10/12 Exam - [http://eksamensplan.dtu.dk/ the official DTU exam plan] [https://student.dtu.dk/eksamen/eksamensdatoer Exam dates]&lt;br /&gt;
&lt;br /&gt;
== Curious about the exam ==&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/index.php/How_the_course_is_conducted#Preparation_for_exam Read this]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=314</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=314"/>
		<updated>2026-06-23T08:57:25Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Course details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2026&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Programme_Fall_2025&amp;diff=313</id>
		<title>Programme Fall 2025</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=Programme_Fall_2025&amp;diff=313"/>
		<updated>2026-06-23T08:57:01Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Collection of files&amp;#039;&amp;#039;&amp;#039; &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;used in the exercises and lessons&amp;lt;/font&amp;gt; - all gathered here.  * 01/09 Lesson 1: Python recap * 08/09 Lesson 2: The path and simple file reading * 15/09 Lesson 3: Pseudocode and comments * 22/09 Lesson 4: String manipulation * 29/09 Lesson 5: Exceptions and bug handling * 06/10 Lesson 6: Stateful parsing, [https://evaluering.dtu.dk/ Midterm evaluation] - part 1 * Fall holidays * 20/10 Lesson 7 List...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;[[Collection of files]]&#039;&#039;&#039; &amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;used in the exercises and lessons&amp;lt;/font&amp;gt; - all gathered here.&lt;br /&gt;
&lt;br /&gt;
* 01/09 Lesson 1: [[Python recap]]&lt;br /&gt;
* 08/09 Lesson 2: [[The path and simple file reading]]&lt;br /&gt;
* 15/09 Lesson 3: [[Pseudocode and comments]]&lt;br /&gt;
* 22/09 Lesson 4: [[String manipulation]]&lt;br /&gt;
* 29/09 Lesson 5: [[Exceptions and bug handling]]&lt;br /&gt;
* 06/10 Lesson 6: [[Stateful parsing]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 1&lt;br /&gt;
* Fall holidays&lt;br /&gt;
* 20/10 Lesson 7 [[List manipulation]], [https://evaluering.dtu.dk/ Midterm evaluation] - part 2&lt;br /&gt;
* 27/10 Lesson 8: [[Functions]]&lt;br /&gt;
* 03/11 Lesson 9: [[Simple pattern matching]]&lt;br /&gt;
* 10/11 Lesson 10: [[Set techniques]]&lt;br /&gt;
* 17/11 Lesson 11: [[Dict techniques]]&lt;br /&gt;
* 24/11 Lesson 12: [[Regular expressions]]&lt;br /&gt;
* 01/12 Lesson 13: [[Python object model]]&lt;br /&gt;
* 10/12 Exam - [http://eksamensplan.dtu.dk/ the official DTU exam plan] [https://student.dtu.dk/eksamen/eksamensdatoer Exam dates]&lt;br /&gt;
&lt;br /&gt;
== Curious about the exam ==&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/index.php/How_the_course_is_conducted#Preparation_for_exam Read this]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=312</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=312"/>
		<updated>2026-06-23T08:56:51Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Archive of old course programmes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2025&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
[[Programme Fall 2025]]&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=311</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=311"/>
		<updated>2026-06-12T13:14:54Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Course details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2025&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22118/index.php/Mini_projects Mini projects] Smaller projects (larger than exercises) for practicing programming.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
None yet, as the course is new.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=310</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=310"/>
		<updated>2026-01-14T07:48:26Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Requirements for taking the course */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Monday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 7 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;There will be some hand-in time irregularity at the end of the semester, due to exams. Pay attention.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. You can only evaluate if you have handed in exercises, so the hand-in is required.&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a Jupyter Notebook for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation. Many people use VScode for this, but it is up to you. In the last part of the course, this is changed to a &#039;&#039;&#039;.py&#039;&#039;&#039; file, to get you used to how the exam will be.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
DTU Learn does not allow for late hand-in. Set an alarm on your phone to remember.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements for taking the course ==&lt;br /&gt;
&#039;&#039;&#039;You most take this seriously. Half of the students failed the course first year it ran.&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This course requires that you have previously taken 5 ECTS in a beginner course in programming. DTU students have taken [https://kurser.dtu.dk/course/02002 02002 Computer Programming (Polytechnical Foundation)], however foreign Master students are more of a mixed group. This course can NOT be treated as your first real programming course - it is your second, and the difficulty of the course and exam reflects that. I have tried to make the course accessible to people with a moderate background in programming, but it is not a free ride. I have an obsolete beginner course [https://teaching.healthtech.dtu.dk/22101/ 22101 Introduction to programming in Life Science using Python] which you can learn from on your own, if your background is insufficient and you want to take this course anyway.&lt;br /&gt;
&lt;br /&gt;
Using AI/ChatGPT is a bad idea. From my observations and exam results, the use of AI hinders the acquisition of &amp;quot;programmatic thinking&amp;quot;. This skill is what the course is about - the core competence. When asking AI about a problem, you are usually served a solution. Even if you understand the solution, then you have not gone through the process of thinking the solution. It weakens your thinking enormously, you don&#039;t &amp;quot;own&amp;quot; the solution and you are not getting used to thinking about programming problems. This becomes a big problem at exam time, because you think you are OK, but you have not acquired the correct thinking and the exam will seem very hard. Yes, there are a number of elements in the exam that we have been going through in the course, but there are also new elements (not python elements, but logic problems) where you have to think your way through.&lt;br /&gt;
&lt;br /&gt;
You can read these American studies showing how the use of AI damages your thinking:&lt;br /&gt;
[https://www.microsoft.com/en-us/research/wp-content/uploads/2025/01/lee_2025_ai_critical_thinking_survey.pdf The Impact of Generative AI on Critical Thinking: Self-Reported Reductions in Cognitive Effort and Confidence Effects From a Survey of Knowledge Workers] and [https://arxiv.org/abs/2506.08872 Your Brain on ChatGPT: Accumulation of Cognitive Debt when Using an AI Assistant for Essay Writing Task].&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, you will be asked many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes. &#039;&#039;They can be found on DTU Learn under Discussions&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using python elements not in the curriculum ==&lt;br /&gt;
Most people sooner or later use python not in the curriculum, or not yet covered by the course progression. There are several reasons for that: They know some python from other courses, they have been using AI to create solutions, they have been reading ahead or they have searched the internet for answers.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While knowledge is good, then there is a reason for why the exercises and the learning materials (powerpoint) are as they are - it is a designed course progression. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
By not following the course progression, then you are not learning to analyze or formulate strategies.&lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Also, it brings problems to peer evaluation, as not everyone knows python that is outside the curriculum.&lt;br /&gt;
&lt;br /&gt;
If you want to show some fancy python (i.e. outside the curriculum/progression), then make TWO solutions to the exercise. One that shows the fancy python and one that follows the curriculum and the course progression. The last one can then be used for peer evaluation. If you find yourself unable to make a solution that follows the course progression, then maybe you should study the subject some more.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a 4 hour written exam. You will get the assignments, the input files that you have to use/read/parse, and the output files that you have to create. Most importantly, you will also get a &#039;&#039;&#039;.py&#039;&#039;&#039; file that you will have to fill out. That is basically a text file with python code, that mostly contains empty functions. You have to fill out the functions with python code that solves the assignments.&amp;lt;br&amp;gt;YOU CAN NOT HAND IN A JUPYTER NOTEBOOK FILE. Your exam hand-in is only the filled out &#039;&#039;&#039;.py&#039;&#039;&#039; file. &lt;br /&gt;
&lt;br /&gt;
The last lesson [[Python object model]]&#039;s exercises is an example of the exam format - not the exam content. All the exercises has to be handed in in one single .py file. Every exercise is one individual python function, which calls some specified other functions which together solves the exercise. You can add your own functions, if you feel some functionality is missing, but you must fill and use those given by the exam &#039;&#039;&#039;.py&#039;&#039;&#039; file. Follow the naming scheme for your own functions - it should be obvious.&lt;br /&gt;
&lt;br /&gt;
You are expected to solve the assignments using the course curriculum. In particular, it means &amp;quot;pure&amp;quot; python, maybe using standard libraries like os, sys, re, math and others, but not 3rd party libraries like pandas or numpy. It also means use of comments to explain what you are doing, and employ code modularization.&lt;br /&gt;
&lt;br /&gt;
Comments that just explains your intentions, but are not supported by code, are disregarded. You can not &amp;quot;talk&amp;quot; your way to a pass, you must code your way to a pass.&lt;br /&gt;
&lt;br /&gt;
At the exam there will be 2 assignments - &#039;&#039;&#039;not&#039;&#039;&#039; 6 exercises - that you have to solve.&lt;br /&gt;
&lt;br /&gt;
Exam aids: You can bring your computer with all the material from the course; powerpoints, exercises, solutions, etc. There is NO INTERNET and NO AI allowed. In the end, it is the programming skill you acquired during the course, that will make you pass - not any aid you bring. That is why we are doing so many difficult exercises.&lt;br /&gt;
&lt;br /&gt;
=== How much is required to pass? ===&lt;br /&gt;
The &#039;&#039;&#039;.py&#039;&#039;&#039; file is mostly structure and does not give much advice in how to solve the assignments. It is for you to show that you have learned to analyze a programming problem and come up with a solution. As you will be given both the input files and the output files, you can check how well you have succeeded. A correct solution to both assignments is an automatic pass. A correct solution to only one assignment, without any constructive work (in my evaluation) on the other assignment is not enough for a pass. No correct solutions, but writing good sensible code (again in my evaluation) can pass, as it shows you have learned essential things in the course. Comments are part the the essential things.&amp;lt;br&amp;gt;&lt;br /&gt;
In the end, unless you passed automatically, it comes down to a overall evaluation of your hand-in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There are usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=309</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=309"/>
		<updated>2026-01-14T07:46:35Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Requirements for taking the course */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Monday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 7 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;There will be some hand-in time irregularity at the end of the semester, due to exams. Pay attention.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. You can only evaluate if you have handed in exercises, so the hand-in is required.&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a Jupyter Notebook for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation. Many people use VScode for this, but it is up to you. In the last part of the course, this is changed to a &#039;&#039;&#039;.py&#039;&#039;&#039; file, to get you used to how the exam will be.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
DTU Learn does not allow for late hand-in. Set an alarm on your phone to remember.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements for taking the course ==&lt;br /&gt;
&#039;&#039;&#039;You most take this seriously. Half of the students failed the course first year it ran.&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This course requires that you have previously taken 5 ECTS in a beginner course in programming. DTU students have taken [https://kurser.dtu.dk/course/02002 02002 Computer Programming (Polytechnical Foundation)], however foreign Master students are more of a mixed group. This course can NOT be treated as your first real programming course - it is your second, and the difficulty of the course and exam reflects that. I have tried to make the course accessible to people with a moderate background in programming, but it is not a free ride. I have an obsolete beginner course [https://teaching.healthtech.dtu.dk/22101/ 22101 Introduction to programming in Life Science using Python] which you can learn from on your own, if your background is insufficient and you want to take this course anyway.&lt;br /&gt;
&lt;br /&gt;
Using AI/ChatGPT is a bad idea. From my observations and exam results, the use of AI hinders the acquisition of &amp;quot;programmatic thinking&amp;quot;. This skill is what the course is about - the core competence. When asking AI about a problem, you are usually served a solution. Even if you understand the solution, then you have not gone through the process of thinking the solution. It weakens your thinking enormously, you don&#039;t &amp;quot;own&amp;quot; the solution and you are not getting used to thinking about programming problems. This becomes a big problem at exam time, because you think you are OK, but you have not acquired the correct thinking and the exam will seem very hard. Yes, there are a number of elements in the exam that we have been going through in the course, but there are also new elements (not python elements, but logic problems) where you have to think your way through.&lt;br /&gt;
&lt;br /&gt;
You can read these American studies showing how the use of AI damages your thinking: [https://www.microsoft.com/en-us/research/wp-content/uploads/2025/01/lee_2025_ai_critical_thinking_survey.pdf The Impact of Generative AI on Critical Thinking: Self-Reported&lt;br /&gt;
Reductions in Cognitive Effort and Confidence Effects From a Survey of Knowledge Workers], [https://arxiv.org/abs/2506.08872 Your Brain on ChatGPT: Accumulation of Cognitive Debt when Using an AI Assistant for Essay Writing Task].&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, you will be asked many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes. &#039;&#039;They can be found on DTU Learn under Discussions&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using python elements not in the curriculum ==&lt;br /&gt;
Most people sooner or later use python not in the curriculum, or not yet covered by the course progression. There are several reasons for that: They know some python from other courses, they have been using AI to create solutions, they have been reading ahead or they have searched the internet for answers.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While knowledge is good, then there is a reason for why the exercises and the learning materials (powerpoint) are as they are - it is a designed course progression. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
By not following the course progression, then you are not learning to analyze or formulate strategies.&lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Also, it brings problems to peer evaluation, as not everyone knows python that is outside the curriculum.&lt;br /&gt;
&lt;br /&gt;
If you want to show some fancy python (i.e. outside the curriculum/progression), then make TWO solutions to the exercise. One that shows the fancy python and one that follows the curriculum and the course progression. The last one can then be used for peer evaluation. If you find yourself unable to make a solution that follows the course progression, then maybe you should study the subject some more.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a 4 hour written exam. You will get the assignments, the input files that you have to use/read/parse, and the output files that you have to create. Most importantly, you will also get a &#039;&#039;&#039;.py&#039;&#039;&#039; file that you will have to fill out. That is basically a text file with python code, that mostly contains empty functions. You have to fill out the functions with python code that solves the assignments.&amp;lt;br&amp;gt;YOU CAN NOT HAND IN A JUPYTER NOTEBOOK FILE. Your exam hand-in is only the filled out &#039;&#039;&#039;.py&#039;&#039;&#039; file. &lt;br /&gt;
&lt;br /&gt;
The last lesson [[Python object model]]&#039;s exercises is an example of the exam format - not the exam content. All the exercises has to be handed in in one single .py file. Every exercise is one individual python function, which calls some specified other functions which together solves the exercise. You can add your own functions, if you feel some functionality is missing, but you must fill and use those given by the exam &#039;&#039;&#039;.py&#039;&#039;&#039; file. Follow the naming scheme for your own functions - it should be obvious.&lt;br /&gt;
&lt;br /&gt;
You are expected to solve the assignments using the course curriculum. In particular, it means &amp;quot;pure&amp;quot; python, maybe using standard libraries like os, sys, re, math and others, but not 3rd party libraries like pandas or numpy. It also means use of comments to explain what you are doing, and employ code modularization.&lt;br /&gt;
&lt;br /&gt;
Comments that just explains your intentions, but are not supported by code, are disregarded. You can not &amp;quot;talk&amp;quot; your way to a pass, you must code your way to a pass.&lt;br /&gt;
&lt;br /&gt;
At the exam there will be 2 assignments - &#039;&#039;&#039;not&#039;&#039;&#039; 6 exercises - that you have to solve.&lt;br /&gt;
&lt;br /&gt;
Exam aids: You can bring your computer with all the material from the course; powerpoints, exercises, solutions, etc. There is NO INTERNET and NO AI allowed. In the end, it is the programming skill you acquired during the course, that will make you pass - not any aid you bring. That is why we are doing so many difficult exercises.&lt;br /&gt;
&lt;br /&gt;
=== How much is required to pass? ===&lt;br /&gt;
The &#039;&#039;&#039;.py&#039;&#039;&#039; file is mostly structure and does not give much advice in how to solve the assignments. It is for you to show that you have learned to analyze a programming problem and come up with a solution. As you will be given both the input files and the output files, you can check how well you have succeeded. A correct solution to both assignments is an automatic pass. A correct solution to only one assignment, without any constructive work (in my evaluation) on the other assignment is not enough for a pass. No correct solutions, but writing good sensible code (again in my evaluation) can pass, as it shows you have learned essential things in the course. Comments are part the the essential things.&amp;lt;br&amp;gt;&lt;br /&gt;
In the end, unless you passed automatically, it comes down to a overall evaluation of your hand-in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There are usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=308</id>
		<title>22116/22166 Python programming in Life Science</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=22116/22166_Python_programming_in_Life_Science&amp;diff=308"/>
		<updated>2025-12-22T14:54:02Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
&#039;&#039;&#039;Teacher:&#039;&#039;&#039; [https://www.inside.dtu.dk/da/dtuinside/generelt/telefonbog/person?id=816&amp;amp;cpid=214027&amp;amp;tab=2&amp;amp;qt=dtupublicationquery Peter Wad Sackett], pwsa@dtu.dk &amp;lt;!--, [https://www.inside.dtu.dk/en/dtuinside/generelt/telefonbog/person?id=130596&amp;amp;tab=0 Gisle Alberg Vestergaard], gisves@dtu.dk --&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Language:&#039;&#039;&#039; The course is taught in English.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Tools:&#039;&#039;&#039; The course is using the standard DTU python setup, see [https://pythonsupport.dtu.dk/ https://pythonsupport.dtu.dk/] if you do not have it already.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Textbooks:&#039;&#039;&#039; I believe students should not pay at lot of money for textbooks. I will use powerpoints, videos and references to online resources. You can find the material under the individual lessons in the [[Programme]].&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Location:&#039;&#039;&#039; Building 358, room 60b + streaming to room 046, no matter what your plan says. Course 22116 and 22166 are taught together.&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Time:&#039;&#039;&#039; Monday 13:00 - 17:00, module E2-A.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Course details ==&lt;br /&gt;
There are no plans for streaming the lectures. &amp;lt;!-- as there already are some recorded video lectures for each session. However, with over 180 students two teaching rooms must be used. I will stream the teaching from one room to the other. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Programme]] Fall 2025&lt;br /&gt;
&lt;br /&gt;
[https://teaching.healthtech.dtu.dk/22116/progress/ See the progress of your hand-ins]&lt;br /&gt;
&lt;br /&gt;
[[How the course is conducted]] Required reading - read or fail.&lt;br /&gt;
&lt;br /&gt;
[[Course Survival Guide]] Useful when you get stuck early&lt;br /&gt;
&lt;br /&gt;
[[AI guidelines for the course]] You want to use AI, then you MUST read it.&lt;br /&gt;
&lt;br /&gt;
[[Good code]] Always keep this in mind&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
[https://docs.google.com/spreadsheets/d/1wEs2xS-7DmpMvtosweTzYw0Fx3_XCbz4k5cuN5tJVK8/edit?usp=sharing Put yourself on the Get Help list]&lt;br /&gt;
&lt;br /&gt;
[[Course First Aid]]&lt;br /&gt;
&lt;br /&gt;
[[Grading]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Competences ==&lt;br /&gt;
A general engineering competence skill is the ability to explain the process through which you obtain your results - how else can they be trusted?&lt;br /&gt;
Learning to program is a great way to practice that skill, since you have to explain to the computer how it is supposed to solve the task you give.&lt;br /&gt;
This explanation must pay attention to detail, specifically identifying and ordering the elements of the solution. &lt;br /&gt;
This nurtures and strengthens an analytical and structured mindset which is also an essential engineering competence skill.&lt;br /&gt;
Training these skills is obviously beneficial for the student, but they do not come for free - it is &#039;&#039;&#039;hard work&#039;&#039;&#039;, so put the time aside for it.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
* Online: [https://teaching.healthtech.dtu.dk/material/22116/clean_code.html Clean Code] by Lukasz Dynowski. An amazing read that is mandatory. Read it once around lesson 5 and once more around lesson 8.&lt;br /&gt;
* Info: [[Biological knowledge needed in the course]]&lt;br /&gt;
* Online: [https://rosalind.info/problems/locations/ Rosalind project] Python exercises at different levels for practicing &lt;br /&gt;
&lt;br /&gt;
* Online: [https://www.coursera.org/learn/python Coursera course: Programming for Everybody] is a beginner course in Python. Everyone who wants to prepare for course 22116/22166 can start here. Just get far enough so you understand what programming is and how it works. That will benefit you a lot as a newbie. The [https://teaching.healthtech.dtu.dk/material/22118/CourseraPythonBook_270.pdf Coursera textbook].&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Learning Python&#039;&#039;, 5th ed. by Mark Lutz (O&#039;Reilly) ISBN: 978-1-449-35573-9. This is the best Python book I have read. It covers all the basics and then some. All from the perspective of being a novice programmer. However, it is a brick; big, heavy and unwieldy. If you only want one Python book, then this should be the one. The course will not be taught from this book, but it could be good to have as a Python reference manual.&lt;br /&gt;
&lt;br /&gt;
* Book: &#039;&#039;Python Crash Course: A Hands-On, Project-Based Introduction to Programming&#039;&#039; by Eric Matthes (No Starch Press) ISBN: 1593276036, 9781593276034. A pretty OK book which leads you into the Python world without too many distracting points and theoretical contemplation.&lt;br /&gt;
&lt;br /&gt;
* Online: [https://wiki.python.org/moin/BeginnersGuide/NonProgrammers Python for Non-Programmers]&lt;br /&gt;
* Online: [https://docs.python.org/3/tutorial/ Official Python 3 tutorial]&lt;br /&gt;
* Online: [https://docs.python.org/3/reference/index.html Python 3 reference manual]&lt;br /&gt;
* Online: [https://docs.python.org/3/library/index.html Python 3 standard library]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Videos with advice on learning how to code&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=A8ldqcFS5S8 How I Would Learn To Code If I Was To Start Over] by Tiff In Tech&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=_nsV65jUPL8 Coding Was Hard Until I Learned THESE 5 Things!] by Pooja Dutt&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=MHPGeQD8TvI How I would learn to code (if I could start over)] by Tina Huang&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=To8hKb112Aw How I would learn to code (if I could start over)] by PIRATE KING&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=9s29LKfEFjQ How I would learn to code (If I could start over)] by Jason Goodison&lt;br /&gt;
* Youtube: [https://www.youtube.com/watch?v=NtfbWkxJTHw How to Learn to Code - 8 Hard Truths] by Fireship&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Interesting but less teaching oriented material&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
* Online: [http://ivory.idyll.org/blog/big-data-biology.html Top 12 reasons you know you are a Big Data biologist]&lt;br /&gt;
* Online: [http://lifehacker.com/six-life-lessons-ive-learned-from-programming-1502077380 How programming and your life is similar]&lt;br /&gt;
* Youtube: [http://www.youtube.com/watch?v=nKIu9yen5nc What most schools don&#039;t teach - how to think]&lt;br /&gt;
&lt;br /&gt;
== Archive of old course programmes ==&lt;br /&gt;
None yet, as the course is new.&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=307</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=307"/>
		<updated>2025-12-22T14:53:01Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Preparation for exam */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Monday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 7 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;There will be some hand-in time irregularity at the end of the semester, due to exams. Pay attention.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. You can only evaluate if you have handed in exercises, so the hand-in is required.&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a Jupyter Notebook for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation. Many people use VScode for this, but it is up to you. In the last part of the course, this is changed to a &#039;&#039;&#039;.py&#039;&#039;&#039; file, to get you used to how the exam will be.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
DTU Learn does not allow for late hand-in. Set an alarm on your phone to remember.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements for taking the course ==&lt;br /&gt;
&#039;&#039;&#039;You most take this seriously. Half of the students failed the course first year it ran.&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This course requires that you have previously taken 5 ECTS in a beginner course in programming. DTU students have taken [https://kurser.dtu.dk/course/02002 02002 Computer Programming (Polytechnical Foundation)], however foreign Master students are more of a mixed group. This course can NOT be treated as your first real programming course - it is your second, and the difficulty of the course and exam reflects that. I have tried to make the course accessible to people with a moderate background in programming, but it is not a free ride. I have an obsolete beginner course [https://teaching.healthtech.dtu.dk/22101/ 22101 Introduction to programming in Life Science using Python] which you can learn from on your own, if your background is insufficient and you want to take this course anyway.&lt;br /&gt;
&lt;br /&gt;
Using AI/ChatGPT is a bad idea. From my observations and exam results, the use of AI hinders the acquisition of &amp;quot;programmatic thinking&amp;quot;. This skill is what the course is about - the core competence. When asking AI about a problem, you are usually served a solution. Even if you understand the solution, then you have not gone through the process of thinking the solution. It weakens your thinking enormously, you don&#039;t &amp;quot;own&amp;quot; the solution and you are not getting used to thinking about programming problems. This becomes a big problem at exam time, because you think you are OK, but you have not acquired the correct thinking and the exam will seem very hard. Yes, there are a number of elements in the exam that we have been going through in the course, but there are also new elements (not python elements, but logic problems) where you have to think your way through.&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, you will be asked many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes. &#039;&#039;They can be found on DTU Learn under Discussions&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using python elements not in the curriculum ==&lt;br /&gt;
Most people sooner or later use python not in the curriculum, or not yet covered by the course progression. There are several reasons for that: They know some python from other courses, they have been using AI to create solutions, they have been reading ahead or they have searched the internet for answers.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While knowledge is good, then there is a reason for why the exercises and the learning materials (powerpoint) are as they are - it is a designed course progression. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
By not following the course progression, then you are not learning to analyze or formulate strategies.&lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Also, it brings problems to peer evaluation, as not everyone knows python that is outside the curriculum.&lt;br /&gt;
&lt;br /&gt;
If you want to show some fancy python (i.e. outside the curriculum/progression), then make TWO solutions to the exercise. One that shows the fancy python and one that follows the curriculum and the course progression. The last one can then be used for peer evaluation. If you find yourself unable to make a solution that follows the course progression, then maybe you should study the subject some more.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a 4 hour written exam. You will get the assignments, the input files that you have to use/read/parse, and the output files that you have to create. Most importantly, you will also get a &#039;&#039;&#039;.py&#039;&#039;&#039; file that you will have to fill out. That is basically a text file with python code, that mostly contains empty functions. You have to fill out the functions with python code that solves the assignments.&amp;lt;br&amp;gt;YOU CAN NOT HAND IN A JUPYTER NOTEBOOK FILE. Your exam hand-in is only the filled out &#039;&#039;&#039;.py&#039;&#039;&#039; file. &lt;br /&gt;
&lt;br /&gt;
The last lesson [[Python object model]]&#039;s exercises is an example of the exam format - not the exam content. All the exercises has to be handed in in one single .py file. Every exercise is one individual python function, which calls some specified other functions which together solves the exercise. You can add your own functions, if you feel some functionality is missing, but you must fill and use those given by the exam &#039;&#039;&#039;.py&#039;&#039;&#039; file. Follow the naming scheme for your own functions - it should be obvious.&lt;br /&gt;
&lt;br /&gt;
You are expected to solve the assignments using the course curriculum. In particular, it means &amp;quot;pure&amp;quot; python, maybe using standard libraries like os, sys, re, math and others, but not 3rd party libraries like pandas or numpy. It also means use of comments to explain what you are doing, and employ code modularization.&lt;br /&gt;
&lt;br /&gt;
Comments that just explains your intentions, but are not supported by code, are disregarded. You can not &amp;quot;talk&amp;quot; your way to a pass, you must code your way to a pass.&lt;br /&gt;
&lt;br /&gt;
At the exam there will be 2 assignments - &#039;&#039;&#039;not&#039;&#039;&#039; 6 exercises - that you have to solve.&lt;br /&gt;
&lt;br /&gt;
Exam aids: You can bring your computer with all the material from the course; powerpoints, exercises, solutions, etc. There is NO INTERNET and NO AI allowed. In the end, it is the programming skill you acquired during the course, that will make you pass - not any aid you bring. That is why we are doing so many difficult exercises.&lt;br /&gt;
&lt;br /&gt;
=== How much is required to pass? ===&lt;br /&gt;
The &#039;&#039;&#039;.py&#039;&#039;&#039; file is mostly structure and does not give much advice in how to solve the assignments. It is for you to show that you have learned to analyze a programming problem and come up with a solution. As you will be given both the input files and the output files, you can check how well you have succeeded. A correct solution to both assignments is an automatic pass. A correct solution to only one assignment, without any constructive work (in my evaluation) on the other assignment is not enough for a pass. No correct solutions, but writing good sensible code (again in my evaluation) can pass, as it shows you have learned essential things in the course. Comments are part the the essential things.&amp;lt;br&amp;gt;&lt;br /&gt;
In the end, unless you passed automatically, it comes down to a overall evaluation of your hand-in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There are usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=306</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=306"/>
		<updated>2025-12-22T14:50:23Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Requirements for taking the course */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Monday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 7 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;There will be some hand-in time irregularity at the end of the semester, due to exams. Pay attention.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. You can only evaluate if you have handed in exercises, so the hand-in is required.&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a Jupyter Notebook for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation. Many people use VScode for this, but it is up to you. In the last part of the course, this is changed to a &#039;&#039;&#039;.py&#039;&#039;&#039; file, to get you used to how the exam will be.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
DTU Learn does not allow for late hand-in. Set an alarm on your phone to remember.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements for taking the course ==&lt;br /&gt;
&#039;&#039;&#039;You most take this seriously. Half of the students failed the course first year it ran.&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This course requires that you have previously taken 5 ECTS in a beginner course in programming. DTU students have taken [https://kurser.dtu.dk/course/02002 02002 Computer Programming (Polytechnical Foundation)], however foreign Master students are more of a mixed group. This course can NOT be treated as your first real programming course - it is your second, and the difficulty of the course and exam reflects that. I have tried to make the course accessible to people with a moderate background in programming, but it is not a free ride. I have an obsolete beginner course [https://teaching.healthtech.dtu.dk/22101/ 22101 Introduction to programming in Life Science using Python] which you can learn from on your own, if your background is insufficient and you want to take this course anyway.&lt;br /&gt;
&lt;br /&gt;
Using AI/ChatGPT is a bad idea. From my observations and exam results, the use of AI hinders the acquisition of &amp;quot;programmatic thinking&amp;quot;. This skill is what the course is about - the core competence. When asking AI about a problem, you are usually served a solution. Even if you understand the solution, then you have not gone through the process of thinking the solution. It weakens your thinking enormously, you don&#039;t &amp;quot;own&amp;quot; the solution and you are not getting used to thinking about programming problems. This becomes a big problem at exam time, because you think you are OK, but you have not acquired the correct thinking and the exam will seem very hard. Yes, there are a number of elements in the exam that we have been going through in the course, but there are also new elements (not python elements, but logic problems) where you have to think your way through.&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, you will be asked many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes. &#039;&#039;They can be found on DTU Learn under Discussions&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using python elements not in the curriculum ==&lt;br /&gt;
Most people sooner or later use python not in the curriculum, or not yet covered by the course progression. There are several reasons for that: They know some python from other courses, they have been using AI to create solutions, they have been reading ahead or they have searched the internet for answers.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While knowledge is good, then there is a reason for why the exercises and the learning materials (powerpoint) are as they are - it is a designed course progression. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
By not following the course progression, then you are not learning to analyze or formulate strategies.&lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Also, it brings problems to peer evaluation, as not everyone knows python that is outside the curriculum.&lt;br /&gt;
&lt;br /&gt;
If you want to show some fancy python (i.e. outside the curriculum/progression), then make TWO solutions to the exercise. One that shows the fancy python and one that follows the curriculum and the course progression. The last one can then be used for peer evaluation. If you find yourself unable to make a solution that follows the course progression, then maybe you should study the subject some more.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a 4 hour written exam. You will get the assignments, the input files that you have to use/read/parse, and the output files that you have to create. Most importantly, you will also get a &#039;&#039;&#039;.py&#039;&#039;&#039; file that you will have to fill out. That is basically a text file with python code, that mostly contains empty functions. You have to fill out the functions with python code that solves the assignments.&amp;lt;br&amp;gt;YOU CAN NOT HAND IN A JUPYTER NOTEBOOK FILE. Your exam hand-in is only the filled out &#039;&#039;&#039;.py&#039;&#039;&#039; file. &lt;br /&gt;
&lt;br /&gt;
The last lesson [[Python object model]]&#039;s exercises is an example of the exam format - not the exam content. All the exercises has to be handed in in one single .py file. Every exercise is one individual python function, which calls some specified other functions which together solves the exercise. You can add your own functions, if you feel some functionality is missing, but you must fill and use those given by the exam &#039;&#039;&#039;.py&#039;&#039;&#039; file. Follow the naming scheme for your own functions - it should be obvious.&lt;br /&gt;
&lt;br /&gt;
You are expected to solve the assignments using the course curriculum. In particular, it means &amp;quot;pure&amp;quot; python, maybe using standard libraries like os, sys, re, math and others, but not 3rd party libraries like pandas or numpy. It also means use of comments to explain what you are doing, and employ code modularization.&lt;br /&gt;
&lt;br /&gt;
Comments that just explains your intentions, but are not supported by code, are disregarded. You can not &amp;quot;talk&amp;quot; your way to a pass, you must code your way to a pass.&lt;br /&gt;
&lt;br /&gt;
At the exam there will likely be 2 assignments - &#039;&#039;&#039;not&#039;&#039;&#039; 6 exercises - that you have to solve.&lt;br /&gt;
&lt;br /&gt;
Exam aids: You can bring your computer with all the material from the course; powerpoints, exercises, solutions, etc. There is NO INTERNET and NO AI allowed. In the end, it is the programming skill you acquired during the course, that will make you pass - not any aid you bring. That is why we are doing so many difficult exercises.&lt;br /&gt;
&lt;br /&gt;
=== How much is required to pass? ===&lt;br /&gt;
The &#039;&#039;&#039;.py&#039;&#039;&#039; file is mostly structure and does not give much advice in how to solve the assignments. It is for you to show that you have learned to analyze a programming problem and come up with a solution. As you will be given both the input files and the output files, you can check how well you have succeeded. A correct solution to both assignments is an automatic pass. A correct solution to only one assignment, without any constructive work (in my evaluation) on the other assignment is not enough for a pass. No correct solutions, but writing good sensible code (again in my evaluation) can pass, as it shows you have learned essential things in the course. Comments are part the the essential things.&amp;lt;br&amp;gt;&lt;br /&gt;
In the end, unless you passed automatically, it comes down to a overall evaluation of your hand-in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There are usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=305</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=305"/>
		<updated>2025-12-22T14:49:32Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Requirements for taking the course */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Monday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 7 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;There will be some hand-in time irregularity at the end of the semester, due to exams. Pay attention.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. You can only evaluate if you have handed in exercises, so the hand-in is required.&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a Jupyter Notebook for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation. Many people use VScode for this, but it is up to you. In the last part of the course, this is changed to a &#039;&#039;&#039;.py&#039;&#039;&#039; file, to get you used to how the exam will be.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
DTU Learn does not allow for late hand-in. Set an alarm on your phone to remember.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements for taking the course ==&lt;br /&gt;
&#039;&#039;&#039;You most take this seriously. Half of the students failed the course first year it ran.&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This course requires that you have previously taken 5 ECTS in a beginner course in programming. DTU students have taken [https://kurser.dtu.dk/course/02002 02002 Computer Programming (Polytechnical Foundation)], however foreign Master students are more of a mixed group. This course can NOT be treated as your first real programming course - it is your second, and the difficulty of the course and exam reflects that. I have tried to make the course accessible to people with a moderate background in programming, but it is not a free ride. I have an obsolete beginner course [https://teaching.healthtech.dtu.dk/22101/ 22101 Introduction to programming in Life Science using Python] which you can learn from on your own, if your background is insufficient and you want to take this course anyway.&lt;br /&gt;
&lt;br /&gt;
Using AI/ChatGPT is a bad idea. From my observations and exam results, the use of AI hinders the acquisition of &amp;quot;programmatic thinking&amp;quot;. This skill is what the course is about - the core competence. When asking AI about a problem, you are usually served a solution. Even if you understand the solution, then you have not gone through the process of thinking the solution. It weakens your thinking enormously, you don&#039;t &amp;quot;own&amp;quot; the solution and you are not getting used to thinking about programming problems. This becomes a big problem at exam time, because you think you are OK, but you have not acquired the correct thinking and the exam will seem very hard. Yes, there are a number of elements in the exam that we have been going through in the course, but there are also new elements (not python elements, but logic problems) where you think your way through.&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, you will be asked many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes. &#039;&#039;They can be found on DTU Learn under Discussions&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using python elements not in the curriculum ==&lt;br /&gt;
Most people sooner or later use python not in the curriculum, or not yet covered by the course progression. There are several reasons for that: They know some python from other courses, they have been using AI to create solutions, they have been reading ahead or they have searched the internet for answers.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While knowledge is good, then there is a reason for why the exercises and the learning materials (powerpoint) are as they are - it is a designed course progression. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
By not following the course progression, then you are not learning to analyze or formulate strategies.&lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Also, it brings problems to peer evaluation, as not everyone knows python that is outside the curriculum.&lt;br /&gt;
&lt;br /&gt;
If you want to show some fancy python (i.e. outside the curriculum/progression), then make TWO solutions to the exercise. One that shows the fancy python and one that follows the curriculum and the course progression. The last one can then be used for peer evaluation. If you find yourself unable to make a solution that follows the course progression, then maybe you should study the subject some more.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a 4 hour written exam. You will get the assignments, the input files that you have to use/read/parse, and the output files that you have to create. Most importantly, you will also get a &#039;&#039;&#039;.py&#039;&#039;&#039; file that you will have to fill out. That is basically a text file with python code, that mostly contains empty functions. You have to fill out the functions with python code that solves the assignments.&amp;lt;br&amp;gt;YOU CAN NOT HAND IN A JUPYTER NOTEBOOK FILE. Your exam hand-in is only the filled out &#039;&#039;&#039;.py&#039;&#039;&#039; file. &lt;br /&gt;
&lt;br /&gt;
The last lesson [[Python object model]]&#039;s exercises is an example of the exam format - not the exam content. All the exercises has to be handed in in one single .py file. Every exercise is one individual python function, which calls some specified other functions which together solves the exercise. You can add your own functions, if you feel some functionality is missing, but you must fill and use those given by the exam &#039;&#039;&#039;.py&#039;&#039;&#039; file. Follow the naming scheme for your own functions - it should be obvious.&lt;br /&gt;
&lt;br /&gt;
You are expected to solve the assignments using the course curriculum. In particular, it means &amp;quot;pure&amp;quot; python, maybe using standard libraries like os, sys, re, math and others, but not 3rd party libraries like pandas or numpy. It also means use of comments to explain what you are doing, and employ code modularization.&lt;br /&gt;
&lt;br /&gt;
Comments that just explains your intentions, but are not supported by code, are disregarded. You can not &amp;quot;talk&amp;quot; your way to a pass, you must code your way to a pass.&lt;br /&gt;
&lt;br /&gt;
At the exam there will likely be 2 assignments - &#039;&#039;&#039;not&#039;&#039;&#039; 6 exercises - that you have to solve.&lt;br /&gt;
&lt;br /&gt;
Exam aids: You can bring your computer with all the material from the course; powerpoints, exercises, solutions, etc. There is NO INTERNET and NO AI allowed. In the end, it is the programming skill you acquired during the course, that will make you pass - not any aid you bring. That is why we are doing so many difficult exercises.&lt;br /&gt;
&lt;br /&gt;
=== How much is required to pass? ===&lt;br /&gt;
The &#039;&#039;&#039;.py&#039;&#039;&#039; file is mostly structure and does not give much advice in how to solve the assignments. It is for you to show that you have learned to analyze a programming problem and come up with a solution. As you will be given both the input files and the output files, you can check how well you have succeeded. A correct solution to both assignments is an automatic pass. A correct solution to only one assignment, without any constructive work (in my evaluation) on the other assignment is not enough for a pass. No correct solutions, but writing good sensible code (again in my evaluation) can pass, as it shows you have learned essential things in the course. Comments are part the the essential things.&amp;lt;br&amp;gt;&lt;br /&gt;
In the end, unless you passed automatically, it comes down to a overall evaluation of your hand-in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There are usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
	<entry>
		<id>https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=304</id>
		<title>How the course is conducted</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk:443/22116/index.php?title=How_the_course_is_conducted&amp;diff=304"/>
		<updated>2025-12-22T14:32:16Z</updated>

		<summary type="html">&lt;p&gt;WikiSysop: /* Peer evaluation of exercises */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
Weekly exercises are given every Monday. This constitutes an exercise set. There will be 13 of those.&amp;lt;br&amp;gt;&lt;br /&gt;
Exercises have to be uploaded to &amp;quot;DTU Learn&amp;quot; latest Sunday in the week after the exercises were given, i.e you have 7 days to complete a set.&amp;lt;br&amp;gt;&lt;br /&gt;
Peer evaluation of exercises are done in the following week to be handed in Friday.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font style=&amp;quot;color:red&amp;quot;&amp;gt;There will be some hand-in time irregularity at the end of the semester, due to exams. Pay attention.&amp;lt;/font&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
The evaluations are mandatory. At least 11 of 13 evaluations must be handed in - in time - for you to be allowed to take the exam. You can only evaluate if you have handed in exercises, so the hand-in is required.&amp;lt;br&amp;gt;&lt;br /&gt;
You are required to make a Jupyter Notebook for every exercise set, i.e. every week. The .ipynb file is what you hand in to Peer Evaluation. Many people use VScode for this, but it is up to you. In the last part of the course, this is changed to a &#039;&#039;&#039;.py&#039;&#039;&#039; file, to get you used to how the exam will be.&amp;lt;br&amp;gt;&lt;br /&gt;
Solutions to each week&#039;s exercises are published before the next week&#039;s lesson on DTU Learn (under Discussions).&amp;lt;br&amp;gt;&lt;br /&gt;
DTU Learn does not allow for late hand-in. Set an alarm on your phone to remember.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;!-- You can find a link to a Discord server in the announcement on DTU Learn (first page). The intention is that you can group together here and get/give help outside normal class hours. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements for taking the course ==&lt;br /&gt;
&#039;&#039;&#039;You most take this seriously. Half of the students failed the course first year it ran.&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
This course requires that you have previously taken 5 ECTS in a beginner course in programming. DTU students have taken [https://kurser.dtu.dk/course/02002 02002 Computer Programming (Polytechnical Foundation)], however foreign Master students are more of a mixed group. This course can NOT be treated as your first real programming course - it is your second, and the difficulty of the course and exam reflects that. I have tried to make the course accessible to people with a moderate background in programming, but it is not a free ride. I have an obsolete beginner course [https://teaching.healthtech.dtu.dk/22101/ 22101 Introduction to programming in Life Science using Python] which you can learn from on your own, if your background is insufficient and you want to take this course anyway.&lt;br /&gt;
&lt;br /&gt;
== Peer evaluation of exercises ==&lt;br /&gt;
You must upload the solutions for the exercise set at given lesson to DTU Learn. The following week you must evaluate another students solutions - to be handed in on the Friday. You are getting some help with that as I have published my solutions at that time.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The peer evaluation is a central part of the learning process. As you will discover, you will be asked many questions about various aspects of the code you will have to evaluate. Initially, it can seem overwhelming, and you might not have been taught about all yet, but it is the same questions week after week, and you mostly have to check boxes, so it will get easier during the course. You learn both by doing the evaluation and by receiving (reading) it.&lt;br /&gt;
&lt;br /&gt;
You can/should use the criteria in [[Good code]] in your own programs and the evaluation. The questions in the evaluation are more in depth than [[Good code]]. The evaluation is anonymous, but known to the teacher.&lt;br /&gt;
&lt;br /&gt;
===Learning from exercises and teachers solutions===&lt;br /&gt;
You obviously learn from doing the exercises. However, that is just phase 1. Reflecting over your own solutions while reading the teachers solutions is extremely useful; It prepares you for the following week, it prepares you for the peer evaluation, it shows you alternative solutions you might not have thought about.&amp;lt;br&amp;gt;&lt;br /&gt;
The solutions are examples with explanations and also cover common mistakes. &#039;&#039;They can be found on DTU Learn under Discussions&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Pythonic exercises===&lt;br /&gt;
Python has several constructs, functions, ways/idioms to do certain things. People who have seen some python before may know of this. When using these methods and ways of thinking the code becomes &amp;quot;pythonic&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
It is a learning objective in the course and important for your future as a programmer to learn to program and to design algorithms.&amp;lt;br&amp;gt;&lt;br /&gt;
It happens especially in the first half of the course that learning to program and making pythonic code are at odds. This can been seen in the teachers solutions - you might think: &amp;quot;Why did he do it this way, when you can do it&lt;br /&gt;
smarter/more intuitive/easier/pythonic this way&amp;quot;. This is the reason - the course prioritizes learning to program more than doing it the pythonic way. When you have learned to make algorithms and code well, you can do this in any language. Pythonic coding only works with python.&lt;br /&gt;
&lt;br /&gt;
If you do not observe this during the course - no problem.&lt;br /&gt;
&lt;br /&gt;
== Special exercises ==&lt;br /&gt;
&amp;lt;font color=&amp;quot;AA00FF&amp;quot;&amp;gt;&#039;&#039;&#039;Purple exercises&#039;&#039;&#039; has to be done in pseudo code before you start implementing them in Python. The pseudo code is part of the hand-in for these exercises.&lt;br /&gt;
So - make the pseudocode FIRST, then the real python programs AFTERWARDS for the purple exercises.&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Using python elements not in the curriculum ==&lt;br /&gt;
Most people sooner or later use python not in the curriculum, or not yet covered by the course progression. There are several reasons for that: They know some python from other courses, they have been using AI to create solutions, they have been reading ahead or they have searched the internet for answers.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
While knowledge is good, then there is a reason for why the exercises and the learning materials (powerpoint) are as they are - it is a designed course progression. A very important part of the course is to learn how program, how to think &amp;quot;programming&amp;quot;, how to analyze a problem, how to formulate a strategy/workflow/algorithm that will solve the problem.&amp;lt;br&amp;gt;&lt;br /&gt;
By not following the course progression, then you are not learning to analyze or formulate strategies.&lt;br /&gt;
By not thinking - structuring the code more logically - gaining insight in the natural flow of problem solving, you will lack those skills - that mindset - when you really need it to solve more difficult exercises and/or problems.&amp;lt;br&amp;gt;&lt;br /&gt;
Also, it brings problems to peer evaluation, as not everyone knows python that is outside the curriculum.&lt;br /&gt;
&lt;br /&gt;
If you want to show some fancy python (i.e. outside the curriculum/progression), then make TWO solutions to the exercise. One that shows the fancy python and one that follows the curriculum and the course progression. The last one can then be used for peer evaluation. If you find yourself unable to make a solution that follows the course progression, then maybe you should study the subject some more.&lt;br /&gt;
&lt;br /&gt;
== Preparation for exam ==&lt;br /&gt;
The exam is a 4 hour written exam. You will get the assignments, the input files that you have to use/read/parse, and the output files that you have to create. Most importantly, you will also get a &#039;&#039;&#039;.py&#039;&#039;&#039; file that you will have to fill out. That is basically a text file with python code, that mostly contains empty functions. You have to fill out the functions with python code that solves the assignments.&amp;lt;br&amp;gt;YOU CAN NOT HAND IN A JUPYTER NOTEBOOK FILE. Your exam hand-in is only the filled out &#039;&#039;&#039;.py&#039;&#039;&#039; file. &lt;br /&gt;
&lt;br /&gt;
The last lesson [[Python object model]]&#039;s exercises is an example of the exam format - not the exam content. All the exercises has to be handed in in one single .py file. Every exercise is one individual python function, which calls some specified other functions which together solves the exercise. You can add your own functions, if you feel some functionality is missing, but you must fill and use those given by the exam &#039;&#039;&#039;.py&#039;&#039;&#039; file. Follow the naming scheme for your own functions - it should be obvious.&lt;br /&gt;
&lt;br /&gt;
You are expected to solve the assignments using the course curriculum. In particular, it means &amp;quot;pure&amp;quot; python, maybe using standard libraries like os, sys, re, math and others, but not 3rd party libraries like pandas or numpy. It also means use of comments to explain what you are doing, and employ code modularization.&lt;br /&gt;
&lt;br /&gt;
Comments that just explains your intentions, but are not supported by code, are disregarded. You can not &amp;quot;talk&amp;quot; your way to a pass, you must code your way to a pass.&lt;br /&gt;
&lt;br /&gt;
At the exam there will likely be 2 assignments - &#039;&#039;&#039;not&#039;&#039;&#039; 6 exercises - that you have to solve.&lt;br /&gt;
&lt;br /&gt;
Exam aids: You can bring your computer with all the material from the course; powerpoints, exercises, solutions, etc. There is NO INTERNET and NO AI allowed. In the end, it is the programming skill you acquired during the course, that will make you pass - not any aid you bring. That is why we are doing so many difficult exercises.&lt;br /&gt;
&lt;br /&gt;
=== How much is required to pass? ===&lt;br /&gt;
The &#039;&#039;&#039;.py&#039;&#039;&#039; file is mostly structure and does not give much advice in how to solve the assignments. It is for you to show that you have learned to analyze a programming problem and come up with a solution. As you will be given both the input files and the output files, you can check how well you have succeeded. A correct solution to both assignments is an automatic pass. A correct solution to only one assignment, without any constructive work (in my evaluation) on the other assignment is not enough for a pass. No correct solutions, but writing good sensible code (again in my evaluation) can pass, as it shows you have learned essential things in the course. Comments are part the the essential things.&amp;lt;br&amp;gt;&lt;br /&gt;
In the end, unless you passed automatically, it comes down to a overall evaluation of your hand-in.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The exam is a multiple choice questionnaire. There will be 72 questions, which should be answered at the best of your ability within 2 hours. There are usually between 5 and 8 choices of answer for each question and there is always one answer which is correct - or more correct than the others. Negative points are not used, i.e. there is no penalty for answering wrong (we call it guessing). You must have 60% correctly answered questions to pass. You have all aids available, but NO INTERNET. This means you can download the powerpoints, my solutions, videos and text books and other stuff you find useful. Likewise you can use Jupyter Notebook since a local version (as used in the course) does not require internet.&amp;lt;br&amp;gt;&lt;br /&gt;
The questions will - obviously - be based on the curriculum. This very concretely means that knowing the context of the powerpoints will be an advantage. There are also questions where you must analyze 8-12 lines of code and answer what it does or what the result of running it is. You do not need extra files for answering.&amp;lt;br&amp;gt;&lt;br /&gt;
There is no trial exam.&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
</feed>