# coding: utf-8


"""

Dynamic rule to unpigz a .gz file on stdout

"""

def dynamic_unpigz(name, manager):

    metadata = {'name':name}
    dynamic_unpigz_code = '''
rule unpigz_%(name)s:
    input:
        input = __unpigz_%(name)s__input
    output:
        output = temp(__unpigz_%(name)s__output)
    threads: 4
    shell:
        """
        unpigz -fk {input} -p {threads} --stdout > {output}
        """


'''
    from sequana.snaketools import build_dynamic_rule
    return build_dynamic_rule(dynamic_unpigz_code % metadata, manager.pipeline_dir)