I ve to Write a Python program that prints a random DNA sequence in Fasta format.
That 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
>MySequence
TGCGCATATTGTCTAACTATGGCTGTGGCCGGA
The output must be in valid Fasta format.
I am trying this way:
import random
>>> ''.join([random.choice('AGTC') for x in range(10)])
'GGTTTCGGTA'
>>> ''.join([random.choice('AGTC') for x in range(10)])
'GCGGGTCCGT'
but how to print the length of that string and a seq name with fasta symbol ">"?any idea?
thanks in advance.