rule snpeff_add_locus_in_fasta:
    """
    SnpEff requires the locus names in the annotation file and in the FASTA file (contig name) to be identical. To make this is true, this rule adds locus names of the genbank file into the FASTA file before the mapping.

    Required input:
        - __snpeff_add_locus_in_fasta__input: FASTA file of the reference.

    Required output:
        - __snpeff_add_locus_in_fasta__output: FASTA file with locus names.

    Required configuration:
        .. code-block:: yaml

            snpeff:
                reference:  # the genbank file
                options:    # result filters options
    """
    input:
        fasta = __snpeff_add_locus_in_fasta__input,
        ann = config["snpeff"]["reference"]
    output:
        fasta = __snpeff_add_locus_in_fasta__output
    log:
        log = __snpeff_add_locus_in_fasta__log
    run:
        from sequana import SnpEff
        
        snpeff = SnpEff(reference=input['ann'], log=log['log'])
        snpeff.add_locus_in_fasta(input['fasta'], output['fasta'])
