Skip to main content

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

Project description

permucn

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 @ git+https://github.com/mkrg01/permucn.git"

If published on PyPI:

pip install permucn

Optional plot support:

pip install "permucn[plots] @ git+https://github.com/mkrg01/permucn.git"

Quick Start

  1. Fetch sample data (works after pip install):
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.0.tar.gz (40.9 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.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: permucn-0.1.0.tar.gz
  • Upload date:
  • Size: 40.9 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.0.tar.gz
Algorithm Hash digest
SHA256 789a4560f91f6efd935d95b0093aa58dba0d5146cb7abd9b5344a06f9ef537f0
MD5 1e2896f351b5546de46a50d378514576
BLAKE2b-256 c688a9a7fd5d0ff6f4b154f1af2f45764465abc8f9d7ffeb56934f8afa134f26

See more details on using hashes here.

Provenance

The following attestation bundles were made for permucn-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: permucn-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 35.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80c5824ab95d4f60631fc236fb9d488d612ab95292a979b8f6c18c94c8e36749
MD5 f3108f90d0e24c2f63fe77fb7ef104ed
BLAKE2b-256 7c54b561ea1e7902736d525212d5f5c37f925eb25bc64f922c2d14023d995589

See more details on using hashes here.

Provenance

The following attestation bundles were made for permucn-0.1.0-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