Skip to main content

Roxy

PyPI PyVersions Tests License DOI

Classical protein sequence descriptors for machine learning.

Roxy computes classical numerical descriptors from amino-acid sequences and returns tabular features as polars.DataFrame objects.

Install

pip install roxylib
# or with uv:
uv add roxylib

Quickstart

from roxy import read_fasta, DESCRIPTOR_REGISTRY

# Load sequences from FASTA
records = read_fasta("sequences.fasta")  # [(id, seq), ...]
sequences = [seq for _, seq in records]
ids = [seq_id for seq_id, _ in records]

descriptor = DESCRIPTOR_REGISTRY["aac"]()
features = descriptor.compute(sequences, ids=ids)  # polars.DataFrame

For direct Python use, descriptors are importable by family:

from roxy.descriptors.aaindex import AAIndexDescriptor
from roxy.descriptors.composition import KmerFullAlphabetDescriptor
from roxy.descriptors.physicochemical import ChargeDescriptor

kmer = KmerFullAlphabetDescriptor(k=2)
aaindex = AAIndexDescriptor()
charge = ChargeDescriptor()

kmer_features = kmer.compute(["ACDEFGHIK"])
aaindex_features = aaindex.compute(["ACDEFGHIK"])
charge_features = charge.compute(["ACDEFGHIK"])

CLI

roxy --help
roxy --version

# List and inspect descriptors
roxy list
roxy list --family composition
roxy describe aac

# Compute descriptors from FASTA, CSV, or Parquet input
roxy compute sequences.fasta -d aac -d charge -o features.csv
roxy compute sequences.fasta -f composition -o composition.parquet
roxy compute sequences.csv -d aac --seq-col sequence --id-col id -o features.csv
roxy compute sequences.fasta --all -o all_features.parquet

# Generate and use a YAML config with descriptor parameters
roxy init-config -d aac -d charge -o roxy.yaml
roxy init-config -f composition -o composition.yaml
roxy init-config --all -o all_descriptors.yaml
roxy compute sequences.fasta --config roxy.yaml -o configured_features.csv

# Check a config file without reading any data
roxy validate-config roxy.yaml
roxy validate-config roxy.yaml --json

roxy compute requires exactly one descriptor selector: --config, --all, --descriptor/-d, or --family/-f. CSV and Parquet inputs use sequence as the default sequence column; pass --seq-col when needed.

Record ids: in FASTA the id is the first whitespace-delimited token of the header. CSV and Parquet inputs need an id column, id by default or the one named by --id-col; there are no positional fallback ids. A missing id column, or empty or duplicated ids, is an error.

The --config file nests descriptor parameters under descriptors: (schema_version is optional). The old flat shape, with descriptor names at the root, is rejected.

schema_version: 1
descriptors:
  aac:
    include_counts: false
  charge: {}

roxy validate-config CONFIG collects every problem (unknown keys, descriptors or parameters, wrongly typed or rejected values) and prints one path: message line per problem to stderr, or a JSON array of {path, message} on stdout with --json. It exits 0 if the config is valid and 2 otherwise. roxy compute --config applies the same checks.

Validate a config from Python:

from roxy import ConfigIssue, validate_config

issues = validate_config("roxy.yaml")  # or a mapping with the same structure
for issue in issues:
    print(issue.path, issue.message)

validate_config returns a list of ConfigIssue(path, message), empty when valid. A missing or unparsable file is one issue with path "".

Exit codes: 0 success, 2 usage or config error, 3 data or runtime error (for example unreadable input), 4 internal error (traceback on stderr).

Every successful roxy compute also writes a provenance sidecar, <output>.provenance.json, next to the output file. It records the effective descriptor parameters (defaults included), a config fingerprint, input and output hashes, and package versions.

Examples

The repository ships a few plain Python scripts under examples/:

  • examples/basic_api.py for direct descriptor use from Python
  • examples/configured_descriptors.py for parameterized descriptor instances
  • examples/cli_roundtrip.py for an end-to-end CLI config and compute flow

Run them with:

bash examples/run_ci_examples.sh

Descriptor Families

Registry keys are the names used by roxy compute -d, config files, and output column prefixes.

Family Descriptor keys
aaindex aaindex
autocorrelation autocorrelation
complexity entropy_complexity, local_repetition, run_blockiness
composition aac, compositional_bias, dpc, grouped, kmer_full_alphabet
ctd ctd_classic, distribution
hybrid family_summary
motif functional_residue_content, pattern, spacing, user_regex
physicochemical charge, global_basic, hydrophobicity, order_disorder, structural_propensity
positional normalized, sliding_window, terminal
pseudo pseaac, qso, sequence_order

Development

uv sync
uv run pytest -q
uv run task lint
uv run roxy --help
  • Sylphy — sequence encoders and pretrained model embeddings

Citation

If you use Roxy in your research, please cite:

Medina-Ortiz, D.; Álvarez Saravia, D.; García-Vinuesa, J. Roxy: Classical Protein Sequence Descriptors for Machine Learning. Version 0.3.0, 2026. Zenodo. https://doi.org/10.5281/zenodo.21917534

@software{roxy2026,
  author    = {Medina-Ortiz, David and Álvarez Saravia, Diego and García-Vinuesa, Julián},
  title     = {{Roxy}: Classical Protein Sequence Descriptors for Machine Learning},
  year      = {2026},
  version   = {0.3.0},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.21917534},
  url       = {https://doi.org/10.5281/zenodo.21917534}
}

To cite this exact release, use the version DOI 10.5281/zenodo.21917801. Machine-readable metadata lives in CITATION.cff.

Metadata

Release files for roxylib 0.3.0

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

Source distribution (sdist)

Source distribution for roxylib 0.3.0
File Size Uploaded Provenance Actions
roxylib-0.3.0.tar.gz 159.3 kB With provenance Details for roxylib-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 264.5 kB

Release files / roxylib-0.3.0.tar.gz

Download URL roxylib-0.3.0.tar.gz
Size 159.3 kB
Tags Source
SHA-256 checksum
How to use checksums
18f40da20134ac717d36a00a6789370d06a94e6c665250db38a0c69a3c2cbf94
BLAKE2b-256 checksum
How to use checksums
1b3e5d3f8eb5a572342e0c221e27610fd3bee9719b0352581d98365b9402044a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 25, 2026.

Transparency log

Release files / roxylib-0.3.0-py3-none-any.whl

Download URL roxylib-0.3.0-py3-none-any.whl
Size 105.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
644796b590cdd9f89c00b82c48940f27d64b89423a415ce77c70b54489bc1169
BLAKE2b-256 checksum
How to use checksums
15c14ccff4c4af4229969bc3269d2d9b5bf316f5903e8d01ab8d01b5198e4076
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 25, 2026.

Transparency log

Security for roxylib 0.3.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for roxylib-0.3.0.tar.gz

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 Oct 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files Full provenance

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