##################################
#                                #
# Last modified 05/18/2012       # 
#                                #
# Georgi Marinov                 #
#                                # 
##################################

import sys

def run():

    if len(sys.argv) < 2:
        print 'usage: python %s fasta output' % sys.argv[0]
        sys.exit(1)

    fasta = sys.argv[1]

    i=0
    BP=0
    pos=1
    input_stream = open(fasta)
    for line in input_stream:
        i+=1
        if i % 20000000 == 0:
            print str(i/2000000) + 'M reads processed'
        if line.startswith('>'):
            continue
        BP += len(line.strip())

    outfile = open(sys.argv[2],'w')
    outfile.write('total base pairs in fastq file:\t' + str(BP) + '\n')
    outfile.close()

run()

