Till KTH:s startsida Till KTH:s startsida

Gruppwebben som samarbetsyta stängs 31 december 2026. Du som administratör behöver nu exportera gruppens innehåll och/eller radera gruppen.

Observera: Från och med den 1 oktober 2026 kommer delar av gruppwebben som inte längre används, successivt att stängas ned, exempelvis gruppwebbar som redan har flyttats eller varit inaktiva under en längre tid.

Mer information hittar du i nyheten: Gruppwebben och Social stänger hösten 2026. Stöd och instruktioner för hur du exporterar en gruppwebb finns i: Gruppwebben som samarbetsyta stängs hösten 2026.

Lab 2

In these assignments you are expected to use Python and no additional libraries (except for standard libraries). The goal is to practice writing "pure" Python for those occasions when libraries or other good tools are not available for one reason or another.

Your code must be a Good Unix Citizen: your Python file itself is executable, files and arguments are read from the commandline (see below), and you use stdin, stdout, and stderr appropriately.

Basic assignments

These basic assignments are necessary to pass Lab 2.

  1. Download genomes
  2. Computing GC content
  3. Comparing base composition
  4. Compatibility

There are also an advanced assignment available, for the possibility to raise your grade.

Reading from the commandline

As an example of how to read from the commandline, consider creating a file called "reveal" with this contents

   #! /usr/bin/env python
   import sys
   print sys.argv

and then execute the command

   chmod +x reveal

to make it executable. Then, try you new program by running (for example)

   reveal a b c

How do you use this in this assignment?

Lars Arvestad skapade sidan 27 oktober 2016

En användare har tagit bort sin kommentar