Skip to content

Commit 3dbe6b6

Browse files
committed
Add various tree utilities
1 parent 6525b21 commit 3dbe6b6

13 files changed

+510
-176
lines changed

.pre-commit-config.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
hooks:
77
- id: isort
88
- repo: [email protected]:psf/black.git
9-
rev: 23.12.1
9+
rev: 24.1.0
1010
hooks:
1111
- id: black
1212
- repo: [email protected]:pre-commit/pre-commit-hooks.git
@@ -15,6 +15,7 @@ repos:
1515
- id: check-yaml
1616
args: [--allow-multiple-documents]
1717
- id: pretty-format-json
18+
exclude: .*.ipynb
1819
- id: trailing-whitespace
1920
exclude: tests/fixtures/output/haplogroups\..*\.txt|data/variants/isogg\.[0-9]{4}\.[0-9]{2}\.[0-9]{2}\.txt
2021
- repo: [email protected]:PyCQA/flake8.git

CHANGELOG.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,29 @@
33
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
44

55

6-
## [2.1.0] - 2024-01
6+
## [2.1.4] - 2024-01-29
7+
8+
### Added
9+
- Support for querying multiple SNPs from the command line
10+
- Support for generating aligned-tip Newick representations of subtrees
11+
- Support for node lookup by SNP-based haplogroup label
12+
- `Node` methods:
13+
- `Node.iter_depth_first`
14+
- `Node.iter_breath_first`
15+
- `Node.remove_children`
16+
- `tree.get_bounded_subtree` function
17+
18+
### Changed
19+
- `Tree` constructor's `Config` parameter is now optional
20+
- `Node.is_root` and `Node.is_leaf` are now properties
21+
22+
### Fixed
23+
- Output format of `--snp_query` option
24+
25+
[2.1.4]: https://github.com/23andMe/yhaplo/compare/2.1.0...2.1.4
26+
27+
28+
## [2.1.0] - 2024-01-12
729

830
This release improves haplogroup calling by identifying and correcting various errors in
931
the ISOGG variant metadata and, internally, by pruning poorly performing v5 SNPs.

Makefile

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# Make variables
22
#----------------------------------------------------------------------
3-
BOLD_CYAN = \033[1;36m
3+
CYAN := \033[0;36m
4+
GREEN := \033[0;32m
5+
BOLD_CYAN := \033[1;36m
46
BOLD_GREEN := \033[1;32m
5-
GREEN = \033[0;32m
6-
NO_COLOR = \033[0m
7+
NO_COLOR := \033[0m
78

89

910
## General
1011
# ----------------------------------------------------------------------
1112
help: ## Print this help message
1213
@egrep -h '(\s|^)##\s' $(MAKEFILE_LIST) \
13-
| sed -E "s/^## (.*)/\n$$(printf "${BOLD_CYAN}")\1$$(printf "${NO_COLOR}")/g" \
14-
| awk 'BEGIN {FS = ":.*?## "}; {printf "${GREEN}%-25s${NO_COLOR} %s\n", $$1, $$2}'
14+
| sed -E "s/^## (.*)/\n$$(printf "${BOLD_GREEN}")\1$$(printf "${NO_COLOR}")/g" \
15+
| awk 'BEGIN {FS = ":.*?## "}; {printf "${CYAN}%-25s${NO_COLOR} %s\n", $$1, $$2}'
1516
@echo
1617

1718

pyproject.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@ ignore_missing_imports = true
6565
# D107 Missing docstring in __init__
6666
# D202 No blank lines allowed after function docstring
6767
# Ignoring allows blank lines after one-line docstrings.
68+
# D203 1 blank line required before class docstring
69+
# Conflicts with black 24.
6870
# D211 No blank lines allowed before class docstring
6971
# Contradicts D203.
7072
# D213 Multi-line docstring summary should start at the second line
7173
# Contradicts D212.
7274
# https://github.com/PyCQA/pydocstyle/issues/242#issuecomment-288166773
73-
ignore = "D107,D202,D211,D213"
75+
ignore = "D107,D202,D203,D211,D213"
7476
match_dir = "(?!tests|\\.).*"
7577

7678
[tool.pytest.ini_options]

scripts/validate_yhaplo.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ echo -e "\n${BOLD_CYAN}Removed${NO_COLOR}: ${GREEN}${output_dir}\n\n${NO_COLOR}"
3636

3737
echo -e "${BOLD_CYAN}Text Input${NO_COLOR}\n"
3838
yhaplo --example_text \
39+
--hg_genos Q \
3940
--breadth_first \
4041
--depth_first \
4142
--depth_first_table \
42-
--hg_genos Q
43+
--mrca Q J \
44+
--snp_query L1335,S730,S530,foo
4345
echo -e "\n"
4446

4547

yhaplo/api/command_line_args.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,14 @@ def get_command_line_args(set_defaults: bool = False) -> argparse.Namespace:
197197
nargs=2,
198198
dest="mrca_haplogroup_list",
199199
metavar=("haplogroup1", "haplogroup2"),
200-
help="Output mrca of two haplogroups",
200+
help="Output MRCA of two haplogroups",
201201
)
202202
group.add_argument(
203203
"-sq",
204204
"--snp_query",
205-
dest="query_snp_name",
206-
metavar="snp_name",
207-
help="List phylogenetic path for a query SNP",
205+
dest="query_snp_names",
206+
metavar="snp_names",
207+
help="List phylogenetic path for each SNP in comma-separated list",
208208
)
209209
group.add_argument(
210210
"-pt",
@@ -282,7 +282,6 @@ def get_command_line_arg_defaults() -> argparse.Namespace:
282282

283283

284284
class RawTextWithDefaultsHelpFormatter(argparse.RawDescriptionHelpFormatter):
285-
286285
"""Help message formatter that retains formatting and adds defaults.
287286
288287
Combines argparse.RawTextHelpFormatter and argparse.ArgumentDefaultsHelpFormatter.

yhaplo/config.py

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323

2424
class Config:
25-
2625
"""Yhaplo configuration class.
2726
2827
This class is a container for parameters, constants, filenames, etc.

0 commit comments

Comments
 (0)