def merge_chunk_data(output_file='merged_idx_contig_hit_size_cov.txt', *files):
    """Merge chunk data from different networks

    Similarly to merge_network, this merges any number of chunk data files.

    Parameters
    ---------
    output_file : file, str, or pathlib.Path, optional
        The output file to write the merged chunk data files into. Default is
        merged_idx_contig_hit_size_cov.txt
    `*files` : file, str or pathlib.Path
        The chunk data files to merge.
    """
    chunks = dict()
    for chunk_file in files:
        with open(chunk_file) as chunk_file_handle:
            for line in chunk_file_handle:
                chunk_id, chunk_name, hit, size, cov = line.split('\t')
                try:
                    chunks[chunk_id]['hit'] += hit
                    chunks[chunk_id]['cov'] += cov
                except KeyError:
                    chunks[chunk_id] = {'name': chunk_name, 'hit': hit,
                        'size': size, 'cov': cov}
    sorted_chunks = sorted(chunks)
    with open(output_file, 'w') as output_handle:
        for chunk_id in sorted_chunks:
            my_chunk = chunks[chunk_id]
            name, hit, size, cov = my_chunk['name'], my_chunk['hit'], my_chunk[
                'size'], my_chunk['cov']
            my_line = '{}\t{}\t{}\t{}\t{}'.format(chunk_id, name, hit, size,
                cov)
            output_handle.write(my_line)
