Skip to content

Bug: Incorrect shell command syntax in basecounts_QC rule (mafs.smk) #187

@poursalavati

Description

@poursalavati

Describe the bug
The basecounts_QC rule located in workflow/rules/mafs.smk fails during execution due to two syntax errors in its shell command block:

  1. The --fract argument is constructed as f"--fract={path}", but the underlying script expects a space between the flag and its value (--fract {path}).
  2. An extraneous -- is placed before the positional input file argument {input.COVERAGE}, which causes the script's argument parser to fail.

To Reproduce
Steps to reproduce the behavior:

  1. V-pipe configuration file used: A configuration where basecounts_qc.depth_qc_type is set to "fraction".
  2. Samples TSV file used: Any standard samples.
  3. Commands executed: snakemake --use-conda --cores 32
  4. See error: The pipeline fails at the basecounts_QC rule with a non-zero exit code.

Expected behavior
The basecounts_QC rule should construct a valid shell command and execute successfully when the configuration requires it.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Linux (HPC environment)
  • Version: master branch

Additional context
The fix requires two small changes to the params and shell sections of the basecounts_QC rule.

Here is the corrected version of the rule:

rule basecounts_QC:
    input:
        COVERAGE="{dataset}/alignments/coverage.tsv.gz",
        CHROM_SIZE=(
            cohortdir("chrom.size")
            if config["basecounts_qc"]["depth_qc_type"] == "fraction"
            else []
        ),
    output:
        COV_DEPTH_QC="{dataset}/alignments/coverage_depth_qc.yaml",
    params:
        COV_DEPTH_QC=config.applications["coverage_depth_qc"],
        DEPTHS=config["basecounts_qc"]["depth_qc_list"],
        CHROM_SIZE=(
            f"--fract {cohortdir('chrom.size')}" # Changed "=" to a space
            if config["basecounts_qc"]["depth_qc_type"] == "fraction"
            else ""
        ),
    log:
        outfile="{dataset}/alignments/basecounts_qc.out.log",
        errfile="{dataset}/alignments/basecounts_qc.out.log",
    conda:
        config.basecounts_qc["conda"]
    benchmark:
        "{dataset}/alignments/coverage_depth_qc.benchmark"
    resources:
        disk_mb=1250,
        mem_mb=config.basecounts_qc["mem"],
        runtime=config.basecounts_qc["time"],
    threads: 1
    shell:
        """
        {params.COV_DEPTH_QC} {params.CHROM_SIZE} --depth {params.DEPTHS} --output {output.COV_DEPTH_QC} {input.COVERAGE}    \
            > "{log.outfile}" 2> >(tee "{log.errfile}" >&2)
        """ # Removed "--" before {input.COVERAGE}

Applying these changes allows the rule to run as expected.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions