COMP 204 Winter 2021: Computer programming for Life Sciences (3 Credits)

Course Description

Computer programming in a high level language: variables, expressions, types, functions, conditionals, loops, objects and classes. Introduction to algorithms, modular software design, libraries, file input/output, debugging. Emphasis on applications in the life sciences.

Recommended not required: BIOL 112 and a CEGEP level mathematics course

Restrictions: Only one of COMP 204, COMP 202 and COMP 208 can be taken for credit. COMP 204 cannot be taken for credit with or after COMP 250, COMP 206, COMP 208, or COMP 364.

Objectives: By the end of this course, students will be able to:
  1. Design and describe precise, unambiguous instructions that can be used [by a computer] to solve a problem or perform a task;
  2. Translate these instructions into a language that a computer can understand (Python);
  3. Write programs that solve complex problems (especially those arising in Life Sciences) by decomposing them into simpler subproblems;
  4. Apply programming-style and structure conventions to make your programs easy to understand, debug and modify;
  5. Learn independently about new programming-language features and libraries by reading documentation and by experimenting.

Programming language: Python 3.8 or above 

List of life science topics used as examples: Central dogma of molecular biology, RNA and/or protein structure prediction, Genome sequencing and analysis, Biological networks, Evolution, Epigenetics, Biomarker discovery, Biosystems dynamics, Cell and biomedical imaging, mining healthcare data.


Yue Li <yue[dot]yl[dot]li[at]mcgill[dot]ca>

Teaching Assistant

Elliot Layne < first[dot]lastname[at]mail[dot]mcgill[dot]ca>
Wenmin Zhang < first[dot]lastname[at]mail[dot]mcgill[dot]ca>
Amirhossein Kazemnejad < first[dot]lastname[at]mail[dot]mcgill[dot]ca>

Office Hours

Yue: Monday, Wednesday 9:30-10:30 (right after class in the same Zoom room)
Elliot: Tuesday 3-4
Amirhossein: Thursday 3-4
Wenmin: Friday 3-4

Lecture Schedule

Lectures: MWF 8:35-9:25 AM
Location: Virtual Zoom (see link on MyCourses)
Lecture recordings will be available from MyCourses

Student evaluation

  1. Quizzes: 5% (each quiz worth 0.2%; take the top 25 quizes with the highest grades)
  2. Assignments: 40% (5 assignments worth 8% each)
  3. Midterm exam: 20%, held online on February 19. You will have 4 hours to complete the exam (but the exam will be designed to be feasible in 2 hours), in a period of your choice starting at 8:30 am on February 19 and ending at 8:30 am on February 22. Please let me know by January 20 if you need special special arrangements.
  4. Final exam: 35%. You will have 6 hours to complete the exam (but the exam will be designed to be feasible in 3 hours)
Alternatively, the midterm exam weight can be transferred to the final exam grade, which is to have 55% for the final exam of the total grade plus the quizzes and the assignments. In other words, we will take the higher grade between total grade 1 and total grade 2, where total grade 1 = 5% quizzes + 20% midterm + 40% assignments + 35% final and total grade 2 = 5% quizzes + 40% assignments + 55% final.

Suppmental Exams

In exceptional situations, students may write a supplemental examination. However, ability to do so is not automatic, and depends on your exact situation; contact your Student Affairs Office for further information. The supplemental examination represents 100% of your supplemental grade.
Students who receive unsatisfactory final grades will NOT have the option to submit additional work in order to improve their grades.
Official language policy for graded work: In accordance with McGill University's Charter of Students' Rights, students in this course have the right to submit in English or in French any written work that is to be graded.

Pre-class quizzes

To encourage students to keep up with the material on a regular basis, we will have quizes due before each lecture. Each quiz is worth 0.2% of the total marks. For each student, we will take their top 25 quizes out of all of the quizzes they answer for 5% of their total mark. The quiz will be completed on MyCourse.


The assignments are a key part of learning the material, and as such there is no 100% final option. They are perhaps the most rewarding and the best way to learn how to program. As the clinche says, the best way to learn something (i.e., Python programming) is to do it (i.e., do Python programming).

There are 5 Python programming assignments, each aiming at addressing a specific biological question using programming techniques introduced in class. Solutions must be submitted electronically on CodePost. Every student is responsible for verifying that their submissions are successful.

Assignment evaluation:

Assignments will be marked based in part on automated tests design by us and executed on CodePost. Once you submit a first version of your assignment, you will have access to some tests designed by our TAs to (partially) verify the program's correctness. Run these tests yourself, correct your program, and re-submit. You can go through cycle as many times as you need. However, be aware that the tests we are going to use to actually evaluate your program will be different (but of the same type) than those made available to you. Hence it is important that you also test your program on your own, to ensure it works in all cases. If we are unable to run your program because it contains a syntax error, you will get at most 25% for that question. Also, be particularly careful that your program's output exactly matches what we are asking for. If your program is supposed to print something to screen, use exactly the same formatting, capitalization, and punctuation as in the examples given to you. And do not insert extra text either!

