def bam_to_bigwig(input_bam, output_bigwig, genome_assembly,
    normalization_method='RPGC', cpus='8'):
    """
    Convert BAM file to BigWig format using deeptools bamCoverage.

    Parameters
    ----------
    input_bam : str
        Input BAM file.
    output_bigwig : str
        Output BigWig file.
    genome_assembly : str
        Genome assembly of the BAM file.
        One of 'hg19', 'hg38', 'mm10', 'mm9'.
        Otherwise will assume size of human genome.
    normalization_method : {str}, optional
        Method to normalize tracks regarding sequenced depth.
        One of the methods in https://deeptools.readthedocs.io/en/develop/content/tools/bamCoverage.html#Read%20coverage%20normalization%20options

        Default is "RPGC".

    Returns
    -------
    str
        Command to execute.
    """
    from collections import defaultdict
    if genome_assembly not in ['hg19', 'hg38', 'mm10', 'mm9']:
        print(
            'Genome assembly is not known.Using size of human genome. Beware.')
    genome_size = defaultdict(lambda : 3300000000)
    for gen in ['mm9', 'mm10']:
        genome_size[gen] = 2800000000
    cmd = 'bamCoverage \\\n--bam {bam_file} \\\n-o {bigwig} \\\n'
    cmd += '-p {cpus} --binSize 10  --normalizeUsing {norm} \\\n'
    cmd += '--effectiveGenomeSize {genome_size} --extendReads 175'
    cmd = cmd.format(bam_file=input_bam, bigwig=output_bigwig, norm=
        normalization_method, genome_size=genome_size[genome_assembly],
        cpus=cpus)
    return cmd
