From 02cfaee362d6ddb161156a8c9d1f993890e40f3e Mon Sep 17 00:00:00 2001 From: Richard de Borja Date: Wed, 7 Jul 2021 09:58:22 -0400 Subject: [PATCH 1/2] added primer_prefix to config to support updated V4 primer scheme, handles indexing the reference genome if not indexed --- workflow/rules/common.smk | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/workflow/rules/common.smk b/workflow/rules/common.smk index 6c2a49f..e0f3810 100644 --- a/workflow/rules/common.smk +++ b/workflow/rules/common.smk @@ -245,9 +245,10 @@ rule make_amplicon_bed: params: script="primers_to_amplicons.py", offset=get_primer_offset, - bed_type_opt=get_primer_bed_type_opt + bed_type_opt=get_primer_bed_type_opt, + primer_prefix=get_primer_prefix shell: - "{params.script} --primers {input.primers} --offset {params.offset} --bed_type {params.bed_type_opt} --output {output}" + "{params.script} --primers {input.primers} --offset {params.offset} --bed_type {params.bed_type_opt} --output {output} --primer_prefix {params.primer_prefix}" rule make_amplicon_full_bed: input: @@ -255,9 +256,20 @@ rule make_amplicon_full_bed: output: "bed/amplicon_full.bed" params: - script="primers_to_amplicons.py" + script="primers_to_amplicons.py", + primer_prefix=get_primer_prefix + shell: + "{params.script} --primers {input.primers} --bed_type full --output {output} --primer_prefix {params.primer_prefix}" + +rule index_reference_genome: + input: + get_reference_genome + output: + expand(config["reference_genome"] + ".fai") + params: + exec="samtools faidx" shell: - "{params.script} --primers {input.primers} --bed_type full --output {output}" + "{params.exec} {input}" # make a bed file for the entire reference genome as a single record # from: https://bioinformatics.stackexchange.com/questions/91/how-to-convert-fasta-to-bed From 492bdf270860231b41250d31a92c7a5f4571e28a Mon Sep 17 00:00:00 2001 From: Richard de Borja Date: Wed, 7 Jul 2021 09:59:13 -0400 Subject: [PATCH 2/2] added function to retrieve the primer_prefix from the config file, if no parameter found use a default --- workflow/rules/defaults.smk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/workflow/rules/defaults.smk b/workflow/rules/defaults.smk index f335aa4..2a3b7de 100644 --- a/workflow/rules/defaults.smk +++ b/workflow/rules/defaults.smk @@ -42,6 +42,10 @@ def get_primer_offset(wildcards): def get_primer_bed_type_opt(wildcards): return config.get("bed_type", "unique_amplicons") +# get the primer name prefix from the config.yaml file +def get_primer_prefix(wildcards): + return config.get("primer_prefix", "nCoV-2019") + def get_snp_tree_flag(wildcards=None): return config.get("build_snp_tree", True)