Skip to content

Commit

Permalink
feat: FLiRT Mutations column (#664)
Browse files Browse the repository at this point in the history
* init

* fmt

* add to other config.yaml and template files

* add def

* add to env output

* fmt
  • Loading branch information
alethomas authored Aug 29, 2024
1 parent f46ec83 commit f77d42e
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 15 deletions.
6 changes: 6 additions & 0 deletions .tests/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ mixtures:
- "_MIX_B-1-1-7_PERC_90_MIX_B-1-351_PERC_10"

# mutations to be highlighted (protein name -> variants)

flirt:
S:
- F456L
- R346T

mth:
S:
- N501Y
Expand Down
14 changes: 10 additions & 4 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ data-handling:
# flag for archiving data
# True: data is archived in path defined below
# False: data is not archived
archive-data: True
archive-data: False
# path of incoming data, which is moved to the
# data directory by the preprocessing script
incoming: ../incoming/
Expand All @@ -34,7 +34,7 @@ data-handling:
quality-criteria:
illumina:
# minimal length of acceptable reads
min-length-reads: 30
min-length-reads: 100
# average quality of acceptable reads (PHRED)
min-PHRED: 20
ont:
Expand All @@ -61,9 +61,9 @@ preprocessing:
# ARTIC primer version to clip from reads. See
# https://github.com/artic-network/artic-ncov2019/tree/master/primer_schemes/nCoV-2019/V4
# for more information
artic-primer-version: 3
artic-primer-version: 4
# path to amplicon primers in bed format for hard-clipping on paired end files (illumina) or url to file that should be downloaded
amplicon-primers: "resources/nCoV-2019.primer.bed"
amplicon-primers: "resources/SARS-CoV-2-artic-v4_1.primer.bed"
# GenBank accession of reference sequence of the amplicon primers
amplicon-reference: "MN908947"

Expand Down Expand Up @@ -124,6 +124,12 @@ strain-calling:
B.1.617.2: OK091006

# mutations to be highlighted (protein name -> variants)

flirt:
S:
- F456L
- R346T

mth:
S:
- L18F
Expand Down
3 changes: 3 additions & 0 deletions resources/report-table-formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
}

},
"FLiRT Mutations": function format(value) {
return this["variant helper"](value, true);
},
"VOC Mutations": function format(value) {
return this["variant helper"](value, true);
},
Expand Down
26 changes: 16 additions & 10 deletions workflow/rules/generate_output.smk
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ rule overview_table_patient_csv:
wildcards, "all samples"
),
mth=config.get("mth"),
flirt=config.get("flirt"),
samples=lambda wildcards: get_samples_for_date(wildcards.date),
mode=config["mode"],
log:
Expand All @@ -178,6 +179,7 @@ use rule overview_table_patient_csv as overview_table_environment_csv with:
qc_data="results/{date}/tables/environment-overview.csv",
params:
mth=config.get("mth"),
flirt=config.get("flirt"),
samples=lambda wildcards: get_samples_for_date(wildcards.date),
mode=config["mode"],
log:
Expand Down Expand Up @@ -371,6 +373,7 @@ rule snakemake_reports_patient:
expand_samples_for_date(
["results/{{date}}/lineage-variant-report/{sample}.lineage-variants"]
),
# lambda wildcards: "results/{date}/lineage-variant-report/all",
lambda wildcards: expand(
"results/{{date}}/vcf-report/{target}.{filter}.{annotation}",
target=get_samples_for_date(wildcards.date) + ["all"],
Expand All @@ -380,10 +383,10 @@ rule snakemake_reports_patient:
# 3. Sequencing Details
"results/{date}/qc/laboratory/multiqc.html",
"results/{date}/plots/coverage-reference-genome.png",
"results/{date}/plots/coverage-assembled-genome.png",
lambda wildcards: "results/{date}/plots/primer-clipping-intervals.svg"
if any_sample_is_amplicon(wildcards)
else [],
# "results/{date}/plots/coverage-assembled-genome.png",
# lambda wildcards: "results/{date}/plots/primer-clipping-intervals.svg"
# if any_sample_is_amplicon(wildcards)
# else [],
# 4. Assembly
"results/{date}/filter-overview",
"results/{date}/pangolin-call-overview",
Expand All @@ -406,8 +409,6 @@ rule snakemake_reports_patient:
"results/patient-reports/{date}.zip",
params:
for_testing=get_if_testing("--snakefile ../workflow/Snakefile"),
conda:
"../envs/snakemake.yaml"
log:
"logs/snakemake_reports/{date}.log",
shell:
Expand All @@ -423,10 +424,10 @@ use rule snakemake_reports_patient as snakemake_reports_environment with:
"results/{{date}}/{execution_mode}/overview/",
execution_mode=get_checked_mode(),
),
"results/{date}/plots/all.major-strain.strains.kallisto.svg",
expand_samples_for_date(
["results/{{date}}/plots/strain-calls/{sample}.strains.kallisto.svg"]
),
# "results/{date}/plots/all.major-strain.strains.kallisto.svg",
# expand_samples_for_date(
# ["results/{{date}}/plots/strain-calls/{sample}.strains.kallisto.svg"]
# ),
# 2. Variant Call Details
expand_samples_for_date(
["results/{{date}}/lineage-variant-report/{sample}.lineage-variants"]
Expand All @@ -444,3 +445,8 @@ use rule snakemake_reports_patient as snakemake_reports_environment with:
"results/environment-reports/{date}.zip",
log:
"logs/snakemake_reports/{date}.log",


# rule output_sample_sheet:
# input:
# Path(pep.config_file()).parent / pep.config()["sample_table"],
4 changes: 4 additions & 0 deletions workflow/schemas/config.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ properties:
description: flag for using gisaid or genbank
lineage-references:
type: object
flirt:
type: object
description: mutations to be highlighted (protein name -> variants)
mth:
type: object
description: mutations to be highlighted (protein name -> variants)
Expand All @@ -130,4 +133,5 @@ required:
- assembly
- variant-calling
- strain-calling
- flirt
- mth
6 changes: 5 additions & 1 deletion workflow/scripts/generate-overview-table.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def register_contig_lengths(assemblies, name):
}

for sample, file in iter_with_samples(snakemake.input.bcf):
flirt_mutations = {}
mutations_of_interest = {}
other_mutations = {}

Expand Down Expand Up @@ -228,11 +229,14 @@ def fmt_variants(variants):

hgvsp = f"{feature}:{alteration}"
entry = (hgvsp, f"{vaf:.3f}")
if alteration in snakemake.params.mth.get(feature, {}):
if alteration in snakemake.params.flirt.get(feature, {}):
insert_entry(flirt_mutations, hgvsp, vaf)
elif alteration in snakemake.params.mth.get(feature, {}):
insert_entry(mutations_of_interest, hgvsp, vaf)
else:
insert_entry(other_mutations, hgvsp, vaf)

data.loc[sample, "FLiRT Mutations"] = fmt_variants(flirt_mutations)
data.loc[sample, "VOC Mutations"] = fmt_variants(mutations_of_interest)
data.loc[sample, "Other Mutations"] = fmt_variants(other_mutations)

Expand Down

0 comments on commit f77d42e

Please sign in to comment.