def annotateWindows(contig, windows, gff_data, fasta, options):

    index = IndexedGenome.IndexedGenome()
    for g in gff_data:
        index.add(g.contig, g.start, g.end, g)

    is_gtf = options.is_gtf

    if options.transform == "none":
        transform = lambda x, y, z: map(lambda x: (x[0], x[1]), z)
    elif options.transform == "overlap":
        transform = transform_overlap
    elif options.transform == "complement":
        transform = transform_complement
    elif options.transform == "third_codon":
        transform = transform_third_codon
    else:
        raise ValueError("unknown transform %s" % options.transform)

    work_on_intervals = True
    if options.decorator == "counts":
        decorator = decorator_counts
    elif options.decorator == "mean-length":
        decorator = decorator_mean_length
    elif options.decorator == "median-length":
        decorator = decorator_median_length
    elif options.decorator == "percent-coverage":
        decorator = decorator_percent_coverage
    elif options.decorator == "gc":
        decorator = decorator_percent_gc
    elif options.decorator == "median-score":
        decorator = decorator_median_score
        work_on_intervals = False
    elif options.decorator == "mean-score":
        decorator = decorator_mean_score
        work_on_intervals = False
    elif options.decorator == "stddev-score":
        decorator = decorator_stddev_score
        work_on_intervals = False
    elif options.decorator == "min-score":
        decorator = decorator_min_score
        work_on_intervals = False
    elif options.decorator == "max-score":
        decorator = decorator_max_score
        work_on_intervals = False
    else:
        raise ValueError("unknown decorator %s" % options.decorator)

    for start, end in windows:

        # counts/length before/after transformation
        n1, l1, n2, l2 = 0, 0, 0, 0

        values, intervals_with_gff, genes, transcripts = [], [], set(), set()

        try:
            for istart, iend, value in index.get(contig, start, end):
                n1 += 1
                l1 += iend - istart
                intervals_with_gff.append((istart, iend, value))
                values.append(value.score)
                if is_gtf:
                    genes.add(value.gene_id)
                    transcripts.add(value.transcript_id)
        except KeyError:
            pass

        if n1 == 0 and options.skip_empty:
            continue

        if work_on_intervals:

            if options.loglevel >= 3:
                options.stdlog.write("# intervals in window %i:%i before transformation: %s\n" % (
                    start, end, str(intervals)))

            intervals = transform(start, end, intervals_with_gff)

            for xstart, xend in intervals:
                n2 += 1
                l2 += xend - xstart

            if options.loglevel >= 3:
                options.stdlog.write("# intervals in window %i:%i after transformation: %s\n" % (
                    start, end, str(intervals)))

            score, extra_info = decorator(intervals, start, end, contig, fasta)

        else:
            if len(values) > 0:
                values = map(float, values)
                score, extra_info = decorator(values, start, end, contig)
            else:
                score, extra_info = 0, None

            l2 = 0
            n2 = 0

        if is_gtf:
            ngenes, ntranscripts = len(genes), len(transcripts)
        else:
            ngenes, ntranscripts = 0, 0

        if extra_info:
            extra_info = re.sub("\t", ";", extra_info)
        options.stdout.write("\t".join(
            map(str, (contig, start, end,
                      ngenes, ntranscripts,
                      n1, l1,
                      n2, l2,
                      score,
                      extra_info))) + "\n")
Check a value of `prepopulated_fields` dictionary, i.e. it's an
dataset/ETHPy150Open CGATOxford/cgat/scripts/gff2table.py/annotateWindows--crossover with--dataset/ETHPy150Open django/django/django/contrib/admin/checks.py/BaseModelAdminChecks._check_prepopulated_fields_value