Skip to main content

GenPhylo: Generating heterogeneous data on gene trees

Authors: Marta Casanellas, Martí Cortada, Adrià Diéguez


We introduce GenPhylo, an open-source Python module for simulating genetic data along a phylogeny avoiding the restriction of continuous-time Markov processes. GenPhylo uses directly a general Markov model and therefore naturally incorporates heterogeneity across lineages.

The module has been developed in Python3 and provides an algorithm that can be incorporated in other simulation software.


Installation and requirements

Current version of GenPhylo is 1.2.1. You can install the package using pip

pip install GenPhylo

GenPhylo has several dependencies, please ensure you run

pip install -r requirements.txt

Using GenPhylo

Given a tree topology, the branch lengths and the alignment lengths, GenPhylo generates GMM parameters and the corresponding alignments, saved in separated output files. The package includes different options for generating the alignments, such as get_N_alignments(), which generates N alignments of fixed length, or get_alignments_by_lengths(), which generates alignments of different lengths.

Below we provide examples of how to use both functions.

get_N_alignments()

# Import GenPhylo package
from GenPhylo.utils.alignments_generation import *

tree = 'tree.txt'       # path of your Newick file
L = 1000                # Alignment length
N = 50                  # Number of alignments
root_distr = 'random'   # root distribution (can also be specified by the user, e.g. root_distr = [0.22, 0.24, 0.28, 0.26])
name = 'experiment1'    # output name

# Calling the function that generates the N alignments
get_N_alignments(tree, L, N, root_distr, name)

get_alignments_by_lengths()

# Import GenPhylo package
from GenPhylo.utils.alignments_generation import *

tree = 'tree.txt'               # path of your Newick file
lengths = [500, 1000, 10000]    # list of alignment lengths
root_distr = 'random'           # root distribution (can also be specified by the user, e.g. root_distr = [0.22, 0.24, 0.28, 0.26])
name = 'experiment2'            # output name

# Calling the function that generates the alignments given the lengths
get_alignments_by_lengths(tree, lengths, root_distr, name)

In each case, the outputs (a .txt file with the transition matrices and a .tar with the .FASTA files corresponding to the simulated alignments) are named using the experiment_name parameter and are saved in a directory called output_files (if the folder does not already exist, the package will automatically create it).

Additionally, the repository includes an example of the output_files directory, as well as an example of the tree.txt file for reference. This repository also includes the file IQ-TREE_analysis.pdf that describes how we verified the precision of our alignments simulator by using the phylogenetic software IQ-TREE.


CLI implementation

Within the cli_app directory of this repository, we provide a command-line interface (CLI) implementation of the GenPhylo package. This allows you to execute GenPhylo directly from the terminal without requiring package installation. For detailed instructions on how to run GenPhylo via the CLI, please refer to the README.md file located in the cli_app folder.


Contributing and Citation

If you encounter any bugs or have questions, please submit them under the Issues tab at: https://github.com/GenPhyloProject/GenPhylo/issues.

If you use our code, either for your experiments or to develop future research, please cite it:

@misc{GenPhylo,
  author       = {Cortada, Martí and Diéguez, Adrià and Casanellas, Marta},
  title        = {{GenPhylo project repository}},
  year         = {2024},
  url          = {https://github.com/GenPhyloProject/GenPhylo},
  note         = {GitHub repository}
}

License

⚙️ This software is developed under the GNU General Public License v3.

Metadata

Release files for GenPhylo 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for GenPhylo 1.2.1
File Size Uploaded
genphylo-1.2.1.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for GenPhylo 1.2.1
File Interpreter ABI Platform
GenPhylo-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.4 kB

Release files / genphylo-1.2.1.tar.gz

Download URL genphylo-1.2.1.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2d89bead8b46eec7facedcecf72047141f724f6f6355ded0e2d4271bd4e6ab18
BLAKE2b-256 checksum
How to use checksums
fdcd6aefcdfbfcf1283a64b061093bd3dcb4bc2b65b18b70cfd9471cb050de53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release files / GenPhylo-1.2.1-py3-none-any.whl

Download URL GenPhylo-1.2.1-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fbc2a03f877865dbeb8afb717f80004c936bd9e18266373835d90130cf12e75
BLAKE2b-256 checksum
How to use checksums
97242156a0463cce181990d35eb9fd9df658e7b781e71f8a630bcb6466c6ab38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.8

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page