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

Accept only-one-sample per project as input to QuaC

parent 28bbc54c
No related branches found
No related tags found
1 merge request!3Accept only-one-sample per project as input to QuaC
#family_id sample_id paternal_id maternal_id sex phenotype #family_id sample_id paternal_id maternal_id sex phenotype
unknown A -9 -9 -9 -9 unknown A father_1 mother_1 -9 -9
unknown B -9 -9 -9 -9
#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
...@@ -30,3 +30,8 @@ YYYY-MM-DD John Doe ...@@ -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'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. * 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 * 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).
...@@ -318,7 +318,7 @@ conda activate quac ...@@ -318,7 +318,7 @@ conda activate quac
python src/run_quac.py \ python src/run_quac.py \
--project_name test_project \ --project_name test_project \
--projects_path ".test/ngs-data/" \ --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" \ --outdir "$USER_SCRATCH/tmp/quac/results/test_project_wgs/analysis" \
-e="--conda-create-envs-only" -e="--conda-create-envs-only"
``` ```
...@@ -402,27 +402,30 @@ module load Anaconda3/2020.02 ...@@ -402,27 +402,30 @@ module load Anaconda3/2020.02
conda activate quac conda activate quac
# WGS mode # WGS mode
PROJECT="project_2_samples"
python src/run_quac.py \ python src/run_quac.py \
--project_name test_project \ --project_name test_project \
--projects_path ".test/ngs-data/" \ --projects_path ".test/ngs-data/" \
--pedigree ".test/configs/project.ped" \ --pedigree ".test/configs/${PROJECT}.ped" \
--outdir "$USER_SCRATCH/tmp/quac/results/test_project_wgs/analysis" --outdir "$USER_SCRATCH/tmp/quac/results/test_${PROJECT}_wgs/analysis"
# Exome mode # Exome mode
python src/run_quac.py \ python src/run_quac.py \
--project_name test_project \ --project_name test_project \
--projects_path ".test/ngs-data/" \ --projects_path ".test/ngs-data/" \
--pedigree ".test/configs/project.ped" \ --pedigree ".test/configs/${PROJECT}.ped" \
--outdir "$USER_SCRATCH/tmp/quac/results/test_project_exome/analysis" \ --outdir "$USER_SCRATCH/tmp/quac/results/test_${PROJECT}_exome/analysis" \
--quac_watch_config "configs/quac_watch/exome_quac_watch_config.yaml" \ --quac_watch_config "configs/quac_watch/exome_quac_watch_config.yaml" \
--exome --exome
``` ```
Note: Use `PROJECT="project_1_sample"` to test out a project with only one sample.
### Expected output files ### Expected output files
```sh ```sh
$ tree $USER_SCRATCH/tmp/quac/results/test_project/ -d -L 4 $ tree $USER_SCRATCH/tmp/quac/results/test_project_2_samples/ -d -L 4
/data/scratch/manag/tmp/quac/results/test_project/ /data/scratch/manag/tmp/quac/results/test_project_2_samples/
└── analysis └── analysis
├── A ├── A
│ └── qc │ └── qc
...@@ -494,14 +497,14 @@ DAG_DIR="pipeline_visualized" ...@@ -494,14 +497,14 @@ DAG_DIR="pipeline_visualized"
python src/run_quac.py \ python src/run_quac.py \
--project_name test_project \ --project_name test_project \
--projects_path .test/ngs-data/ \ --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" --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 # Rulegraph - less informative than DAG at sample level but less dense than DAG makes this easier to skim
python src/run_quac.py \ python src/run_quac.py \
--project_name test_project \ --project_name test_project \
--projects_path .test/ngs-data/ \ --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" --run_locally --extra_args "--rulegraph -F | dot -Tpng > ${DAG_DIR}/wgs_rulegraph.png"
###### Exome mode ###### ###### Exome mode ######
...@@ -509,7 +512,7 @@ python src/run_quac.py \ ...@@ -509,7 +512,7 @@ python src/run_quac.py \
python src/run_quac.py \ python src/run_quac.py \
--project_name test_project \ --project_name test_project \
--projects_path .test/ngs-data/ \ --projects_path .test/ngs-data/ \
--pedigree .test/configs/project.ped \ --pedigree .test/configs/project_2_samples.ped \
--exome \ --exome \
--quac_watch_config "configs/quac_watch/exome_quac_watch_config.yaml" \ --quac_watch_config "configs/quac_watch/exome_quac_watch_config.yaml" \
--run_locally --extra_args "--dag -F | dot -Tpng > ${DAG_DIR}/exome_dag.png" --run_locally --extra_args "--dag -F | dot -Tpng > ${DAG_DIR}/exome_dag.png"
...@@ -518,7 +521,7 @@ python src/run_quac.py \ ...@@ -518,7 +521,7 @@ python src/run_quac.py \
python src/run_quac.py \ python src/run_quac.py \
--project_name test_project \ --project_name test_project \
--projects_path .test/ngs-data/ \ --projects_path .test/ngs-data/ \
--pedigree .test/configs/project.ped \ --pedigree .test/configs/project_2_samples.ped \
--exome \ --exome \
--quac_watch_config "configs/quac_watch/exome_quac_watch_config.yaml" \ --quac_watch_config "configs/quac_watch/exome_quac_watch_config.yaml" \
--run_locally --extra_args "--rulegraph -F | dot -Tpng > ${DAG_DIR}/exome_rulegraph.png" --run_locally --extra_args "--rulegraph -F | dot -Tpng > ${DAG_DIR}/exome_rulegraph.png"
......
...@@ -124,13 +124,11 @@ rule mosdepth_plot: ...@@ -124,13 +124,11 @@ rule mosdepth_plot:
protected(OUT_DIR / "project_level_qc" / "mosdepth" / "mosdepth.html"), protected(OUT_DIR / "project_level_qc" / "mosdepth" / "mosdepth.html"),
message: message:
"Running mosdepth plotting" "Running mosdepth plotting"
params:
infiles=lambda wildcards: str(OUT_DIR / f"{{{','.join(SAMPLES)}}}" / "qc" / "mosdepth" / "*.mosdepth.global.dist.txt"),
shell: shell:
r""" r"""
python {input.script} \ python {input.script} \
--output {output} \ --output {output} \
{params.infiles} {input.dist}
""" """
...@@ -156,12 +154,11 @@ rule indexcov: ...@@ -156,12 +154,11 @@ rule indexcov:
str(WORKFLOW_PATH / "configs/env/goleft.yaml") str(WORKFLOW_PATH / "configs/env/goleft.yaml")
params: params:
outdir=lambda wildcards, output: Path(output[0]).parent, outdir=lambda wildcards, output: Path(output[0]).parent,
infiles=lambda wildcards: str(PROJECT_PATH / f"{{{','.join(SAMPLES)}}}" / "bam" / "*.bam"),
shell: shell:
r""" r"""
goleft indexcov \ goleft indexcov \
--directory {params.outdir} \ --directory {params.outdir} \
{params.infiles} \ {input.bam} \
> {log} 2>&1 > {log} 2>&1
""" """
......
...@@ -41,14 +41,13 @@ rule somalier_relate: ...@@ -41,14 +41,13 @@ rule somalier_relate:
log=OUT_DIR / "project_level_qc" / "somalier" / "relatedness" / "somalier.log", log=OUT_DIR / "project_level_qc" / "somalier" / "relatedness" / "somalier.log",
params: params:
outdir=lambda wildcards, output: Path(output["out"][0]).parent, 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: shell:
r""" r"""
somalier relate \ somalier relate \
--ped {input.ped} \ --ped {input.ped} \
--infer \ --infer \
--output-prefix {params.outdir}/somalier \ --output-prefix {params.outdir}/somalier \
{params.infiles} \ {input.extracted} \
> {log} 2>&1 > {log} 2>&1
""" """
...@@ -73,13 +72,12 @@ rule somalier_ancestry: ...@@ -73,13 +72,12 @@ rule somalier_ancestry:
log=OUT_DIR / "project_level_qc" / "somalier" / "ancestry" / "somalier.log", log=OUT_DIR / "project_level_qc" / "somalier" / "ancestry" / "somalier.log",
params: params:
outdir=lambda wildcards, output: Path(output["out"][0]).parent, 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: shell:
r""" r"""
somalier ancestry \ somalier ancestry \
--output-prefix {params.outdir}/somalier \ --output-prefix {params.outdir}/somalier \
--labels {input.labels_1kg} \ --labels {input.labels_1kg} \
{input.somalier_1kg_directory}/*.somalier ++ \ {input.somalier_1kg_directory}/*.somalier ++ \
{params.infiles} \ {input.extracted} \
> {log} 2>&1 > {log} 2>&1
""" """
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