newick 0.6.0
pip install newick==0.6.0
Newer version available (1.10.0)
Released:
A python module to read and write the Newick format
Navigation
Verified details
These details have been verified by PyPIMaintainers
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (Apache 2)
- Author: The Glottobank consortium
Classifiers
- Development Status
- Intended Audience
- License
- Natural Language
- Programming Language
Project description
# python-newick
[](https://travis-ci.org/glottobank/python-newick)
[](https://codecov.io/github/glottobank/python-newick?branch=master)
python package to read and write the
[Newick format](https://en.wikipedia.org/wiki/Newick_format).
## Reading Newick
- From a string:
```python
>>> from newick import loads
>>> trees = loads('(A,B,(C,D)E)F;')
>>> trees[0].name
u'F'
>>> [n.name for n in trees[0].descendants]
[u'A', u'B', u'E']
```
- From a `file`-like object:
```python
>>> import io
>>> from newick import load
>>> with io.open('fname', encoding='utf8') as fp:
... trees = load(fp)
```
- From a file name:
```python
>>> from newick import read
>>> trees = read('fname')
```
## Writing Newick
In parallel to the read operations there are three functions to serialize a single `Node` object or a `list` of `Node`
objects to Newick format:
- `dumps(trees) -> str`
- `dump(trees, fp)`
- `write(trees, 'fname')`
A tree may be assembled using the factory methods of the `Node` class:
- `Node.__init__`
- `Node.create`
- `Node.add_descendant`
[](https://travis-ci.org/glottobank/python-newick)
[](https://codecov.io/github/glottobank/python-newick?branch=master)
python package to read and write the
[Newick format](https://en.wikipedia.org/wiki/Newick_format).
## Reading Newick
- From a string:
```python
>>> from newick import loads
>>> trees = loads('(A,B,(C,D)E)F;')
>>> trees[0].name
u'F'
>>> [n.name for n in trees[0].descendants]
[u'A', u'B', u'E']
```
- From a `file`-like object:
```python
>>> import io
>>> from newick import load
>>> with io.open('fname', encoding='utf8') as fp:
... trees = load(fp)
```
- From a file name:
```python
>>> from newick import read
>>> trees = read('fname')
```
## Writing Newick
In parallel to the read operations there are three functions to serialize a single `Node` object or a `list` of `Node`
objects to Newick format:
- `dumps(trees) -> str`
- `dump(trees, fp)`
- `write(trees, 'fname')`
A tree may be assembled using the factory methods of the `Node` class:
- `Node.__init__`
- `Node.create`
- `Node.add_descendant`
Project details
Verified details
These details have been verified by PyPIMaintainers
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (Apache 2)
- Author: The Glottobank consortium
Classifiers
- Development Status
- Intended Audience
- License
- Natural Language
- Programming Language
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file newick-0.6.0.tar.gz
.
File metadata
- Download URL: newick-0.6.0.tar.gz
- Upload date:
- Size: 265.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfbf232cd48f682cb75bf85acfce1a2d6c6153ca36a0876cd9896c907a9430cf |
|
MD5 | 6a0b5c403d96583db25b7c305c97d5b4 |
|
BLAKE2b-256 | e477edfe4e7ce25cd335e6d4004d72f4adba0cc1867b958fc9c7bd4031c7f020 |