Skip to content

Commit 1ae1c41

Browse files
committed
Use Freyja version 2.0.0
1 parent f7e3a21 commit 1ae1c41

4 files changed

Lines changed: 34 additions & 12 deletions

File tree

config/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,16 @@ All of the following variables are pre-defined in [config.yaml](/config/config.y
141141
- `IVAR_QUALITY`: minimum base quality for `ivar variants` (option `-q`).
142142
- `IVAR_FREQ`: minimum frequency threshold for `ivar variants` (option `-t`).
143143
- `IVAR_DEPTH`: minimum read depth for `ivar variants` (option `-m`).
144-
- `DEMIX`: demixing configuration:
144+
- `DEMIX`: demixing configuration (uses [Freyja](https://github.com/andersen-lab/Freyja), see also [its docs](https://andersen-lab.github.io/Freyja/index.html)):
145+
- `PATHOGEN`: pathogen of interest for `freyja demix` (option `--pathogen`).
145146
- `MIN_QUALITY`: minimum quality for `freyja variants` (option `--minq`).
146-
- `COV_CUTOFF`: minimum depth for `freyja demix` (option `--covcut`).
147+
- `COV_CUTOFF`: minimum depth to calculate coverage for `freyja demix` (option `--covcut`).
147148
- `MIN_ABUNDANCE`: minimum lineage estimated abundance for `freyja demix` (option `--eps`).
149+
- `CONFIRMED_ONLY`: exclude unconfirmed lineages in `freyja demix` (option `--confirmedonly`).
150+
- `DEPTH_CUTOFF`: minimum depth on each site for `freyja demix` (option `--depthcutoff`).
151+
- `RELAXED_MRCA`: assign clusters using relaxed (as opposed to strict) MRCA, used with `DEPTH_CUTOFF`, for `freyja demix` (option `--relaxedmrca`).
152+
- `RELAXED_MRCA_THRESH`: `RELAXED_MRCA` threshold for `freyja demix` (option `--relaxedthresh`).
153+
- `AUTO_ADAPT`: use error profile to set adaptive lasso penalty parameter for `freyja demix` (option `--autoadapt`).
148154
- `WINDOW`: sliding window of nucleotide variants per site configuration:
149155
- `WIDTH`: number of sites within windows.
150156
- `STEP`: number of sites between windows.

config/config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,15 @@ VC:
1919
IVAR_FREQ: 0.05
2020
IVAR_DEPTH: 30
2121
DEMIX:
22+
PATHOGEN: "SARS-CoV-2"
2223
MIN_QUALITY: 20
2324
COV_CUTOFF: 30
2425
MIN_ABUNDANCE: 0.0001
26+
CONFIRMED_ONLY: false
27+
DEPTH_CUTOFF: 30
28+
RELAXED_MRCA: false
29+
RELAXED_MRCA_THRESH: 0.9
30+
AUTO_ADAPT: false
2531
WINDOW:
2632
WIDTH: 1000
2733
STEP: 50

workflow/envs/freyja.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ channels:
22
- conda-forge
33
- bioconda
44
dependencies:
5-
- freyja==1.4.2
5+
- freyja==2.0.0

workflow/rules/demix.smk

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,30 @@ rule demix:
3232
variants_file = OUTDIR/"demixing"/"{sample}/{sample}_variants.tsv"
3333
params:
3434
coverage_cutoff = config["DEMIX"]["COV_CUTOFF"],
35-
minimum_abundance = config["DEMIX"]["MIN_ABUNDANCE"]
35+
minimum_abundance = config["DEMIX"]["MIN_ABUNDANCE"],
36+
confirmed_only = "--confirmedonly " if config["DEMIX"]["CONFIRMED_ONLY"] else "",
37+
depth_cutoff = config["DEMIX"]["DEPTH_CUTOFF"],
38+
auto_adapt = "--autoadapt " if config["DEMIX"]["AUTO_ADAPT"] else "",
39+
relaxed_mrca = "--relaxedmrca " if config["DEMIX"]["RELAXED_MRCA"] else "",
40+
relaxed_mrca_thresh = config["DEMIX"]["RELAXED_MRCA_THRESH"],
41+
pathogen = config["DEMIX"]["PATHOGEN"]
3642
output:
3743
demix_file = OUTDIR/"demixing"/"{sample}/{sample}_demixed.tsv"
3844
log:
3945
LOGDIR / "demix" / "{sample}.log.txt"
4046
shell:
41-
"""
42-
freyja demix \
43-
"{input.variants_file}" \
44-
"{input.depth_file}" \
45-
--eps {params.minimum_abundance} \
46-
--covcut {params.coverage_cutoff} \
47-
--output {output.demix_file} >{log} 2>&1
48-
"""
47+
"freyja demix "
48+
"{input.variants_file:q} "
49+
"{input.depth_file:q} "
50+
"--eps {params.minimum_abundance} "
51+
"--covcut {params.coverage_cutoff} "
52+
"--depthcutoff {params.depth_cutoff} "
53+
"{params.confirmed_only}"
54+
"{params.auto_adapt}"
55+
"{params.relaxed_mrca}"
56+
"--relaxedthresh {params.relaxed_mrca_thresh} "
57+
"--output {output.demix_file} "
58+
">{log} 2>&1"
4959

5060

5161
rule summarise_demixing:

0 commit comments

Comments
 (0)