It is very important that each student complete all assignments on their own, as this is the best way to learn the material. By working hard on the assignments, you will gain essential experience needed to solve problems on the midterm and final examinations. To receive full grades, assignments (as well as all other course work) MUST represent your own personal efforts (see the section on Plagiarism Policy and Assignments below).

Late Policy:
Late assignments will be deducted 10% each day or fraction thereof for which they are late, including weekend days and holidays; that is, assignments that are within 12 - 24 hours late will be deducted 10%, assignments that are between 24 and 48 hours late will be deducted 20%. Assignments submitted more than 48 hours after the deadline will not be accepted, nor graded, and will therefore receive a grade of 0%. Take care, programming assignments are notoriously time-consuming. Plan appropriately and do not submit to myCourses only minutes before the assignment deadline. Individual exceptions to the lateness policy will not be granted without appropriate justification submitted in writing and supported by documentary evidence.

Assignment grades:
Assignment marks will also be posted on MyCourses. It is your responsibility to check that the marks are correct and to notify your section instructor of any errors or missing marks. If you believe that your assignment was graded incorrectly, you should first email the TA who marked your assignment. Their email address should be in the feedback left on your assignment. If you and the TA cannot resolve the discussion, then you should contact your instructor. Complaints about grading must be formulated within two weeks of the release of the grade.

The instructors reserve the right to modify the lateness policy for a particular assignment; any such modifications will be clearly indicated at the beginning of the relevant assignment specifications.

Getting help:
Post all your questions about the course (including assignments and the midterm/final) on the myCourses message boards so that everyone can see both the questions and the answers. You may freely answer other students' questions as well, with one important exception: you may not provide solution code (although you are permitted to provide one or two lines of code to illustrate a point). The instructor and teaching assistants will not answer questions by email. Post your questions on MyCourses, or ask them in person at office hours. Only email the instructors or TAs for private matters, and do not count on a quick response. Students are expected to monitor both their McGill e-mail account and myCourses for course-related news and information.

Course Syllabus:

Supplementary materials and software

Supplementary Textbook: How to Think Like a Computer Scientist: Interactive Edition (Python) . This is a free, online, interactive textbook with outstanding support for learning to code in Python.

Recommended Software: Useful Links: Campus Computer Laboratories:
All required work can be carried out on standard desktop or laptop computers running Linux, Windows, or Mac OS X. Students can also use the SOCS computer laboratory facilities: All students registered in COMP-204 may use the SOCS computer laboratory facilities to do their work regardless of the program in which they are registered. These facilities are located on the third floor of the Trottier building. You may also use other computer laboratory facilities on campus to do your work.

Plagiarism Policy

Official policy: McGill University values academic integrity. Therefore all students must understand the meaning and consequences of cheating, plagiarism, and other academic offenses under the Code of Student Conduct and Disciplinary Procedures (see for more information). Plagiarism Policy and Assignments You must include your name and McGill ID number at the top of each source code file that you implement and submit. By doing so, you are certifying that the program or module is entirely your own, and represents only the result of your own efforts.

Work submitted for this course must represent your own efforts. Assignments must be done individually; you must not work in groups. Do not rely on friends or tutors to do your work for you. You must not copy any other person's work in any manner (electronically or otherwise), even if this work is in the public domain or you have permission from its author to use it and/or modify it in your own work (obviously, this prohibition does not apply to source code supplied by instructors explicitly for this purpose). Furthermore, you must not give a copy of your work to any other person, nor should you post your solutions on any publicly accessible repository.

The plagiarism policy is not meant to discourage interaction or discussion among students. You are encouraged to discuss assignment questions with instructors, TAs, and your fellow students. However, there is a difference between discussing ideas and working in groups or copying someone else's solution. A good rule of thumb is that when you discuss assignments with your fellow students, you should not leave the discussion with written notes. Also, when you write your solution to an assignment, you should do it on your own.

Students who require assistance with their assignments should see a TA or instructor during their office hours. If you have only partially finished an assignment, document the parts that do not work, and submit what you managed to complete for partial credit. However, the code to answer any question must compile (with the test engine provided to you, if any), or else you will receive a maximum grade of 25% on that question.

We will be using automated software similarity detection tools to compare your assignment submissions to that of all other students registered in the course, and these tools are very effective at what they have been designed for. However, note that the main use of these tools is to determine which submissions should be manually checked for similarity by an instructor or TA; we will not accuse anyone of copying or working in groups based solely on the output of these tools. You may also be asked to present and explain your assignment submissions to an instructor at any time.

Students who put their name on any code that are not entirely their own work will be referred to the appropriate university official who will assess the need for disciplinary action.

Right to submit in English or French written work that is to be graded:

In accord with McGill University's Charter of Students' Rights, students in this course have the right to submit in English or in French any written work that is to be graded.

Academic Integrity statement:

McGill University values academic integrity. Therefore all students must understand the meaning and consequences of cheating, plagiarism and other academic offences under the Code of Student Conduct and Disciplinary Procedures (see honest/ for more information).