#!/usr/bin/env python import random import sys #function that simulates the sequence def simulate_sequence(length): #list with the nucleotides dna = ['A', 'C', 'G', 'T'] #emtpy string to receive simulated sequence sequence = '' for i in range(length): #random.choice() picks a random element of sequence += random.choice(dna) return sequence #get three values from the arguments setsize = int(sys.argv[1]) #number of sequences to simulate minlength = int(sys.argv[2]) #minumum sequence length maxlength = int(sys.argv[3]) #maximum sequence length #assign an empty list sequenceset = [] for i in range(setsize): #generate a random number that determines the sequence length rlength = random.randint(minlength, maxlength) #calls the function that simulates the sequence sequenceset.append(simulate_sequence(rlength)) #print result for sequence in sequenceset: print sequence