DAY-EC activated.
DAY-EC activated.
=== contam_identity.smk haplocheck block ===
ources:
        vcpu=config["haplocheck"]["threads"],
        mem_mb=config["haplocheck"]["mem_mb"],
        partition=config["haplocheck"]["partition"],
    params:
        command=config["haplocheck"]["haplocheck_command"],
        sample_ok=lambda wildcards: require_qc_eligible_sample(
            wildcards, "Haplocheck VCF"
        ),
        cluster_sample=ret_sample,
    shell:
        r"""
        set -euo pipefail
        test {params.sample_ok:q} = ok
        outdir="$(dirname {output.contamination:q})"
        mkdir -p "$outdir" "$(dirname {log:q})"
        command -v {params.command:q} > /dev/null
        result_dir="$(mktemp -d "$outdir/.haplocheck_vcf_output.XXXXXX")"
        result_prefix="$result_dir/contamination.txt"
        cleanup() {{
            rm -rf "$result_dir"
        }}
        trap cleanup EXIT
        set +o pipefail
        if gzip -cd {input.vcf:q} | grep -m 1 -q -v '^#'; then
            has_variants=true
        else
            has_variants=false
        fi
        set -o pipefail
        if [[ "$has_variants" == "true" ]]; then
            set +e
            {params.command:q} --out "$result_prefix" --raw {input.vcf:q} > {log:q} 2>&1
            haplocheck_rc=$?
            set -e
            if [[ "$haplocheck_rc" -eq 0 ]]; then
                test -s "$result_dir/contamination.txt"
                test -s "$result_dir/contamination.raw.txt"
                test -s "$result_dir/contamination.html"
                cp "$result_dir/contamination.txt" {output.contamination:q}
                cp "$result_dir/contamination.raw.txt" {output.raw:q}
                cp "$result_dir/contamination.html" {output.html:q}
            elif grep -q 'outside the range.*rCRS only' {log:q}; then
                printf 'SampleID	Contamination Status	Contamination Level	Distance	Sample Coverage	Major Haplogroup	Minor Haplogroup
%s	UNSUPPORTED_REFERENCE	0		0		
' {wildcards.sample:q} > {output.contamination:q}
                printf 'SampleID	Contamination Status	Contamination Level	Distance	Sample Coverage	Major Haplogroup	Minor Haplogroup
%s	UNSUPPORTED_REFERENCE	0		0		
' {wildcards.sample:q} > {output.raw:q}
                printf '<html><body>UNSUPPORTED_REFERENCE</body></html>
' > {output.html:q}
                printf 'UNSUPPORTED_REFERENCE: haplocheck skipped because the input VCF is not restricted to rCRS positions.
' >> {log:q}
            else
                exit "$haplocheck_rc"
            fi
        else
            printf 'SampleID	Contamination Status	Contamination Level	Distance	Sample Coverage	Major Haplogroup	Minor Haplogroup
%s	NO_VARIANTS	0		0		
' {wildcards.sample:q} > {output.contamination:q}
            printf 'SampleID	Contamination Status	Contamination Level	Distance	Sample Coverage	Major Haplogroup	Minor Haplogroup
%s	NO_VARIANTS	0		0		
' {wildcards.sample:q} > {output.raw:q}
            printf '<html><body>NO_VARIANTS</body></html>
' > {output.html:q}
            printf 'NO_VARIANTS: haplocheck skipped because the input VCF has no variant records.
' > {log:q}
        fi
        """


rule read_haps_contam_identity:
    input:
        bam=rules.legacy_cram_compat_bam.output.bam,
        bai=rules.legacy_cram_compat_bam.output.bai,
        vcf=_contam_identity_primary_snv_vcf,
        tbi=_contam_identity_primary_snv_tbi,
    output:
        txt=MDIR + "{sample}/align/{alnr}/{ddup}/snv/{snv}/contam_
=== haplocheck log tail ===
Error! Position 56834249 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56834254 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56834277 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56834289 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56834302 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56834560 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56834736 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56835530 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56835963 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56835975 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56835980 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56836132 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56836144 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56836177 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56836180 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56836194 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56836206 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56836586 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56837557 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56837944 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56837999 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56842093 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56842482 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56844959 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56848889 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56848892 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56850468 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56850480 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56850488 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56850491 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56850496 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56850512 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56853606 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56853618 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56853626 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56855606 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56855967 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56857445 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56857603 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56859251 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56860405 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56861285 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56861632 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56865836 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56865860 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56865938 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56866015 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56866833 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56866847 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56866870 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56866871 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56868240 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56868569 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56868647 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56870111 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56870257 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56870383 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56871631 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56873542 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56873588 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56874254 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56874581 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56876445 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56876571 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56876576 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56876621 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56876844 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56886638 outside the range. Please double check if VCF includes variants mapped to rCRS only.
Error! Position 56886662 outside the range. Please double check if VCF includes variants mapped to rCRS only.
RUN Split Profile into Major/Minor Profile...
RUN Classify Haplogroups...
RUN Detect Contamination...
RUN Write Contamination Report...
Text report written to results/day/hg38/JEMILMN0P1-HG002-0p1x-1-D0-PF-ILMN-NOVASEQ/align/sent/dmd/snv/sentd/contam_identity/haplocheck/vcf/.haplocheck_vcf_output.n5Y3c0/contamination.txt.
Raw report written to results/day/hg38/JEMILMN0P1-HG002-0p1x-1-D0-PF-ILMN-NOVASEQ/align/sent/dmd/snv/sentd/contam_identity/haplocheck/vcf/.haplocheck_vcf_output.n5Y3c0/contamination.raw.txt.
Process file /reports/haplocheck.html...
  Include style haplocheck.css...
  Include javascript haplocheck.js...
HTML Report written to /fsx/analysis_results/ubuntu/ccv20260529r40_illumina_hg002_kitchensink_multiqc/daylily-omics-analysis/results/day/hg38/JEMILMN0P1-HG002-0p1x-1-D0-PF-ILMN-NOVASEQ/align/sent/dmd/snv/sentd/contam_identity/haplocheck/vcf/.haplocheck_vcf_output.n5Y3c0/contamination.html.
OK Execution successful.
=== outputs ===
total 82
-rw-rw-r-- 1 ubuntu ubuntu   544 May 30 10:41 JEMILMN0P1-HG002-0p1x-1-D0-PF-ILMN-NOVASEQ.sent.dmd.sentd.haplocheck.contamination.raw.txt
-rw-rw-r-- 1 ubuntu ubuntu   146 May 30 10:41 JEMILMN0P1-HG002-0p1x-1-D0-PF-ILMN-NOVASEQ.sent.dmd.sentd.haplocheck.contamination.txt
-rw-rw-r-- 1 ubuntu ubuntu 11225 May 30 10:41 JEMILMN0P1-HG002-0p1x-1-D0-PF-ILMN-NOVASEQ.sent.dmd.sentd.haplocheck.report.html
drwxrwxr-x 2 ubuntu ubuntu 33280 May 30 10:40 logs
