Skip to content

Commit

Permalink
Merge pull request #91 from jts/fix_ref_fasta_index
Browse files Browse the repository at this point in the history
Add reference indexing, support different primer name prefixes
  • Loading branch information
rdeborja authored Jul 7, 2021
2 parents cba6bdb + 492bdf2 commit 9d16a4f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
20 changes: 16 additions & 4 deletions workflow/rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,31 @@ 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:
primers=get_primer_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
Expand Down
4 changes: 4 additions & 0 deletions workflow/rules/defaults.smk
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 9d16a4f

Please sign in to comment.