Skip to content

Commit

Permalink
feat(mask): allow empty mask file, warn not error
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
corneliusroemer committed Aug 19, 2023
1 parent 1e5f588 commit 2810abe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
### Features

* 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)
* 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)

### Bug fixes

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

[#1285]: https://github.com/nextstrain/augur/pull/1285
[#1286]: https://github.com/nextstrain/augur/pull/1286
[#1287]: https://github.com/nextstrain/augur/pull/1286

## 22.3.0 (14 August 2023)

Expand Down
3 changes: 1 addition & 2 deletions augur/mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ def run(args):
print("ERROR: File {} does not exist!".format(args.mask_file))
sys.exit(1)
if os.path.getsize(args.mask_file) == 0:
print("ERROR: {} is an empty file.".format(args.mask_file))
sys.exit(1)
print(f"WARN: The mask file {args.mask_file} is an empty file.")
if not any((args.mask_file, args.mask_gaps, args.mask_from_beginning, args.mask_from_end, args.mask_sites, args.mask_invalid)):
print("No masking sites provided. Must include one of --mask, --mask-gaps, --mask-from-beginning, --mask-from-end, --mask-invalid, or --mask-sites")
sys.exit(1)
Expand Down

0 comments on commit 2810abe

Please sign in to comment.