diff --git a/.test/configs/project.ped b/.test/configs/project_1_sample.ped similarity index 57% rename from .test/configs/project.ped rename to .test/configs/project_1_sample.ped index a17d4e13c9a5a6912f320ea3dc18a1b026546c96..41e547acb61a420b9529b9fd2ad2866df20e6f29 100644 --- a/.test/configs/project.ped +++ b/.test/configs/project_1_sample.ped @@ -1,3 +1,2 @@ #family_id sample_id paternal_id maternal_id sex phenotype -unknown A -9 -9 -9 -9 -unknown B -9 -9 -9 -9 +unknown A father_1 mother_1 -9 -9 diff --git a/.test/configs/project_2_samples.ped b/.test/configs/project_2_samples.ped new file mode 100644 index 0000000000000000000000000000000000000000..91a691c58614b76172379e78a4c31c38e8bfef2d --- /dev/null +++ b/.test/configs/project_2_samples.ped @@ -0,0 +1,3 @@ +#family_id sample_id paternal_id maternal_id sex phenotype +unknown A father_1 mother_1 -9 -9 +unknown B father_1 mother_1 -9 -9 diff --git a/Changelog.md b/Changelog.md index 6571dec1d93b44530a0e84c4257dfa41c4d325cd..3d0fccc05287590dc545ef1239f6238c8b8c57be 100644 --- a/Changelog.md +++ b/Changelog.md @@ -30,3 +30,8 @@ YYYY-MM-DD John Doe * QuaC's input are output from the small variant caller pipeline, and former's output will fit seemlessly with the latter's output. * QuaC accepts pedigree file as input. A dummy pedigree file creator script is provided, which will be handy until phenotips is made available to us. * System-level testing is added + +2021-06-08 Manavalan Gajapathy + +* Bugfix: Fixes error when there is only one sample in input ped file (#34) +* Adds system-testing for such only-one-sample-in-input setup (#35). diff --git a/README.md b/README.md index 126ab3f84be6893ddb322be3029cb526d1be4f27..67047b5d018fdf8cb598a45c52a28015f2828035 100644 --- a/README.md +++ b/README.md @@ -318,7 +318,7 @@ conda activate quac python src/run_quac.py \ --project_name test_project \ --projects_path ".test/ngs-data/" \ - --pedigree ".test/configs/project.ped" \ + --pedigree ".test/configs/project_2_samples.ped" \ --outdir "$USER_SCRATCH/tmp/quac/results/test_project_wgs/analysis" \ -e="--conda-create-envs-only" ``` @@ -402,27 +402,30 @@ module load Anaconda3/2020.02 conda activate quac # WGS mode +PROJECT="project_2_samples" python src/run_quac.py \ --project_name test_project \ --projects_path ".test/ngs-data/" \ - --pedigree ".test/configs/project.ped" \ - --outdir "$USER_SCRATCH/tmp/quac/results/test_project_wgs/analysis" + --pedigree ".test/configs/${PROJECT}.ped" \ + --outdir "$USER_SCRATCH/tmp/quac/results/test_${PROJECT}_wgs/analysis" # Exome mode python src/run_quac.py \ --project_name test_project \ --projects_path ".test/ngs-data/" \ - --pedigree ".test/configs/project.ped" \ - --outdir "$USER_SCRATCH/tmp/quac/results/test_project_exome/analysis" \ + --pedigree ".test/configs/${PROJECT}.ped" \ + --outdir "$USER_SCRATCH/tmp/quac/results/test_${PROJECT}_exome/analysis" \ --quac_watch_config "configs/quac_watch/exome_quac_watch_config.yaml" \ --exome ``` +Note: Use `PROJECT="project_1_sample"` to test out a project with only one sample. + ### Expected output files ```sh -$ tree $USER_SCRATCH/tmp/quac/results/test_project/ -d -L 4 -/data/scratch/manag/tmp/quac/results/test_project/ +$ tree $USER_SCRATCH/tmp/quac/results/test_project_2_samples/ -d -L 4 +/data/scratch/manag/tmp/quac/results/test_project_2_samples/ └── analysis ├── A │  └── qc @@ -494,14 +497,14 @@ DAG_DIR="pipeline_visualized" python src/run_quac.py \ --project_name test_project \ --projects_path .test/ngs-data/ \ - --pedigree .test/configs/project.ped \ + --pedigree .test/configs/project_2_samples.ped \ --run_locally --extra_args "--dag -F | dot -Tpng > ${DAG_DIR}/wgs_dag.png" # Rulegraph - less informative than DAG at sample level but less dense than DAG makes this easier to skim python src/run_quac.py \ --project_name test_project \ --projects_path .test/ngs-data/ \ - --pedigree .test/configs/project.ped \ + --pedigree .test/configs/project_2_samples.ped \ --run_locally --extra_args "--rulegraph -F | dot -Tpng > ${DAG_DIR}/wgs_rulegraph.png" ###### Exome mode ###### @@ -509,7 +512,7 @@ python src/run_quac.py \ python src/run_quac.py \ --project_name test_project \ --projects_path .test/ngs-data/ \ - --pedigree .test/configs/project.ped \ + --pedigree .test/configs/project_2_samples.ped \ --exome \ --quac_watch_config "configs/quac_watch/exome_quac_watch_config.yaml" \ --run_locally --extra_args "--dag -F | dot -Tpng > ${DAG_DIR}/exome_dag.png" @@ -518,7 +521,7 @@ python src/run_quac.py \ python src/run_quac.py \ --project_name test_project \ --projects_path .test/ngs-data/ \ - --pedigree .test/configs/project.ped \ + --pedigree .test/configs/project_2_samples.ped \ --exome \ --quac_watch_config "configs/quac_watch/exome_quac_watch_config.yaml" \ --run_locally --extra_args "--rulegraph -F | dot -Tpng > ${DAG_DIR}/exome_rulegraph.png" diff --git a/workflow/rules/coverage_analysis.smk b/workflow/rules/coverage_analysis.smk index 872357a58f67cbb33f11abd78f6d9535ec9d6de0..e8ff6198094ea24176122b5f703167d415dd27a1 100644 --- a/workflow/rules/coverage_analysis.smk +++ b/workflow/rules/coverage_analysis.smk @@ -124,13 +124,11 @@ rule mosdepth_plot: protected(OUT_DIR / "project_level_qc" / "mosdepth" / "mosdepth.html"), message: "Running mosdepth plotting" - params: - infiles=lambda wildcards: str(OUT_DIR / f"{{{','.join(SAMPLES)}}}" / "qc" / "mosdepth" / "*.mosdepth.global.dist.txt"), shell: r""" python {input.script} \ --output {output} \ - {params.infiles} + {input.dist} """ @@ -156,12 +154,11 @@ rule indexcov: str(WORKFLOW_PATH / "configs/env/goleft.yaml") params: outdir=lambda wildcards, output: Path(output[0]).parent, - infiles=lambda wildcards: str(PROJECT_PATH / f"{{{','.join(SAMPLES)}}}" / "bam" / "*.bam"), shell: r""" goleft indexcov \ --directory {params.outdir} \ - {params.infiles} \ + {input.bam} \ > {log} 2>&1 """ diff --git a/workflow/rules/relatedness_ancestry.smk b/workflow/rules/relatedness_ancestry.smk index 4c37b6880a3483ce24384e42b0a333f0deef4393..5bacedf72820debb755c49e871948b75e246b201 100644 --- a/workflow/rules/relatedness_ancestry.smk +++ b/workflow/rules/relatedness_ancestry.smk @@ -41,14 +41,13 @@ rule somalier_relate: log=OUT_DIR / "project_level_qc" / "somalier" / "relatedness" / "somalier.log", params: outdir=lambda wildcards, output: Path(output["out"][0]).parent, - infiles=lambda wildcards: str(OUT_DIR / "project_level_qc" / "somalier" / "extract" / f"{{{','.join(SAMPLES)}}}.somalier"), shell: r""" somalier relate \ --ped {input.ped} \ --infer \ --output-prefix {params.outdir}/somalier \ - {params.infiles} \ + {input.extracted} \ > {log} 2>&1 """ @@ -73,13 +72,12 @@ rule somalier_ancestry: log=OUT_DIR / "project_level_qc" / "somalier" / "ancestry" / "somalier.log", params: outdir=lambda wildcards, output: Path(output["out"][0]).parent, - infiles=lambda wildcards: str(OUT_DIR / "project_level_qc" / "somalier" / "extract" / f"{{{','.join(SAMPLES)}}}.somalier"), shell: r""" somalier ancestry \ --output-prefix {params.outdir}/somalier \ --labels {input.labels_1kg} \ {input.somalier_1kg_directory}/*.somalier ++ \ - {params.infiles} \ + {input.extracted} \ > {log} 2>&1 """