##################################
#                                #
# Last modified 8/11/2009         # 
#                                #
# Georgi Marinov                 #
#                                # 
##################################

import sys
import string
from sets import Set
import random

def run():

    if len(sys.argv) < 3:
        print 'usage: python %s numberofsequences length outfilename' % sys.argv[0]
        sys.exit(1)

    number= int(sys.argv[1])    
    length= int(sys.argv[2])
    outfilename = sys.argv[3]
    nucleotides=['A','C','G','T']
    outfile = open(outfilename, 'w')
    for i in range(number):
        barcode=''
        if i % 10000==0:
            print i, 'sequences generated'
        for j in range(length):
            barcode=barcode+nucleotides[random.randint(0,3)]
        outline='>'+'barcode'+str(i)+'\n'
        outfile.write(outline)
        outfile.write(barcode+'\n')
    outfile.close()

run()
