Skip to main content

SimPhyni: a tool for phylogenetic trait simulation and inference.

Project description

SimPhyNI

Overview

SimPhyNI (Simulation-based Phylogenetic iNteraction Inference) is a phylogenetically-aware framework for detecting evolutionary associations between binary traits (e.g., gene presence/absence, major/minor alleles, binary phenotypes) on microbial phylogenetic trees. This tool leverages phylogenetic infromation to correct for spurious associations caused by the relatedness of sister taxa.

This pipeline is designed to:

  • Infer evolutionary parameters for traits (gain/loss rates, time to emergence, ancestral states)
  • Estimate trait co-occurence null models through independent simulation of traits
  • Output statistical results for associations

Getting Started

Installation

First create a new environment:

conda create -n simphyni python=3.11 numba llvmlite
conda activate simphyni

then install using using PyPI

pip install simphyni

test installation:

simphyni version

Usage

Run mode (single-run)

simphyni run \
  --sample-name my_sample \
  --tree path/to/tree.nwk \
  --traits path/to/traits.csv \
  --run-traits 0,1,2 \
  --outdir my_analysis \
  --cores 4 \
  --temp_dir ./tmp \
  --min_prev 0.05 \
  --max_prev 0.95 \
  --prefilter \
  --plot
  • --run-traits specifies a comma-separated list of column indices (0-indexed) in the traits CSV for “trait against all” comparisons. Use 'ALL' (default) to include all traits.

Run mode (batch)

Create a samples.csv file:

Sample,Tree,Traits,run_traits,MinPrev,MaxPrev
run1,tree1.nwk,traits1.csv,All,0.05,0.95
run2,tree2.nwk,traits2.csv,"0,1,2",0.05,0.90
  • run_traits, MinPrev, and MaxPrev are optional columns that will use default values if not provided

Then execute:

simphyni run --samples samples.csv --cores 16

Run with HPC

First, download example cluster scripts:

simphyni download-cluster-scripts

Edit cluster config file for your computing cluster then install the approprate snakemake executor from the avalible catalog: https://snakemake.github.io/snakemake-plugin-catalog/index.html (slurm shown below):

pip install snakemake-executor-plugin-slurm

run simphyni with the --profile flag:

simphyni run --samples samples.csv --profile cluster_profile

For all run options:

simphyni run --help

Example data

Download and run example inputs using:

simphyni download-examples
simphyni run --samples example_inputs/simphyni_sample_info.csv --cores 8 --prefilter --plot

Outputs

Outputs for each sample are placed in structured folders in the working directory or specified output directory in subdirectories by sample name, including:

  • simphyni_result.csv contianing all tested trait pairs with their infered interaction direction, p-value, and effect size
  • simphyni_object.pkl optional file containing the completed analysis, parsable with an active SimPhyNI evironment. Contorlled with the --save-object flag (not recommended for large analyses, > 1,000,000 comparisons)
  • heatmap summaries of tested associations if --plot is enabled

Directory Structure

SimPhyNI/
├── simphyni/               # Core package
│   ├── Simulation/         # Simulation scripts
│   ├── scripts/            # Workflow scripts
│   └── envs/simphyni.yaml  # Conda environment (used in snakemake)
├── conda-recipe/           # Build recipe 
├── cluster_scripts         # Cluster configs for SLURM
├── example_inputs 
└── pyproject.toml

Contact

For questions, please open an issue or contact Ishaq Balogun at https://github.com/jpeyemi.

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

simphyni-1.0.0.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

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

simphyni-1.0.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file simphyni-1.0.0.tar.gz.

File metadata

  • Download URL: simphyni-1.0.0.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for simphyni-1.0.0.tar.gz
Algorithm Hash digest
SHA256 750bd356eab57aec6f80d29634a25bfae2b3af49e59610a2caed7bfe2faf1ff9
MD5 e4d4d462e4d7a0a799888e4270de53ca
BLAKE2b-256 b44103f83ce97b504ead6a527ba52e8d7cc84f8b957645e368ff980bfce8e62c

See more details on using hashes here.

File details

Details for the file simphyni-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: simphyni-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for simphyni-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9788823ba93feb6308fd267ad42ea9463adefcac91f4ac30d4c838db8461e1d
MD5 1270802fdd2d3e5d2b55dd7980faef1a
BLAKE2b-256 6efcf7ab2f352f984328010c42827e6f648a79310c1c80991941932689341774

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