def parse_summary_file(summary_file):
    """ Parse a summary file generated by this pipeline
    and return the metrics as a dictionary {"metric":val}
    summary_file : str; the path to the summary file
    """

    metrics = {}
    with open(summary_file,"r") as IN:
        for line in IN:
            contents = line.strip('\n').split('\t')
            if len(contents)!=2:
                raise Exception("Could not parse %s, encountered greater than two columns!\n"%summary_file)
            else:
                val,key = contents
                if key in metrics:
                    raise Exception("Could not parse %s, Encountered duplicate metric in the same file !\n"%summary_file)
                else:
                    metrics[key] = float(val)

    return metrics