This release is a pre-release and may not be stable for production use.
Ranchero
Is your mycobacterial metadata a mess? Grab the M. bovis by the horns with Ranchero.
Ranchero is a Python solution to the dozens of different metadata formats used in genomic datasets. While it is specifically focused on NCBI's collection of Mycobacterium tuberculosis complex metadata, it still has utility for other organisms.
GitHub: github.com/aofarrel/ranchero
Features
- Pre-configured to standardize dozens of common NCBI metadata fields
- Input a TSV/JSON/CSV of new samples and their metadata into a dataframe
- Merge columns of similar data types into a single column, filling in nulls/empty values as you go
- Input a TSV of metadata to "inject" into an existing dataframe, optionally overriding metadata already present
- Flatten all of those "missing" and "Not Applicable" strings into proper null values
- Convert countries into three-letter country codes per ISO 3166
- Convert dates to YYYY-MM-DD format into an ISO 8601-like format
- Convert common host animal names to the standardized Genus species format when possible, as well a common name
- (tuberculosis only) Convert old-school strain names (Beijing, LAM, etc) to the modern lineage system (L2.2.1, L4.3, etc)
Dependencies
- Python 3.11-ish (3.9+ should be okay)
- pandas >= 2.0.0
- pyarrow, even if not working with Apache Arrow datasets
- polars for Python == 1.27.0
- tqdm
- xmltodict for working with Enterz Direct files
Supported inputs
| Platform | Expected format | Ranchero function |
|---|---|---|
| BigQuery | newline-delimited JSONL† | from_bigquery() |
| Enterz Direct (efetch) | XML‡ | from_efetch() |
| NCBI SRA web search | XML‡ | from_efetch() |
| Excel/LibreOffice | TSV (XLSX not supported) | from_tsv() |
| Google Sheets | TSV | from_tsv() |
| NCBI Run Selector | CSV | from_run_selector() |
| basically anything else | TSV | from_tsv() |
† BQ typically outputs JSONs in a format polars does not like; from_bigquery() will fix it on the fly.
‡ efetch typically outputs an invalid XML; from_efetch() will fix it on the fly. However, note that only -db sra -format native -mode xml and output from NCBI SRA web search is supported.
Metadata
Release files for ranchero 0.1.0rc31
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ranchero-0.1.0rc31.tar.gz | 120.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ranchero-0.1.0rc31-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 246.8 kB
Release files / ranchero-0.1.0rc31.tar.gz
| Download URL | ranchero-0.1.0rc31.tar.gz |
|---|---|
| Size | 120.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc5c1cd7edd4401f4413726d7109c17391a3fc963e34cb93861b4e64c96c5672
|
|
BLAKE2b-256 checksum How to use checksums |
f6a1170450d764eefaea6964a1be2c3ad72112ba5bf16c35f66023f12e8a8ae2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / ranchero-0.1.0rc31-py3-none-any.whl
| Download URL | ranchero-0.1.0rc31-py3-none-any.whl |
|---|---|
| Size | 126.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80352b8d965918c6f29de45154c39b9004df2bff08f514dd936c81be75a32cc9
|
|
BLAKE2b-256 checksum How to use checksums |
07b1148fe03460a7a12e9130b9331a583d47ece3d975a73c77d19eff74f9ea2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for ranchero 0.1.0rc31
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.