Skip to content

Commit 7c52cae

Browse files
committed
Add Freyja data update
1 parent 1ae1c41 commit 7c52cae

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

config/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ All of the following variables are pre-defined in [config.yaml](/config/config.y
142142
- `IVAR_FREQ`: minimum frequency threshold for `ivar variants` (option `-t`).
143143
- `IVAR_DEPTH`: minimum read depth for `ivar variants` (option `-m`).
144144
- `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`).
145+
- `PATHOGEN`: pathogen of interest for `freyja update` (option `--pathogen`); must be 'SARS-CoV-2'.
146146
- `MIN_QUALITY`: minimum quality for `freyja variants` (option `--minq`).
147147
- `COV_CUTOFF`: minimum depth to calculate coverage for `freyja demix` (option `--covcut`).
148148
- `MIN_ABUNDANCE`: minimum lineage estimated abundance for `freyja demix` (option `--eps`).

workflow/rules/demix.smk

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
rule demix_update:
2+
threads: 1
3+
shadow: "shallow"
4+
conda:
5+
"../envs/freyja.yaml"
6+
params:
7+
pathogen = config["DEMIX"]["PATHOGEN"]
8+
output:
9+
folder = directory(OUTDIR/"demixing"/"freyja_data"),
10+
curated_lineages = OUTDIR/"demixing"/"freyja_data"/"curated_lineages.json",
11+
last_barcode_update = OUTDIR/"demixing"/"freyja_data"/"last_barcode_update.txt",
12+
lineage_mutations = OUTDIR/"demixing"/"freyja_data"/"lineage_mutations.json",
13+
lineage_yml = OUTDIR/"demixing"/"freyja_data"/"lineages.yml",
14+
pathogens = OUTDIR/"demixing"/"freyja_data"/"pathogen_config.yml",
15+
usher_barcodes = OUTDIR/"demixing"/"freyja_data"/"usher_barcodes.feather"
16+
log:
17+
LOGDIR / "demix_update" / "log.txt"
18+
shell:
19+
"mkdir -p {output.folder:q} && "
20+
"freyja update --outdir {output.folder:q} --pathogen {params.pathogen:q} >{log} 2>&1"
21+
22+
123
rule demix_preprocessing:
224
threads: 1
325
conda: "../envs/freyja.yaml"
@@ -29,16 +51,18 @@ rule demix:
2951
shadow: "minimal"
3052
input:
3153
depth_file = OUTDIR/"demixing"/"{sample}/{sample}_depth.txt",
32-
variants_file = OUTDIR/"demixing"/"{sample}/{sample}_variants.tsv"
54+
variants_file = OUTDIR/"demixing"/"{sample}/{sample}_variants.tsv",
55+
barcodes = OUTDIR/"demixing"/"freyja_data"/"usher_barcodes.feather",
56+
curated_lineages = OUTDIR/"demixing"/"freyja_data"/"curated_lineages.json",
57+
lineage_yml = OUTDIR/"demixing"/"freyja_data"/"lineages.yml"
3358
params:
3459
coverage_cutoff = config["DEMIX"]["COV_CUTOFF"],
3560
minimum_abundance = config["DEMIX"]["MIN_ABUNDANCE"],
3661
confirmed_only = "--confirmedonly " if config["DEMIX"]["CONFIRMED_ONLY"] else "",
3762
depth_cutoff = config["DEMIX"]["DEPTH_CUTOFF"],
3863
auto_adapt = "--autoadapt " if config["DEMIX"]["AUTO_ADAPT"] else "",
3964
relaxed_mrca = "--relaxedmrca " if config["DEMIX"]["RELAXED_MRCA"] else "",
40-
relaxed_mrca_thresh = config["DEMIX"]["RELAXED_MRCA_THRESH"],
41-
pathogen = config["DEMIX"]["PATHOGEN"]
65+
relaxed_mrca_thresh = config["DEMIX"]["RELAXED_MRCA_THRESH"]
4266
output:
4367
demix_file = OUTDIR/"demixing"/"{sample}/{sample}_demixed.tsv"
4468
log:
@@ -47,6 +71,9 @@ rule demix:
4771
"freyja demix "
4872
"{input.variants_file:q} "
4973
"{input.depth_file:q} "
74+
"--barcodes {input.barcodes:q} "
75+
"--meta {input.curated_lineages:q} "
76+
"--lineageyml {input.lineage_yml:q} "
5077
"--eps {params.minimum_abundance} "
5178
"--covcut {params.coverage_cutoff} "
5279
"--depthcutoff {params.depth_cutoff} "

0 commit comments

Comments
 (0)