A native Python port of the R vegan package for community ecology.
Project description
mapu
A native Python implementation of the classic R package vegan for community ecology.
This package aims to provide ecologists and data scientists using Python with rapid, pure-Python ports of popular vegan functions, including diversity indices, distance matrices (vegdist), ordination techniques, and multivariate statistical tests.
Installation
You can install mapu using pip:
pip install mapu
Or using uv for ultra-fast dependency resolution and installation:
uv pip install mapu
Development Installation
To install from source for development using uv:
git clone https://github.com/pedropablosilvaa/mapu.git
cd mapu
uv venv
source .venv/bin/activate # On Unix/macOS
uv pip install -e ".[dev]"
Features
The library currently supports a wide array of functions mirroring R vegan:
- Diversity Analysis:
diversity(Shannon, Simpson, etc.),fisher_alpha,specnumber,renyi,tsallis, rarefaction functions (rarefy,rrarefy), and species accumulation curves. - Distance Matrices:
vegdist(Bray-Curtis, Jaccard, Euclidean, Manhattan, Gower, etc.),designdist. - Ordination: Unconstrained (PCoA/
cmdscale, PCA, NMDS/metaMDS,isomap) and Constrained (rda,cca,capscale). - Data Transformation:
decostand,wisconsin. - Statistical Tests:
adonis(PERMANOVA),anosim,mantel,mrpp,simper,betadisper. - Clustering:
spantree,cascadeKM,cophenetic.
Example Usage
import numpy as np
import pandas as pd
from mapu import vegdist, metaMDS, diversity
# Create a mock species abundance matrix (sites x species)
np.random.seed(42)
community_data = pd.DataFrame(np.random.poisson(lam=2, size=(10, 20)))
# Calculate Bray-Curtis distance
bray_dist = vegdist(community_data, method="bray")
# Perform Non-metric Multidimensional Scaling (NMDS)
nmds_result = metaMDS(community_data, distance="bray", k=2)
print("Stress:", nmds_result.stress)
# Calculate Shannon diversity
shannon_h = diversity(community_data, index="shannon")
print("Shannon Diversity:\\n", shannon_h)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mapu-0.1.0.tar.gz.
File metadata
- Download URL: mapu-0.1.0.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4827b37d5c56d31e6bb000aef3bd98061d9946eda999b864ce3e22df7127ffa
|
|
| MD5 |
f5e4590dfbba701243812ade974baefa
|
|
| BLAKE2b-256 |
dd66ffee898e0714a76b573ece6d53f81e7148b2b655daeca543ba5659f2280f
|
Provenance
The following attestation bundles were made for mapu-0.1.0.tar.gz:
Publisher:
publish.yml on pedropablosilvaa/mapu
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mapu-0.1.0.tar.gz -
Subject digest:
a4827b37d5c56d31e6bb000aef3bd98061d9946eda999b864ce3e22df7127ffa - Sigstore transparency entry: 1450510492
- Sigstore integration time:
-
Permalink:
pedropablosilvaa/mapu@19a528666e950bafc46f341f7f8218be7885f6bd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/pedropablosilvaa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@19a528666e950bafc46f341f7f8218be7885f6bd -
Trigger Event:
release
-
Statement type:
File details
Details for the file mapu-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mapu-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50c0d9660157ed44bd9bee5d02a4bf95e7d01b811ddb5958ea3ae0ae803c1bef
|
|
| MD5 |
c09bf15803a55271e3b49ec91edc4ea1
|
|
| BLAKE2b-256 |
3ab839833056563055a9944e27ba050b793b643f5884704f70442eaa91e3b42f
|
Provenance
The following attestation bundles were made for mapu-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on pedropablosilvaa/mapu
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mapu-0.1.0-py3-none-any.whl -
Subject digest:
50c0d9660157ed44bd9bee5d02a4bf95e7d01b811ddb5958ea3ae0ae803c1bef - Sigstore transparency entry: 1450510572
- Sigstore integration time:
-
Permalink:
pedropablosilvaa/mapu@19a528666e950bafc46f341f7f8218be7885f6bd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/pedropablosilvaa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@19a528666e950bafc46f341f7f8218be7885f6bd -
Trigger Event:
release
-
Statement type: