Skip to content

Commit 38f39e4

Browse files
authored
Merge pull request #80 from fmaguire/add_configurable_outputdir
Add configurable optional output directory
2 parents fe4d7db + 8d46317 commit 38f39e4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ completeness_threshold: 0.9
139139
# or the path to a local VCF file.
140140
# Built in lists: https://github.com/jts/ncov-watch/tree/master/ncov_watch/watchlists
141141
mutation_set: spike_mutations
142+
143+
# user specifiable output directory
144+
# defaults to just current working directory but otherwise
145+
# will write output files to the specified directory
146+
output_directory: run1_output
142147
```
143148

144149
## Running

workflow/rules/common.smk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
#
22
# Helper functions and rules
33
#
4+
from pathlib import Path
5+
46
include: "defaults.smk"
57

68
configfile: "config.yaml"
79

10+
# to handle custom output directories make input paths in config absolute
11+
# paths then assign snakemake workdir to the specified config workdir
12+
# as data_root is built into the remaining input paths
13+
if 'output_directory' in config:
14+
for input_path_config in ['data_root', 'primer_bed', 'reference_genome', 'tree_include_consensus']:
15+
if input_path_config in config:
16+
config[input_path_config] = str(Path(config[input_path_config]).absolute())
17+
workdir: config['output_directory']
18+
19+
820
def get_sample_names():
921

1022
# if defined in the config, use that

0 commit comments

Comments
 (0)