<commit_before>rule hp_table_population_chromosome:
    """
    Build the hp table for a population in a chromosome.
    """
    input:
        snps_gz =  PLOT_D + "{population}.snps.gz"
    output:
        hp_gz = protected(TABLE_HP + "{population}.tsv.gz")
    log: TABLE_HP + "{population}.log"
    benchmark: TABLE_HP + "{population}.json"
    shell:
        "(gzip --decompress --stdout {input.snps_gz} "
        "| python3 src/snps_to_hp.py "
        "| pigz --best "
        "> {output.hp_gz}) "
        "2> {log}"



rule hp_plot_population:
    """
    Plot the genome-wide H_p distribution of a population
    """
    input:
        hp_gz = TABLE_HP + "{population}.tsv.gz"
    output:
        z_pdf = PLOT_HP + "{population}_z.pdf",
        pdf = PLOT_HP + "{population}.pdf"
    threads:
        1
    log: PLOT_HP + "{population}.log"
    benchmark: PLOT_HP + "{population}.json"
    shell:
        "Rscript src/plot_score.R "
            "none "
            "{input.hp_gz} "
            "{output.pdf} "
        "2>> {log} ; "
        "Rscript src/plot_score.R "
            "z "
            "{input.hp_gz} "
            "{output.z_pdf} "
        "2>> {log}"<commit_msg>Bugfix<commit_after>rule hp_table_population_chromosome:
    """
    Build the hp table for a population in a chromosome.
    """
    input:
        snps_gz =  PLOT_D + "{population}.snps.gz"
    output:
        hp_gz = protected(TABLE_HP + "{population}.tsv.gz")
    log: TABLE_HP + "{population}.log"
    benchmark: TABLE_HP + "{population}.json"
    shell:
        "(gzip --decompress --stdout {input.snps_gz} "
        "| python3 src/snps_to_hp.py "
        "| pigz --best "
        "> {output.hp_gz}) "
        "2> {log}"



rule hp_plot_population:
    """
    Plot the genome-wide H_p distribution of a population
    """
    input:
        hp_gz = TABLE_HP + "{population}.tsv.gz"
    output:
        z_pdf = PLOT_HP + "{population}_z.pdf",
        pdf = PLOT_HP + "{population}.pdf"
    threads:
        1
    log: PLOT_HP + "{population}.log"
    benchmark: PLOT_HP + "{population}.json"
    shell:
        "Rscript src/plot_score.R "
            "--input {input.hp_gz} "
            "--output {output.pdf} "
        "2>> {log} ; "
        "Rscript src/plot_score.R "
            "--normalize "
            "--input {input.hp_gz} "
            "--output {output.z_pdf} "
        "2>> {log}"
{'fraction_non_alphanumeric': 0.1477129668485103, 'fraction_numerical': 0.00419639110365086, 'mean_word_length': 1.8896969696969697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '471636', 'n_tokens_mistral': 855, 'n_tokens_neox': 811, 'n_words': 166}