def parse_single_report(f):
    """ Parse a gatk varianteval varianteval """
    # Fixme: Separate GATKReport parsing and data subsetting. A GATKReport parser now available from the GATK MultiqcModel.

    data = dict()
    in_CompOverlap = False
    in_CountVariants = False
    in_TiTv = False
    for l in f:
        # Detect section headers
        if '#:GATKTable:CompOverlap' in l:
            in_CompOverlap = True
        elif '#:GATKTable:CountVariants' in l:
            in_CountVariants = True
        elif '#:GATKTable:TiTvVariantEvaluator' in l:
            in_TiTv = True
        else:
            # Parse contents using nested loops
            if in_CompOverlap:
                headers = l.split()
                while in_CompOverlap:
                    l = f.readline().strip("\n")
                    d = dict()
                    try:
                        for i, s in enumerate(l.split()):
                            d[headers[i]] = s
                        if d['Novelty'] == 'all':
                            data['reference'] = d['CompRod']
                            data['comp_rate'] = float(d['compRate'])
                            data['concordant_rate'] = float(d['concordantRate'])
                            data['eval_variants'] = int(d['nEvalVariants'])
                            data['novel_sites'] = int(d['novelSites'])
                        elif d['Novelty'] == 'known':
                            data['known_sites'] = int(d['nEvalVariants'])
                    except KeyError:
                        in_CompOverlap = False
            elif in_CountVariants:
                headers = l.split()
                while in_CountVariants:
                    l = f.readline().strip("\n")
                    d = dict()
                    try:
                        for i, s in enumerate(l.split()):
                            d[headers[i]] = s
                        if d['Novelty'] == 'all':
                            data['snps'] = int(d['nSNPs'])
                            data['mnps'] = int(d['nMNPs'])
                            data['insertions'] = int(d['nInsertions'])
                            data['deletions'] = int(d['nDeletions'])
                            data['complex'] = int(d['nComplex'])
                            data['symbolic'] = int(d['nSymbolic'])
                            data['mixed'] = int(d['nMixed'])
                            data['nocalls'] = int(d['nNoCalls'])
                    except KeyError:
                        in_CountVariants = False
            elif in_TiTv:
                headers = l.split()
                data['titv_reference'] = 'unknown'
                while in_TiTv:
                    l = f.readline().strip("\n")
                    d = dict()
                    try:
                        for i, s in enumerate(l.split()):
                            d[headers[i]] = s
                        if d['Novelty'] == 'known':
                            data['titv_reference'] = d['CompRod']
                            data['known_titv'] = float(d['tiTvRatio'])
                        elif d['Novelty'] == 'novel':
                            data['novel_titv'] = float(d['tiTvRatio'])
                    except KeyError:
                        in_TiTv = False

    return data
Parse a gatk varianteval varianteval