Skip to main content

gl-smartsort

A tiny Python package that canonicalizes GL Strings by smart sorting:

  • recursively sorts within delimiter levels in precedence: ?, ^, |, +, ~, /
  • orders blocks by gene/locus (left of *)
  • orders alleles numerically (not lexically) within a locus (e.g., A*01:11 before A*01:103)
  • breaks ties on expression suffixes deterministically (e.g., A*01:01 before A*01:01N)
  • supports the GL String 1.1 ? (possible gene locations) delimiter

As of v0.2.0, the sorting is performed by the standards-conformant glstring library (GL String 1.1 parser + AST); gl-smartsort is a thin wrapper that calls glstring.smart_sort(gl, legacy=True) to preserve the historical ordering convention. This package is a Python port of SmartSort.pm (2012-11-14).

Install (local)

From the project directory:

python -m pip install -U pip
python -m pip install -e .

Usage (Python)

from gl_smartsort import smart_sort

print(smart_sort("A*01:103+A*01:11"))
# A*01:11+A*01:103

Usage (CLI)

Sort a single GL string:

gl-smartsort "B*07:02^A*02:01"

Or sort from stdin (one per line):

cat gl.txt | gl-smartsort

Provenance

This package is a Python port of the original Perl implementation SmartSort.pm (2012-11-14), authored by Martin J. Maiers. Both the original Perl implementation and this Python port were written by the same author. As of v0.2.0 the sorting is delegated to the independently developed, standards- conformant glstring library (Apache-2.0); no third-party source code is vendored into this package.

License

Licensed under the Apache License, Version 2.0 (Apache-2.0). See the LICENSE and NOTICE files for details.

Copyright 2012 Martin J. Maiers and National Marrow Donor Program (NMDP).

Metadata

Release files for gl-smartsort 0.2.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 gl-smartsort 0.2.0
File Size Uploaded Provenance Actions
gl_smartsort-0.2.0.tar.gz 11.1 kB With provenance Details for gl_smartsort-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gl-smartsort 0.2.0
File Interpreter ABI Platform Actions
gl_smartsort-0.2.0-py3-none-any.whl Python 3 none any Details for gl_smartsort-0.2.0-py3-none-any.whl

Total release size: 20.0 kB

Release files / gl_smartsort-0.2.0.tar.gz

Download URL gl_smartsort-0.2.0.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
92a2e6f1d04830744bb261d68c035ad7d85625f2c1aae1a460f2aadce4c2a209
BLAKE2b-256 checksum
How to use checksums
39752e8328da58383384bf1c69da27df1a6d379e0669a34e440a0016c84c292c
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 Nov 2, 2026.

Transparency log

Release files / gl_smartsort-0.2.0-py3-none-any.whl

Download URL gl_smartsort-0.2.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6011713f32724d9bc1ef2028a8cfa076e3153c9b3ccead8763fa0e721400b976
BLAKE2b-256 checksum
How to use checksums
2e859f6303008fb779882de03d05b8dc2ceb8bb5147adfa6bddc585539e945be
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 Nov 2, 2026.

Transparency log

Security for gl-smartsort 0.2.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 gl_smartsort-0.2.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 Nov 2, 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.2.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