Skip to content

Commit

Permalink
add breseq parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jaleezyy committed Jun 11, 2024
1 parent a426b3c commit e6217a1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ validate(config, 'resources/config.schema.yaml')
samples = pd.read_table(config['samples'], sep=',')
validate(samples, 'resources/sample.schema.yaml')

# manual assignment of breseq reference
# manual assignment of breseq parameters
# breseq reference, minor variant thresholds
try:
if os.path.exists(config['breseq_reference']):
breseq_ref = config['breseq_reference']
Expand All @@ -54,6 +55,20 @@ try:
except TypeError:
breseq_ref = ""

if "polymorphism_variant_coverage" in config.keys():
breseq_cov = config['polymorphism_variant_coverage']
if breseq_cov == "":
breseq_cov = 2
else:
breseq_cov = 2

if "polymorphism_frequency" in config.keys():
breseq_freq = config['polymorphism_frequency']
if breseq_freq == "":
breseq_freq = 0.05
else:
breseq_freq = 0.05

# set output directory
exec_dir = os.getcwd()
workdir: os.path.abspath(config['result_dir'])
Expand Down Expand Up @@ -588,10 +603,12 @@ rule run_breseq:
"{sn}/benchmarks/{sn}_run_breseq.benchmark.tsv"
params:
ref = os.path.join(exec_dir, breseq_ref),
cov = breseq_cov,
freq = breseq_freq,
outdir = '{sn}/breseq'
shell:
"""
breseq --reference {params.ref} --num-processors {threads} --polymorphism-prediction --brief-html-output --output {params.outdir} {input} > {log} 2>&1 || touch {output}
breseq --reference {params.ref} --num-processors {threads} --polymorphism-prediction --polymorphism-minimum-variant-coverage-each-strand {params.cov} --polymorphism-frequency-cutoff {params.freq} --brief-html-output --output {params.outdir} {input} > {log} 2>&1 || touch {output}
"""

################## Based on https://github.com/jts/ncov2019-artic-nf/blob/be26baedcc6876a798a599071bb25e0973261861/modules/illumina.nf ##################
Expand Down Expand Up @@ -731,7 +748,6 @@ rule run_kraken2:

################################## Based on scripts/quast.sh ####################################


rule run_quast:
threads: 1
conda: 'conda_envs/assembly_qc.yaml'
Expand Down
4 changes: 4 additions & 0 deletions signalexe.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ def write_config_file(run_name, config_file, data_directory, opt_tasks):
run_breseq: {opt_tasks[0]}
# Used as --reference argument to 'breseq'
breseq_reference: "{data_directory}/MN908947.3.gbk"
# Used as --polymorphism-minimum-variant-coverage-each-strand, --polymorphism-frequency-cutoff arguments
# Parameters needed to determine thresholds for minor variant detection
polymorphism_variant_coverage: 2
polymorphism_frequency: 0.05
# run freebayes for variant and consensus calling (as well as ivar)
run_freebayes: {opt_tasks[1]}
Expand Down

0 comments on commit e6217a1

Please sign in to comment.