def check_gindexer_compatibility(gindexer, resolution, store_whole_genome):
    """Sanity check for gindexer.

    This function tests if the gindexer is compatible with
    other properties of the dataset, including the resolution and
    the store_whole_genome argument

    A ValueError is thrown if the gindexer is not valid.
    """
    if resolution is not None and resolution > 1 and store_whole_genome:
        if gindexer is not None and gindexer.binsize % resolution > 0:
            raise ValueError(
                'binsize must be an integer-multipe of resolution. Got binsize={} and resolution={}'
                .format(gindexer.binsize, resolution))
        for iv_ in (gindexer or []):
            if iv_.start % resolution > 0:
                raise ValueError(
                    'Please ensure that all interval starts line up with the resolution-sized bins. This is necessary to prevent rounding issues. Interval ({}:{}-{}) not compatible with resolution {}. '
                    .format(iv_.chrom, iv_.start, iv_.end, resolution) +
                    'Consider using "janggu-trim <input_roi> <trun_output> -divisible_by {resolution}"'
                    .format(resolution=resolution))
    if not store_whole_genome and gindexer is None:
        raise ValueError('Either specify roi or store_whole_genome=True')
