

rule fastq_sampling:
    """A sample from raw FastQ files

    Required input:
        - __fastq_sampling__input_fastq: list of fastq.gz files

    Required output:
        - __fastq_sampling__output_fastq: list of fastq.gz files 

    Required configuration:
        .. code-block:: yaml

            fastq_sampling:
                N: # number of reads to select

    Uses **sequana_fastq_head** utility.

    """
    input: __fastq_sampling__input_fastq
    output: __fastq_sampling__output_fastq
    params:
        N = config["fastq_sampling"]['N']
    message: "fastq_sampling extracting %s reads" % config['fastq_sampling']['N']
    run:
        for i,o in zip(input, output):
            shell("fastq_head %s %s %s" % (i, params.N * 4, o))

