Skip to main content

Permutation-based test for copy-number and binary trait association

Project description

permucn

PyPI Python Tests Conda Recipe License: MIT

permucn is a command-line tool for testing whether trait transitions (0->1, optionally 1->0) are associated with gene-family copy-number evolution from CAFE outputs. In binary mode, you can choose either permutation-based testing or Fisher's exact test with Tarone screening.

Install

Requirements: Python >=3.12

pip install permucn

Optional plot support:

pip install "permucn[plots]"

Conda / Bioconda:

conda install -c conda-forge -c bioconda permucn

Quick Start

  1. Fetch sample data:
permucn get-test-data --out-dir permucn_test_data
  1. Run permucn:
permucn \
  --cafe-dir permucn_test_data/toy_example/cafe_output \
  --trait-tsv permucn_test_data/toy_example/species_trait.tsv \
  --no-include-trait-loss \
  --n-perm-initial 20 \
  --n-perm-refine 50 \
  --seed 7 \
  --out-prefix results/toy_binary
  1. Check outputs:
  • results/toy_binary.family_results.tsv
  • results/toy_binary.run_metadata.json
  • results/toy_binary.top_hits.tsv
  • results/toy_binary.top_pvalues.tsv (default: top 100 by p-value)

If at least one tested family has p-values, these are also written:

  • results/toy_binary.pvalue_hist.tsv
  • results/toy_binary.qq.tsv

For a larger sample dataset:

permucn get-test-data --dataset polar_fish --out-dir permucn_test_data
permucn \
  --cafe-dir permucn_test_data/polar_fish/cafe_output \
  --trait-tsv permucn_test_data/polar_fish/species_trait.tsv \
  --jobs 4 \
  --perm-cache results/perm_cache.json.gz \
  --out-prefix results/polar_fish

Required Inputs

--cafe-dir must include:

  • Gamma_change.tab (required)
  • Gamma_asr.tre (required)
  • Gamma_branch_probabilities.tab (required only with --cafe-significant-only)
  • Gamma_family_results.txt (optional)

--trait-tsv must be a TSV with:

  • one species column (species, taxon, name, etc.; first column fallback)
  • one binary trait column (0/1)

Important rules:

  • Species names in trait TSV must match tree tip names.
  • If multiple binary trait columns exist, specify --trait-column.
  • --cafe-significant-only is valid only in binary mode.
  • rate mode requires strictly positive non-root branch lengths.

Common Commands

Default binary mode:

permucn --cafe-dir <cafe_output_dir> --trait-tsv <trait.tsv> --out-prefix results/binary

Binary mode with CAFE-significant events only:

permucn --cafe-dir <cafe_output_dir> --trait-tsv <trait.tsv> --cafe-significant-only --out-prefix results/binary_sig

Binary mode with Fisher + Tarone:

permucn \
  --cafe-dir <cafe_output_dir> \
  --trait-tsv <trait.tsv> \
  --binary-test fisher-tarone \
  --out-prefix results/binary_fisher

Rate mode:

permucn --cafe-dir <cafe_output_dir> --trait-tsv <trait.tsv> --mode rate --out-prefix results/rate

Reproducibility and Performance

  • --seed: reproducible permutations
  • --jobs: parallelism (1 sequential, 0 auto CPU)
  • --perm-cache: reuse permutations across runs (.json / .json.gz)
  • --pvalue-top-n: size of *.top_pvalues.tsv (0 disables)

Documentation

License

MIT (LICENSE)

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

permucn-0.1.1.tar.gz (41.5 kB view details)

Uploaded Source

Built Distribution

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

permucn-0.1.1-py3-none-any.whl (36.2 kB view details)

Uploaded Python 3

File details

Details for the file permucn-0.1.1.tar.gz.

File metadata

  • Download URL: permucn-0.1.1.tar.gz
  • Upload date:
  • Size: 41.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for permucn-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2c0141ca5bc6b1fd32124f3aeea7caab804019dbc848834e20afad8a8faac8db
MD5 34b7b0878bc0417ccd76549995844050
BLAKE2b-256 3072d335a022577bbbc6a198f005847ffd3bbbdd0fdee770343e06df98f42b2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for permucn-0.1.1.tar.gz:

Publisher: publish-pypi.yml on mkrg01/permucn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file permucn-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: permucn-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 36.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for permucn-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dde3b41030c42051c38f761dd0be86d02518e00a8debcf221deb1fa094becb3b
MD5 a4fee5379b0d6b183e8925f83b95fac2
BLAKE2b-256 55a0305149add5961ea186b3f83b73fe752ccb763f44cfbaa6e0a0192624337e

See more details on using hashes here.

Provenance

The following attestation bundles were made for permucn-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on mkrg01/permucn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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