Till KTH:s startsida Till KTH:s startsida

Random DNA sequences

Write a Python program that prints a random DNA sequence in Fasta format.

Requirements

Your program should ask for the length of the sequence and suggest a reasonable sequence name.

The session should look something like:

$ python randomdna.py
Length: 34

>myrandomsequence
TGCGCATATTGTCTAACTATGGCTGTGGCCGGA

The output must be in valid Fasta format.

To present:

  1. Your code and a test run.

Hints

To think about: What distribution do you want for the nucleotides?

The Python module random is suitable to use in this assignment. Take a look at the online documentation the random module! Which function do you find most useful for this assignment?

Visa tidigare händelser (1)

Lärare Lars Arvestad ändrade rättigheterna 10 november 2015

Kan därmed läsas av alla och ändras av lärare.