Skip to main content

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)

Metadata

Release files for permucn 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for permucn 0.1.1
File Size Uploaded
permucn-0.1.1.tar.gz 41.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for permucn 0.1.1
File Interpreter ABI Platform
permucn-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 77.7 kB

Release files / permucn-0.1.1.tar.gz

Download URL permucn-0.1.1.tar.gz
Size 41.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2c0141ca5bc6b1fd32124f3aeea7caab804019dbc848834e20afad8a8faac8db
BLAKE2b-256 checksum
How to use checksums
3072d335a022577bbbc6a198f005847ffd3bbbdd0fdee770343e06df98f42b2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 9, 2026.

Transparency log

Release files / permucn-0.1.1-py3-none-any.whl

Download URL permucn-0.1.1-py3-none-any.whl
Size 36.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dde3b41030c42051c38f761dd0be86d02518e00a8debcf221deb1fa094becb3b
BLAKE2b-256 checksum
How to use checksums
55a0305149add5961ea186b3f83b73fe752ccb763f44cfbaa6e0a0192624337e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page