Skip to content
Snippets Groups Projects
Commit c11a6628 authored by Manavalan Gajapathy's avatar Manavalan Gajapathy
Browse files

removes run-select-tools ability

parent b1de72b0
No related branches found
No related tags found
1 merge request!2QC under one umbrella (well mostly) under QuaC
......@@ -112,7 +112,7 @@ conda env update --file configs/env/quac.yaml
python src/run_quac.py \
--project_name test_project \
--projects_path .test/ngs-data/ \
--pedigree .test/configs/project.ped
--pedigree .test/configs/project.ped -l -n
```
## How to run QuaC
......@@ -139,10 +139,6 @@ QuaC workflow options:
supplied via --project_name (default: None)
--outdir Out directory path (default:
$USER_SCRATCH/tmp/quac/results)
-m , --modules Runs only these user-specified modules(s). If >1, use
comma as delimiter. See QuaC snakemake script for
available options. Useful for development. (default:
all)
--exome Flag to run in exome mode (default: False)
QuaC wrapper options:
......@@ -179,16 +175,16 @@ python src/run_quac.py --project_name CF_CFF_PFarrell --pedigree data/raw/ped/CF
python src/run_quac.py --project_name HCC --pedigree data/raw/ped/HCC.ped --exome
# run for an exome project which is not in the default CGDS projects_path
python src/run_quac.py --project_name UnusualCancers_CMGalluzi \
python src/run_quac.py \
--project_name UnusualCancers_CMGalluzi \
--projects_path /data/project/sloss/cgds_path_cmgalluzzi/ \
--pedigree data/raw/ped/UnusualCancers_CMGalluzi.ped \
--exome
# for a WGS project, run specific modules/tools and write results to a dir of choice
# for a WGS project, and write results to a dir of choice
python src/run_quac.py \
--project_name CF_CFF_PFarrell \
--pedigree data/raw/ped/CF_CFF_PFarrell.ped \
--modules somalier \
--outdir /some/lake/with/plenty/ducks/
```
......
#!/usr/bin/env python3
"""
QuaC pipeline.
QuaC pipeline runner tool.
Reads user input data, constructs snakemake command to run the pipeline
along with their required modules, and submits them as slurm job.
Reads user input data, constructs snakemake command to run the pipeline,
and submits them as slurm job.
Run the script with --help flag to see its available options.
......@@ -38,7 +38,6 @@ def create_snakemake_command(args):
snakefile_path = repo_path / "workflow" / "Snakefile"
quac_configs = {
"modules": args.modules,
"project_name": args.project_name,
"projects_path": args.projects_path,
"ped": args.pedigree,
......@@ -164,14 +163,6 @@ if __name__ == "__main__":
type=lambda x: is_valid_dir(PARSER, x),
metavar="",
)
WORKFLOW.add_argument(
"-m",
"--modules",
help="Runs only these user-specified modules(s). If >1, use comma as delimiter. \
See QuaC snakemake script for available options. Useful for development.",
default="all",
metavar="",
)
WORKFLOW.add_argument(
"--exome",
action="store_true",
......
......@@ -15,7 +15,7 @@ include: "rules/common.smk"
include: "rules/relatedness_ancestry.smk"
include: "rules/coverage_analysis.smk"
include: "rules/within_species_contamintation.smk"
include: "rules/aggregate_results.smk"
# include: "rules/aggregate_results.smk"
#########################################
......@@ -30,9 +30,29 @@ wildcard_constraints:
#########################################
WGS_ONLY_COVERAGE_TARGETS = []
if not not EXOME_MODE:
WGS_ONLY_COVERAGE_TARGETS = [
OUT_DIR / "indexcov" / "index.html",
OUT_DIR / "covviz/" / "covviz_report.html"
]
rule all:
input:
TARGETS_SOMALIER,
TARGETS_COVERAGE,
TARGETS_CONTAMINATION,
OUT_DIR / "multiqc/multiqc_report.html",
## ancestry and relatedness ##
OUT_DIR / "somalier" / "relatedness" / "somalier.html",
OUT_DIR / "somalier" / "ancestry" / "somalier.somalier-ancestry.html",
## coverage ##
WGS_ONLY_COVERAGE_TARGETS,
expand(str(OUT_DIR / "mosdepth" / "results" / "{sample}.mosdepth.global.dist.txt"),
sample=SAMPLES),
## cross-sample contamination ##
expand(str(OUT_DIR / "verifyBamID" / "{sample}.Ancestry"),
sample=SAMPLES),
## results aggregation ##
# OUT_DIR / "multiqc/multiqc_report.html",
......@@ -13,49 +13,6 @@ def get_samples(ped_fpath):
return samples
def modules_to_run(user_input):
"""
Parse user-selected tools. Verify they are among the expected values.
"""
user_input = set([x.strip().lower() for x in user_input.strip().split(",")])
allowed_options = ["somalier", "verifybamid", "indexcov", "mosdepth", "covviz", "all"]
if user_input.difference(set(allowed_options)):
msg = f"ERROR: Unexpected module was supplied by user. Allowed options: {allowed_options}"
raise SystemExit(msg)
print(f"Tools chosen by user to run: {list(user_input)}")
return user_input
def get_targets(tool_name, samples=None):
"""
returns target files based on the tool
"""
flist = []
if tool_name == "somalier":
flist += [
OUT_DIR / "somalier" / "relatedness" / "somalier.html",
OUT_DIR / "somalier" / "ancestry" / "somalier.somalier-ancestry.html",
]
elif tool_name == "indexcov":
flist += [OUT_DIR / "indexcov" / "index.html"]
elif tool_name == "covviz":
flist += [OUT_DIR / "covviz/" / "covviz_report.html"]
elif tool_name == "mosdepth":
flist += [OUT_DIR / "mosdepth" / f"mosdepth.html"]
flist += (
expand(
str(OUT_DIR / "mosdepth" / "results" / "{sample}.mosdepth.global.dist.txt"), sample=samples
),
)
elif tool_name == "verifybamid":
flist += (expand(str(OUT_DIR / "verifyBamID" / "{sample}.Ancestry"), sample=samples),)
return flist
def is_testing_mode():
"checks if testing dataset is used as input for the pipeline"
......@@ -69,7 +26,6 @@ def is_testing_mode():
OUT_DIR = Path(config["out_dir"])
PROJECT_NAME = config["project_name"]
PROJECT_PATH = Path(config["projects_path"]) / PROJECT_NAME
MODULES_TO_RUN = modules_to_run(config["modules"])
PEDIGREE_FPATH = config["ped"]
EXOME_MODE = config["exome"]
......
TARGETS_COVERAGE = [
# indexcov
get_targets("indexcov") if {"all", "indexcov"}.intersection(MODULES_TO_RUN) and not EXOME_MODE else [],
# covviz
get_targets("covviz") if {"all", "covviz"}.intersection(MODULES_TO_RUN) and not EXOME_MODE else [],
# mosdepth
get_targets("mosdepth", SAMPLES) if {"all", "mosdepth"}.intersection(MODULES_TO_RUN) else [],
]
########################## Mosdepth ##########################
rule mosdepth_coverage:
input:
......
TARGETS_SOMALIER = [
get_targets("somalier") if {"all", "somalier"}.intersection(MODULES_TO_RUN) else [],
]
rule somalier_extract:
input:
bam=PROJECT_PATH / "analysis" / "{sample}" / "bam" / "{sample}.bam",
......
TARGETS_CONTAMINATION = [
get_targets("verifybamid", SAMPLES) if {"all", "verifybamid"}.intersection(MODULES_TO_RUN) else [],
]
def get_svd(wildcards):
if EXOME_MODE:
return expand(f"{config['verifyBamID']['svd_dat_exome']}.{{ext}}", ext=["bed", "mu", "UD"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment