rule add_read_group:
    input:
        bam = __add_read_group__input
    output: 
        rgbam = __add_read_group__output
    log:
        out = __add_read_group__log_std,
        err = __add_read_group__log_err
    params:
        rg = __add_read_group__rg
    shell:
        """
        picard AddOrReplaceReadGroups I={input.bam} O={output.rgbam} \
        {params.rg} > {log.out} 2> {log.err}
        samtools index {output.rgbam}
        """


