def prefix_from_hisat2_index(index_files):
    """
    Given a list of index files for hisat2, return the corresponding prefix.
    """
    if isinstance(index_files, str):
        return '.'.join(index_files.split('.')[:-2])
    else:
        prefixes = list(
            set(
                map(
                    lambda x: '.'.join(x.split('.')[:-2]), index_files)
            )
        )
        if len(prefixes) != 1:
            raise ValueError(
                "More than one prefix detected from '{0}'".format(prefixes)
            )
        return prefixes[0]