# `physquirrel`
`physquirrel` is a Python package for phylogenetic network analysis, with a focus on reconstructing semi-directed phylogenetic level-1 networks from quarnets and/or sequence alignments. The package provides tools to build and visualize phylogenetic networks, leveraging the **Squirrel** algorithm for efficient network reconstruction.
## List of important features
- **$\delta$-heuristic** to construct quarnets (4-leaf subnetworks) from a multiple sequence alignment (in `.fasta` or `.nexus` format)
- **Squirrel** algorithm to construct semi-directed phylogenetic level-1 networks from quarnets
- Visualization of networks
- Exporting phylogenetic trees and networks in `eNewick` format
- Methods to extract information from a network (e.g. its set of splits, its displayed quarnets)
## Installation
If you have an up-to-date version of [Python](https://www.python.org/downloads/) installed on your device, the standard package manager `pip` should come pre-installed. Then, you can install `physquirrel` from [PyPI](https://pypi.org/) by simply using the following command in a terminal:
`python -m pip install physquirrel`
## Example usage
### Importing the package
To get started with `physquirrel`, open a Python shell and import the package with:
```
import physquirrel as psq
```
### Creating a set of quarnets
Use the $\delta$-heuristic to create a dense set of tf-quarnets from a multiple sequence alignment as follows:
```
msa = psq.MSA('path/to/msa/file.fasta')
Q = msa.delta_heuristic()
```
Alternatively, the dense set of tf-quarnets can also be loaded directly from a `.txt` file as follows:
```
Q = psq.DenseQuarnetSet('path/to/quarnet/file.txt')
```
This method assumes that the `.txt` file contains one line per tf-quarnet. The quarnets need to be one of the following two types:
1. `SQ: a b c d` for a quarnet on leaves $\{a,b,c,d\}$ with a split $ab|cd$.
2. `4C: a b c d` for a quarnet on leaves $\{a,b,c,d\}$ with a four-cycle $a,b,c,d$ and the leaf $a$ below the reticulation.
### Reconstructing a network
To create a network from the dense set of tf-quarnets, run the Squirrel algorithm:
```
N = Q.squirrel()
```
To view the network and print its `eNewick` string (with an arbitrary rooting), run:
```
N.visualize()
eNewick = N.create_enewick()
print(eNewick)
```
For a complete overview of different methods and extra parameter options, please check the method descriptions in the [source code](https://github.com/nholtgrefe/squirrel/tree/main/physquirrel/src/physquirrel) of `physquirrel`.
## Citation
If you use `physquirrel`, please cite the corresponding paper:
*Squirrel: Reconstructing semi-directed phylogenetic level-1 networks from four-leaved networks and sequence alignments* by Niels Holtgrefe, Katharina T. Huber, Leo van Iersel, Mark Jones, Samuel Martin, and Vincent Moulton.
Raw data
{
"_id": null,
"home_page": "https://github.com/nholtgrefe/squirrel/tree/main/physquirrel",
"name": "physquirrel",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "N. Holtgrefe",
"author_email": "\"N. Holtgrefe\" <n.a.l.holtgrefe@tudelft.nl>",
"download_url": "https://files.pythonhosted.org/packages/f7/6d/85c458c9da072e71168aa175518abbbcdb31468bd24ff5558c2e3a78e9c5/physquirrel-1.0.1.tar.gz",
"platform": null,
"description": "# `physquirrel`\n`physquirrel` is a Python package for phylogenetic network analysis, with a focus on reconstructing semi-directed phylogenetic level-1 networks from quarnets and/or sequence alignments. The package provides tools to build and visualize phylogenetic networks, leveraging the **Squirrel** algorithm for efficient network reconstruction.\n\n\n## List of important features\n- **$\\delta$-heuristic** to construct quarnets (4-leaf subnetworks) from a multiple sequence alignment (in `.fasta` or `.nexus` format)\n- **Squirrel** algorithm to construct semi-directed phylogenetic level-1 networks from quarnets\n- Visualization of networks\n- Exporting phylogenetic trees and networks in `eNewick` format\n- Methods to extract information from a network (e.g. its set of splits, its displayed quarnets)\n\n## Installation\nIf you have an up-to-date version of [Python](https://www.python.org/downloads/) installed on your device, the standard package manager `pip` should come pre-installed. Then, you can install `physquirrel` from [PyPI](https://pypi.org/) by simply using the following command in a terminal:\n\n`python -m pip install physquirrel`\n\n \n## Example usage\n\n### Importing the package\nTo get started with `physquirrel`, open a Python shell and import the package with:\n\n```\nimport physquirrel as psq\n```\n\n### Creating a set of quarnets\nUse the $\\delta$-heuristic to create a dense set of tf-quarnets from a multiple sequence alignment as follows:\n```\nmsa = psq.MSA('path/to/msa/file.fasta')\nQ = msa.delta_heuristic()\n```\n\nAlternatively, the dense set of tf-quarnets can also be loaded directly from a `.txt` file as follows:\n```\nQ = psq.DenseQuarnetSet('path/to/quarnet/file.txt')\n```\nThis method assumes that the `.txt` file contains one line per tf-quarnet. The quarnets need to be one of the following two types:\n1. `SQ: a b c d` for a quarnet on leaves $\\{a,b,c,d\\}$ with a split $ab|cd$.\n2. `4C: a b c d` for a quarnet on leaves $\\{a,b,c,d\\}$ with a four-cycle $a,b,c,d$ and the leaf $a$ below the reticulation.\n\n\n### Reconstructing a network\nTo create a network from the dense set of tf-quarnets, run the Squirrel algorithm:\n```\nN = Q.squirrel()\n```\nTo view the network and print its `eNewick` string (with an arbitrary rooting), run:\n```\nN.visualize()\neNewick = N.create_enewick()\nprint(eNewick)\n```\n \nFor a complete overview of different methods and extra parameter options, please check the method descriptions in the [source code](https://github.com/nholtgrefe/squirrel/tree/main/physquirrel/src/physquirrel) of `physquirrel`.\n\n\n## Citation\nIf you use `physquirrel`, please cite the corresponding paper:\n\n*Squirrel: Reconstructing semi-directed phylogenetic level-1 networks from four-leaved networks and sequence alignments* by Niels Holtgrefe, Katharina T. Huber, Leo van Iersel, Mark Jones, Samuel Martin, and Vincent Moulton.\n",
"bugtrack_url": null,
"license": null,
"summary": "package for reconstructing semi-directed phylogenetic level-1 networks from four-leaved networks and sequence alignments",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/nholtgrefe/squirrel/tree/main/physquirrel"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5001e0dac1fa7911f4aa3799872b2735b3b76ad3928fd95ee41757c3087a2933",
"md5": "b14d4a4c772dec28c0e7334264912146",
"sha256": "b2788a49a3585915b450182c72d4dfa62b7f68677f8be0064c0de17f1e20c285"
},
"downloads": -1,
"filename": "physquirrel-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b14d4a4c772dec28c0e7334264912146",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 43077,
"upload_time": "2024-10-26T18:07:24",
"upload_time_iso_8601": "2024-10-26T18:07:24.679396Z",
"url": "https://files.pythonhosted.org/packages/50/01/e0dac1fa7911f4aa3799872b2735b3b76ad3928fd95ee41757c3087a2933/physquirrel-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f76d85c458c9da072e71168aa175518abbbcdb31468bd24ff5558c2e3a78e9c5",
"md5": "cb0b6e36ed83b38e5d89e2df013e3766",
"sha256": "db75e7eb1cddbd7d973965085e7ffc0a087b5412f59291318f6874c69fb15fec"
},
"downloads": -1,
"filename": "physquirrel-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "cb0b6e36ed83b38e5d89e2df013e3766",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 38860,
"upload_time": "2024-10-26T18:07:26",
"upload_time_iso_8601": "2024-10-26T18:07:26.209730Z",
"url": "https://files.pythonhosted.org/packages/f7/6d/85c458c9da072e71168aa175518abbbcdb31468bd24ff5558c2e3a78e9c5/physquirrel-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-26 18:07:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nholtgrefe",
"github_project": "squirrel",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "physquirrel"
}