Skip to content

Commit 557164f

Browse files
authored
Merge pull request #151 from kayjan/v0.15.1
V0.15.1
2 parents fcc8028 + 69e5abc commit 557164f

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.15.1] - 2024-01-05
8+
### Added
9+
- Tree Constructor: `newick_to_tree` to convert Newick notation to tree.
10+
### Changed
11+
- Tree Exporter: `tree_to_newick` to accept more parameters to parse length and attributes.
12+
### Fixed
13+
- Misc: Automated doctest setup to use os operations instead of string operations.
14+
715
## [0.15.0] - 2024-01-02
816
### Added
917
- Tree Exporter: Export to Newick notation with `tree_to_newick`.
@@ -419,6 +427,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
419427
- Utility Iterator: Tree traversal methods.
420428
- Workflow To Do App: Tree use case with to-do list implementation.
421429

430+
[0.15.1]: https://github.com/kayjan/bigtree/compare/0.15.1...0.15.0
422431
[0.15.0]: https://github.com/kayjan/bigtree/compare/0.15.0...0.14.8
423432
[0.14.8]: https://github.com/kayjan/bigtree/compare/0.14.7...0.14.8
424433
[0.14.7]: https://github.com/kayjan/bigtree/compare/0.14.6...0.14.7

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ For **Tree** implementation, there are 9 main components.
3434
2. ``Node``, BaseNode with node name attribute
3535
2. [**✨ Constructing Tree**](https://bigtree.readthedocs.io/en/latest/bigtree/tree/construct.html)
3636
1. From `Node`, using parent and children constructors
37-
2. From *str*, using tree display
37+
2. From *str*, using tree display or Newick string notation
3838
3. From *list*, using paths or parent-child tuples
3939
4. From *nested dictionary*, using path-attribute key-value pairs or recursive structure
4040
5. From *pandas DataFrame*, using paths or parent-child columns
@@ -228,11 +228,11 @@ root.show(style="ascii")
228228

229229
#### 2. **From *str***
230230

231-
Construct nodes only.
231+
Construct nodes only. Newick string notation supports parsing attributes.
232232

233-
{emphasize-lines="13"}
233+
{emphasize-lines="13,25"}
234234
```python
235-
from bigtree import str_to_tree
235+
from bigtree import str_to_tree, newick_to_tree
236236

237237
tree_str = """
238238
a
@@ -254,6 +254,18 @@ root.show()
254254
# │ └── h
255255
# └── c
256256
# └── f
257+
258+
newick_str = "((d,(g,h)e)b,(f)c)a"
259+
root = newick_to_tree(newick_str)
260+
root.show()
261+
# a
262+
# ├── b
263+
# │ ├── d
264+
# │ └── e
265+
# │ ├── g
266+
# │ └── h
267+
# └── c
268+
# └── f
257269
```
258270

259271
#### 3. **From *list***

bigtree/tree/construct.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ def newick_to_tree(
998998
Variations supported
999999
- Support special characters ([, ], (, ), :, ,) in node name, attribute name, and attribute values if
10001000
they are enclosed in single quotes i.e., '(name:!)'
1001+
- If there are no node names, it will be auto-filled with convention `nodeN` with N representing a number
10011002
10021003
>>> from bigtree import newick_to_tree
10031004
>>> root = newick_to_tree("((d,e)b,c)a")

0 commit comments

Comments
 (0)