# Buggy code
def parse_tag_info_chrs(self, f, convChr=True):
    """Parse HOMER tagdirectory taginfo.txt file to extract chromosome coverage."""
    parsed_data_total = dict()
    parsed_data_uniq = dict()
    remove = ["hap", "random", "chrUn", "cmd", "EBV", "GL", "NT_"]
    ## skip first 11 lines
    counter = 0
    for l in f["f"]:
        ## skip first 11 lines
        if counter < 11:
            counter = counter + 1
            continue
        s = l.split("\t")

        key = s[0].strip()

        if len(s) > 1:
            if convChr:
                if any(x in key for x in remove):
                    continue

            vT = float(s[1].strip())
            vU = float(s[2].strip())

            parsed_data_total[key] = vT
            parsed_data_uniq[key] = vU

    return [parsed_data_total, parsed_data_uniq]


# Traceback (IndexError)
szha0069@biomate1:~/test_seq_files/analysis/tags$ multiqc .
[WARNING]         multiqc : MultiQC Version v1.4 now available!
[INFO   ]         multiqc : This is MultiQC v1.3
[INFO   ]         multiqc : Template    : default
[INFO   ]         multiqc : Searching '.'
Searching 33 files..  [####################################]  100%
[ERROR  ]         multiqc : Oops! The 'homer' MultiQC module broke...
Please copy the following traceback and report it at https://github.com/ewels/MultiQC/issues
(if possible, include a log file that triggers the error)
============================================================
Module homer raised an exception: Traceback (most recent call last):
File "/mnt/software/apps/multiqc-1.3/bin/multiqc", line 412, in multiqc
output = mod()
File "/mnt/software/apps/multiqc-1.3/lib/python3.5/site-packages/multiqc/modules/homer/homer.py", line 60, in __init__
n['Homer_tagDir'] = self.homer_tagdirectory()
File "/mnt/software/apps/multiqc-1.3/lib/python3.5/site-packages/multiqc/modules/homer/tagdirectory.py", line 24, in homer_tagdirectory
self.parse_tagInfo_data()
File "/mnt/software/apps/multiqc-1.3/lib/python3.5/site-packages/multiqc/modules/homer/tagdirectory.py", line 142, in parse_tagInfo_data
parsed_data = self.parse_tag_info(f)
File "/mnt/software/apps/multiqc-1.3/lib/python3.5/site-packages/multiqc/modules/homer/tagdirectory.py", line 349, in parse_tag_info
tag_info['gsizeEstimate'] = float(s[0].strip().split("=")[1])
IndexError: list index out of range
============================================================
[WARNING]         multiqc : No analysis results found. Cleaning up..
[INFO   ]         multiqc : MultiQC complete

# Fixed code
def parse_tag_info_chrs(self, f, convChr=True):
    """Parse HOMER tagdirectory taginfo.txt file to extract chromosome coverage."""
    parsed_data_total = OrderedDict()
    parsed_data_uniq = OrderedDict()
    remove = ["hap", "random", "chrUn", "cmd", "EBV", "GL", "NT_"]
    for l in f["f"]:
        s = l.split("\t")
        key = s[0].strip()
        # skip header
        if "=" in l or len(s) != 3:
            continue
        if convChr:
            if any(x in key for x in remove):
                continue
        try:
            vT = float(s[1].strip())
            vU = float(s[2].strip())
        except ValueError:
            continue

        parsed_data_total[key] = vT
        parsed_data_uniq[key] = vU

    return [parsed_data_total, parsed_data_uniq]