rule bowtie2_index:
    """
    Genome indexation for Bowtie2 mapper

    Required input:
        __bowtie2_index__fasta: the reference genome to indexed in FASTA format

    Required output:
        __bowtie2_index__output_done: done file for bowtie2 mapping rule

    params:

        __bowtie2_index__output_prefix: the directory where write the index

    """
    input:
       fasta =  __bowtie2_index__fasta
    output:
        __bowtie2_index__output_done
    params:
        prefix = __bowtie2_index__output_prefix
    log:
        __bowtie2_index__log
    shell:
        """
        bowtie2-build {input.fasta} {params.prefix}  2> {log}
        samtools faidx {input.fasta} 2>> {log}
        """
