Skip to main content

GenPhylo: An open-source Python module for simulating alignments along phylogenetic trees

Project description

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.1.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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genphylo-1.1.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

GenPhylo-1.1.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file genphylo-1.1.1.tar.gz.

File metadata

  • Download URL: genphylo-1.1.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for genphylo-1.1.1.tar.gz
Algorithm Hash digest
SHA256 166dfd1b87cc7fd1b5ed26dbe61f14e462b94a5be00749b4d6c8a13201e02f96
MD5 fc7b4ae503a4305f869d1dc7b2b7d4f6
BLAKE2b-256 52164773bbc6afce67b2d31e98fab93c715e6f998e74fbb7f7983a838848fad2

See more details on using hashes here.

File details

Details for the file GenPhylo-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: GenPhylo-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for GenPhylo-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4fd27c2216a1ed99d10555f974a5c961f614916af91a847c737f54d46ccd9473
MD5 e9b3cc847629ed22881cb8375aafdeaa
BLAKE2b-256 97f21946bbf45dec4d79c7eb6fff63f77ed9ed9f06c20ced5a4fcd7bfa69d11e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page