# coding: utf-8
""" Dynamic rule to convert VCF file in BCF file.
"""

def dynamic_vcf_to_bcf(name, project):
    metadata = {'name': name}
    dynamic_bcf = '''
rule vcf_to_bcf_%(name)s:
    input:
        vcf = __vcf_to_bcf_%(name)s__input
    output:
        bcf = __vcf_to_bcf_%(name)s__output
    log:
        __vcf_to_bcf_%(name)s__log
    shell:
        """
        bcftools view -O b {input.vcf} > {output.bcf} 2> {log}
        """
'''
    from sequana.snaketools import build_dynamic_rule
    return build_dynamic_rule(dynamic_bcf % metadata, project.pipeline_dir)
