def main(argv=None):

    if argv is None:
        argv = sys.argv

    parser = E.OptionParser(
        version="%prog version: $Id: maq2assembly.py 2781 2009-09-10 11:33:14Z andreas $")

    parser.add_option("-f", "--is-forward-coordinates", dest="forward_coordinates",
                      help="translate to forward coordinates.", action="store_true")

    parser.add_option("-p", "--output-filename-pattern", dest="output_filename_pattern", type="string",
                      help="OUTPUT filename pattern for additional data [%default].")

    parser.add_option("--method", dest="methods", type="choice", action="append",
                      choices=("gff", "coverage", "region", "quality"),
                      help="methods to apply [%default].")

    parser.set_defaults(
        output_format="%08i",
        output_filename_pattern="%s",
        methods=[],
    )

    (options, args) = E.Start(parser)

    ################################################
    ################################################
    ################################################
    # pick a processor
    ################################################
    methods = []

    if len(options.methods) == 0:
        raise "please supply at least one method to apply."

    genome_fasta, queries_fasta = None, None

    for method in options.methods:
        if method == "gff":
            methods.append(BuilderGFF(genome_fasta, queries_fasta, options))
        elif method == "coverage":
            methods.append(
                BuilderCoverage(genome_fasta, queries_fasta, options))
        elif method == "quality":
            methods.append(
                BuilderQuality(genome_fasta, queries_fasta, options))
        elif method == "region":
            methods.append(BuilderRegion(genome_fasta, queries_fasta, options))

    for method in methods:
        method.printHeader()

    ninput, noutput = 0, 0
    id = 0
    for contig, start, end, reads, qualities in reader(options.stdin):

        ninput += 1
        id += 1
        for m in methods:
            m(id, contig, start, end, reads, qualities)

        noutput += 1

    options.stdlog.write("# ninput=%i, noutput=%i\n" % (ninput, noutput))

    E.Stop()
script main.
dataset/ETHPy150Open CGATOxford/cgat/scripts/maq2assembly.py/main