def construct_dict(genome, *dataset_names):
    """
    Construct an allele counts dict from a genome object

    Parameters
    ----------
    genome : funcgenom.Genome()
        a genome as from funcgenom
    *dataset_names : str
        names for the datasets represented by the genome
    
    Returns
    -------
    dict
        a dictionary whose values are tables containing the coordinates and
        allele counts
    """

    return {
        'coordinates': dict(
            zip(
                ('chr', 'pos'),
                (
                    list(z) for z in zip(
                        *((v.chromosome, v.position) for v in genome.variants())
                    )
                )
            )
        ),
        **{
            dataset_name: dict(
                zip(
                    ('coverage', 'ref_count'),
                    (
                        list(z) for z in zip(
                            *(
                                (
                                    v.traits.get(dataset_name, {}).get(
                                        'coverage'
                                    ),
                                    v.traits.get(dataset_name, {}).get(
                                        'ref_count'
                                    )
                                )
                                for v in genome.variants()
                            )
                        )
                    )
                )
            )
            for dataset_name in dataset_names
        }
    }