Skip to content

Commit 2810abe

Browse files
feat(mask): allow empty mask file, warn not error
This commit adds a warning message when encountering an empty mask file. Now, instead of throwing an error, a warning is printed with the name of the empty mask file. Reason: When stubbing out a build, one may want to add an empty mask file to future proof the repo even if that list of sites is empty Also: When one just has one masked site, removes it from the file, one generally doesn't want the workflow to error Config file changes, e.g. removing mask sites, shouldn't cause workflows to error. This is arguably a bug.
1 parent 1e5f588 commit 2810abe

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
### Features
66

77
* mask: Add `--mask-gaps` option to `augur mask` to allow masking of gaps at terminals via `--mask-gaps terminals` or all gaps via `--mask-gaps all`. [#1286][] (@corneliusroemer)
8+
* mask: Warn on empty mask file instead of error. Introduced to allow empty stub files when setting up builds and to prevent necessary workflow changes when all mask sites are removed. [#1287][] (@corneliusroemer)
89

910
### Bug fixes
1011

1112
* distance: Improve documentation by describing how gaps get treated as indels and how users can ignore specific characters in distance calculations. [#1285][] (@huddlej)
1213

1314
[#1285]: https://github.com/nextstrain/augur/pull/1285
1415
[#1286]: https://github.com/nextstrain/augur/pull/1286
16+
[#1287]: https://github.com/nextstrain/augur/pull/1286
1517

1618
## 22.3.0 (14 August 2023)
1719

Diff for: augur/mask.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ def run(args):
231231
print("ERROR: File {} does not exist!".format(args.mask_file))
232232
sys.exit(1)
233233
if os.path.getsize(args.mask_file) == 0:
234-
print("ERROR: {} is an empty file.".format(args.mask_file))
235-
sys.exit(1)
234+
print(f"WARN: The mask file {args.mask_file} is an empty file.")
236235
if not any((args.mask_file, args.mask_gaps, args.mask_from_beginning, args.mask_from_end, args.mask_sites, args.mask_invalid)):
237236
print("No masking sites provided. Must include one of --mask, --mask-gaps, --mask-from-beginning, --mask-from-end, --mask-invalid, or --mask-sites")
238237
sys.exit(1)

0 commit comments

Comments
 (0)