Skip to content

Commit 7973490

Browse files
committed
Rename variant calling config options
Also adds demix option to restrict the maximum depth passed to samtools mpileup
1 parent 9def7f5 commit 7973490

6 files changed

Lines changed: 25 additions & 26 deletions

File tree

.test/targets.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ PLOTS:
2323
PROBLEMATIC_VCF:
2424
"https://raw.githubusercontent.com/W-L/ProblematicSites_SARS-CoV2/da322c32004f7b16bdaa6a8ee7fd24d56e79d9dc/problematic_sites_sarsCov2.vcf"
2525
VC:
26-
MAX_DEPTH: 0
2726
MIN_QUALITY: 0
28-
IVAR_QUALITY: 0
29-
IVAR_FREQ: 0.05
30-
IVAR_DEPTH: 5
27+
MIN_FREQ: 0.05
28+
MIN_DEPTH: 5
3129
DEMIX:
3230
MIN_QUALITY: 0
3331
COV_CUTOFF: 0

config/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ All of the following variables are pre-defined in [config.yaml](/config/config.y
140140
- `REPS`: number of replicates.
141141
- `THRESHOLD`: value cutoff for visualization.
142142
- `VC`: variant calling configuration:
143-
- `MAX_DEPTH`: maximum depth at a position for `samtools mpileup` (option `-d`).
144-
- `MIN_QUALITY`: minimum base quality for `samtools mpileup` (option `-Q`).
145-
- `IVAR_QUALITY`: minimum base quality for `ivar variants` (option `-q`).
146-
- `IVAR_FREQ`: minimum frequency threshold for `ivar variants` (option `-t`).
147-
- `IVAR_DEPTH`: minimum read depth for `ivar variants` (option `-m`).
143+
- `MIN_QUALITY`: minimum base quality for `ivar variants` (option `-q`).
144+
- `MIN_FREQ`: minimum frequency threshold for `ivar variants` (option `-t`).
145+
- `MIN_DEPTH`: minimum read depth for `ivar variants` (option `-m`).
146+
- `MAX_DEPTH`: maximum read depth for `samtools mpileup` (option `-d`).
148147
- `DEMIX`: demixing configuration (uses [Freyja](https://github.com/andersen-lab/Freyja), see also [its docs](https://andersen-lab.github.io/Freyja/index.html)):
149148
- `PATHOGEN`: pathogen of interest for `freyja update` (option `--pathogen`); must be 'SARS-CoV-2'.
150149
- `MIN_QUALITY`: minimum quality for `freyja variants` (option `--minq`).
150+
- `MAX_DEPTH`: maximum read depth for `samtools mpileup` (option `-d`).
151151
- `COV_CUTOFF`: minimum depth to calculate the reported "coverage" (percent of sites with that depth) for `freyja demix` (option `--covcut`).
152152
- `MIN_ABUNDANCE`: minimum lineage estimated abundance for `freyja demix` (option `--eps`).
153153
- `CONFIRMED_ONLY`: exclude unconfirmed lineages in `freyja demix` (option `--confirmedonly`).

config/config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ SHALRT:
1313
REPS: 1000
1414
THRESHOLD: 0.80
1515
VC:
16-
MAX_DEPTH: 0
17-
MIN_QUALITY: 0
18-
IVAR_QUALITY: 20
19-
IVAR_FREQ: 0.05
20-
IVAR_DEPTH: 30
16+
MIN_QUALITY: 20
17+
MIN_FREQ: 0.05
18+
MIN_DEPTH: 30
19+
MAX_DEPTH: 1000000
2120
ANNOTATION:
2221
# see: https://pcingola.github.io/SnpEff/adds/VCFannotationformat_v1.0.pdf
2322
SNPEFF_COLS:
@@ -52,6 +51,7 @@ ANNOTATION:
5251
DEMIX:
5352
PATHOGEN: "SARS-CoV-2"
5453
MIN_QUALITY: 20
54+
MAX_DEPTH: 1000000
5555
COV_CUTOFF: 30
5656
MIN_ABUNDANCE: 0.0001
5757
CONFIRMED_ONLY: false

workflow/rules/demix.smk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ rule demix_preprocessing:
2828
bam = get_input_bam,
2929
ref_fasta = lambda wildcards: select_mapping_references_fasta()
3030
params:
31+
max_depth = config["DEMIX"]["MAX_DEPTH"],
3132
minq = config["DEMIX"]["MIN_QUALITY"],
3233
output:
3334
depth_file = OUTDIR/"demixing"/"{sample}/{sample}_depth.txt",
@@ -37,7 +38,7 @@ rule demix_preprocessing:
3738
ivar = LOGDIR / "demix_preprocessing" / "{sample}_ivar.log.txt",
3839
shell:
3940
"set -euo pipefail && "
40-
"samtools mpileup -aa -A -d 600000 -Q {params.minq} -q 0 -B -f {input.ref_fasta:q} {input.bam:q} >sample.pileup 2>{log.pileup:q} && "
41+
"samtools mpileup -aa -A -d {params.max_depth} -Q {params.minq} -q 0 -B -f {input.ref_fasta:q} {input.bam:q} >sample.pileup 2>{log.pileup:q} && "
4142
"ivar variants -p variants -q {params.minq} -r {input.ref_fasta:q} >{log.ivar:q} 2>&1 <sample.pileup && "
4243
"cut -f1-4 sample.pileup >{output.depth_file:q} && "
4344
"mv variants.tsv {output.variants_file:q}"

workflow/rules/report.smk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ rule extract_genbank_regions:
8181
rule polymorphic_sites_over_time_data:
8282
conda: "../envs/renv.yaml"
8383
params:
84-
max_alt_freq = 1.0 - config["VC"]["IVAR_FREQ"],
84+
max_alt_freq = 1.0 - config["VC"]["MIN_FREQ"],
8585
input:
8686
variants = OUTDIR/f"{OUTPUT_NAME}.variants.tsv",
8787
metadata = config["METADATA"],
@@ -428,11 +428,11 @@ rule report:
428428
value = REPORT_DIR_TABLES/"diversity.json",
429429
stats_lm = REPORT_DIR_TABLES/"time_signal.json",
430430
stats_ml = REPORT_DIR_TABLES/"context_phylogeny.json",
431-
table = OUTDIR/"summary_table.csv",
431+
table = REPORT_DIR_TABLES/"summary_table.csv",
432432
sum_nv = REPORT_DIR_TABLES/"nv_panel_summary.json",
433433
params:
434434
workflow_version = get_repo_version(BASE_PATH.as_posix(), __version__),
435-
min_ivar_freq = config["VC"]["IVAR_FREQ"],
435+
min_ivar_freq = config["VC"]["MIN_FREQ"],
436436
ufboot_reps = config["UFBOOT"]["REPS"],
437437
shalrt_reps = config["SHALRT"]["REPS"],
438438
name = config["OUTPUT_NAME"],

workflow/rules/vaf.smk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ rule snps_to_ancestor:
44
shadow: "minimal"
55
conda: "../envs/var_calling.yaml"
66
params:
7-
max_depth = config["VC"]["MAX_DEPTH"],
8-
min_quality = config["VC"]["MIN_QUALITY"],
9-
ivar_quality = config["VC"]["IVAR_QUALITY"],
10-
ivar_freq = config["VC"]["IVAR_FREQ"],
11-
ivar_depth = config["VC"]["IVAR_DEPTH"]
7+
mpileup_depth = config["VC"]["MAX_DEPTH"],
8+
mpileup_quality = 0,
9+
ivar_quality = config["VC"]["MIN_QUALITY"],
10+
ivar_freq = config["VC"]["MIN_FREQ"],
11+
ivar_depth = config["VC"]["MIN_DEPTH"],
1212
input:
1313
reference_fasta = OUTDIR/f"{OUTPUT_NAME}.ancestor.fasta",
1414
bam = get_input_bam,
@@ -35,10 +35,10 @@ rule snps_to_ancestor:
3535
samtools mpileup \
3636
-aa \
3737
--ignore-overlaps \
38-
-d {params.max_depth} \
38+
-d {params.mpileup_depth} \
3939
--count-orphans \
4040
--no-BAQ \
41-
-Q {params.min_quality} \
41+
-Q {params.mpileup_quality} \
4242
-f renamed_reference.fasta \
4343
{input.bam} \
4444
| ivar variants \
@@ -215,4 +215,4 @@ rule pairwise_trajectory_correlation:
215215
log:
216216
LOGDIR / "pairwise_trajectory_correlation" / "log.txt"
217217
script:
218-
"../scripts/report/pairwise_trajectory_correlation.R"
218+
"../scripts/pairwise_trajectory_correlation.R"

0 commit comments

Comments
 (0)