phyloModels#
Python-based library with utilities for modeling and calibration, with emphasis on exploiting phylogenetic data.
Documentation#
Documentation is available at https://docs.idmod.org/projects/phylomodels/en/latest/.
Files#
phyloModels contains the following folders:
- calibration
Algorithms and tools for model calibration.
- docs
Documentation and notes.
- examples
Battery of examples and use-cases of modules.
- features
Summary statistics for structured (e.g., time series) and unstructured (e.g., trees, graphs) data.
- models
Algorithms and tools for disease transmission models.
- network
Algorithms and utilities for generation and manipulation of graphs/trees/networks.
- sampling
Algorithms and utilities for sampling model generated data.
- test
Main programs that test the library and demonstrate its performance.
- utilities
Miscellaneous functions (read/write from/to files, data conversions, etc.)
- visualization
Functions and utilities for visualization.
Data structures#
Structured data is represented using Pandas dataframes. Phylogenetic trees are represented using ETE3 tree objects.
Installation#
Download the library:
git clone https://github.com/InstituteforDiseaseModeling/phyloModels
Install dependencies.
Packages not on PyPI will not be installed by setuptools in step 3 below. Hence, they should be installed separately. These packages include CUDA and History Matching (at this time, CUDA and History Matching are required only for the calibration module; functions in other modules can run without these libraries).
We recommend using a virtual environment. You can configure a virtual environment using the Conda definition file that is included in this package, or you can create a virtual environment with the required dependencies from scratch. Follow one of the steps below:
Create and configure virtual environment using an environment definition file.
A Conda environment definition file is provided with this package. This file, called phylomodels_env.yml, includes definitions of all requirements, even packages not on PyPI. To use it for installing dependencies, edit the first line to set the name of the environment, and then execute the following commands for installing and activating a conda environment that satisfies all required dependencies:
conda env create -f phylomodels_env.yml conda activate [environment name]`
Note
In some systems, the environment activation command is
source activate [environment name]
instead ofconda activate [environment name]
.Create and configure virtual environment using Conda.
Other than CUDA libraries, which are only used for the calibration module, most of the dependencies can be installed during the installation step (see item 3 below). However, there is an exception with some of the dependencies of the ETE3 library, which is used for representing tree data structures. These dependencies and their required versions can be installed as follows:
conda create --name [environment name] python==3.7 conda activate [environment name] pip install PyQt5==5.11.3
Create and configure virtual environment using
venv
.The process is similar to creating a Conda virtual environment:
python3 -m venv [environment name] source [environment name]/bin/activate pip install PyQt5==5.11.3
Install the package:
python3 setup.py develop
Note
Alternatively, you could run
python3 setup.py install
if you plan on using the package as is, without making any changes to the code.Register environment as jupyter kernel (optional).
You may need to manually add the new environment as a jupyter kernel. With the conda environment activated, this can be done as follows:
python -m ipykernel install --user --name [environment name] --display-name "Python ([environment name])"
Requirements/Dependencies#
See dependencies in setup.py and phylomodels_env.yml.
Examples#
Computing summary statistics on phylogenetic trees: phylomodels/examples/features_computeTreeFeatures/features_computeTreeFeatures.ipynb
Model calibration using History Matching: phylomodels/examples/calibration_historyMatching_featureSelectionForSIR/calibration_historyMatching_featureSelectionForSIR.ipynb
- Models
- Features
- Calibration
- Test
- Examples
- API reference
- phylomodels package
- Subpackages
- phylomodels.calibration package
- phylomodels.examples package
- phylomodels.features package
- Subpackages
- phylomodels.features.series package
- Submodules
- phylomodels.features.series.series module
- phylomodels.features.series.series_derivative module
- phylomodels.features.series.series_derivative2 module
- phylomodels.features.series.series_derivative2_cauchyFit module
- phylomodels.features.series.series_derivative2_gaussianFit module
- phylomodels.features.series.series_derivative2_laplaceFit module
- phylomodels.features.series.series_derivative_cauchyFit module
- phylomodels.features.series.series_derivative_gaussianFit module
- phylomodels.features.series.series_derivative_laplaceFit module
- phylomodels.features.series.series_diff module
- phylomodels.features.series.series_diff_L1 module
- phylomodels.features.series.series_diff_L2 module
- phylomodels.features.series.series_diff_Linf module
- phylomodels.features.series.series_log10 module
- phylomodels.features.series.series_partialSum10 module
- phylomodels.features.series.series_partialSum15 module
- phylomodels.features.series.series_partialSum2 module
- phylomodels.features.series.series_partialSum30 module
- phylomodels.features.series.series_partialSum7 module
- phylomodels.features.series.series_sum module
- phylomodels.features.series.series_sum_log10 module
- Submodules
- phylomodels.features.statistics package
- Submodules
- phylomodels.features.statistics.fano module
- phylomodels.features.statistics.mean module
- phylomodels.features.statistics.qcd module
- phylomodels.features.statistics.rsd module
- phylomodels.features.statistics.skew module
- phylomodels.features.statistics.std module
- phylomodels.features.statistics.var module
- Submodules
- phylomodels.features.trees package
- Subpackages
- phylomodels.features.trees.helper package
- Submodules
- phylomodels.features.trees.helper.calculate_branch_length_metrics module
- phylomodels.features.trees.helper.check_values module
- phylomodels.features.trees.helper.get_LTT module
- phylomodels.features.trees.helper.get_adjacency_mat module
- phylomodels.features.trees.helper.get_distance_mat module
- phylomodels.features.trees.helper.get_eigenvalues_adj module
- phylomodels.features.trees.helper.get_eigenvalues_dist_lap module
- phylomodels.features.trees.helper.get_eigenvalues_lap module
- phylomodels.features.trees.helper.get_groups module
- phylomodels.features.trees.helper.get_node_properties module
- phylomodels.features.trees.helper.process_optional_arguements module
- phylomodels.features.trees.helper.unique_node_attr module
- Submodules
- phylomodels.features.trees.helper package
- Submodules
- phylomodels.features.trees.BL_calculate_external_max module
- phylomodels.features.trees.BL_calculate_external_mean module
- phylomodels.features.trees.BL_calculate_external_median module
- phylomodels.features.trees.BL_calculate_external_min module
- phylomodels.features.trees.BL_calculate_external_std module
- phylomodels.features.trees.BL_calculate_internal_max module
- phylomodels.features.trees.BL_calculate_internal_mean module
- phylomodels.features.trees.BL_calculate_internal_median module
- phylomodels.features.trees.BL_calculate_internal_min module
- phylomodels.features.trees.BL_calculate_internal_std module
- phylomodels.features.trees.BL_calculate_max module
- phylomodels.features.trees.BL_calculate_mean module
- phylomodels.features.trees.BL_calculate_median module
- phylomodels.features.trees.BL_calculate_min module
- phylomodels.features.trees.BL_calculate_ratio_max module
- phylomodels.features.trees.BL_calculate_ratio_mean module
- phylomodels.features.trees.BL_calculate_ratio_median module
- phylomodels.features.trees.BL_calculate_ratio_min module
- phylomodels.features.trees.BL_calculate_ratio_std module
- phylomodels.features.trees.BL_calculate_std module
- phylomodels.features.trees.LTT_calculate_max_lineages module
- phylomodels.features.trees.LTT_calculate_mean_b_time module
- phylomodels.features.trees.LTT_calculate_mean_s_time module
- phylomodels.features.trees.LTT_calculate_slope_1 module
- phylomodels.features.trees.LTT_calculate_slope_2 module
- phylomodels.features.trees.LTT_calculate_slope_ratio module
- phylomodels.features.trees.LTT_calculate_t_max_lineages module
- phylomodels.features.trees.calculate_external_branch_length_metrics module
- phylomodels.features.trees.group_calculate_max module
- phylomodels.features.trees.group_calculate_mean module
- phylomodels.features.trees.group_calculate_median module
- phylomodels.features.trees.group_calculate_min module
- phylomodels.features.trees.group_calculate_mode module
- phylomodels.features.trees.group_calculate_num module
- phylomodels.features.trees.group_calculate_std module
- phylomodels.features.trees.local_calculate_LBI_mean module
- phylomodels.features.trees.local_calculate_frac_basal module
- phylomodels.features.trees.mean_NN_distance module
- phylomodels.features.trees.netSci_calculate_betweenness_max module
- phylomodels.features.trees.netSci_calculate_closeness_max module
- phylomodels.features.trees.netSci_calculate_diameter module
- phylomodels.features.trees.netSci_calculate_eigen_centrality_max module
- phylomodels.features.trees.netSci_calculate_mean_path module
- phylomodels.features.trees.smallConfig_calculate_cherries module
- phylomodels.features.trees.smallConfig_calculate_double_cherries module
- phylomodels.features.trees.smallConfig_calculate_fourprong module
- phylomodels.features.trees.smallConfig_calculate_pitchforks module
- phylomodels.features.trees.spectral_calculate_eigen_gap module
- phylomodels.features.trees.spectral_calculate_kurtosis module
- phylomodels.features.trees.spectral_calculate_max_adj_eigen module
- phylomodels.features.trees.spectral_calculate_max_distLap_eigen module
- phylomodels.features.trees.spectral_calculate_max_lap_eigen module
- phylomodels.features.trees.spectral_calculate_min_adj_eigen module
- phylomodels.features.trees.spectral_calculate_min_lap_eigen module
- phylomodels.features.trees.spectral_calculate_skewness module
- phylomodels.features.trees.top_calculate_B1 module
- phylomodels.features.trees.top_calculate_B2 module
- phylomodels.features.trees.top_calculate_FurnasR module
- phylomodels.features.trees.top_calculate_WD_ratio module
- phylomodels.features.trees.top_calculate_colless module
- phylomodels.features.trees.top_calculate_frac_imbalance module
- phylomodels.features.trees.top_calculate_frac_ladder module
- phylomodels.features.trees.top_calculate_max_dW module
- phylomodels.features.trees.top_calculate_max_ladder module
- phylomodels.features.trees.top_calculate_mean_imbalance_ratio module
- phylomodels.features.trees.top_calculate_sackin module
- phylomodels.features.trees.top_calculate_sackin_var module
- phylomodels.features.trees.tree_height_calculate_max module
- phylomodels.features.trees.tree_height_calculate_mean module
- phylomodels.features.trees.tree_height_calculate_min module
- Subpackages
- phylomodels.features.series package
- Submodules
- Subpackages
- phylomodels.models package
- Subpackages
- Submodules
- phylomodels.models.distributions_gaussian module
- phylomodels.models.seir_taoLeap_getIncidenceSampled module
- phylomodels.models.sir_taoLeap_getIncidence module
- phylomodels.models.sir_taoLeap_getIncidenceSampled module
- phylomodels.models.test_distributions_gaussian module
- phylomodels.models.test_sir_taoLeap_getIncidence module
- phylomodels.models.test_sir_taoLeap_getIncidenceSampled module
- phylomodels.network package
- phylomodels.sampling package
- phylomodels.utilities package
- phylomodels.visualization package
- Subpackages
- phylomodels package
- To do