Rename and orient chromosomes based on reference alignment (PAF format)
Project description
rename-and-orient
Rename and orient chromosomes in a FASTA file based on alignment to a reference genome (PAF format).
Developed for genome curation workflows in the Darwin Tree of Life project (GRIT team, Wellcome Sanger Institute).
Features
- Renames scaffolds (
SUPER_N) to chromosome names based on best PAF alignment to reference - Reverse-complements chromosomes to match reference orientation (Pearson correlation method)
- Handles sex chromosomes (W, Z, X, Y, Z1/Z2, etc.), unlocalized contigs (
_unloc_), and HAP-suffixed scaffolds - Resolves assignment conflicts (multiple query chromosomes mapping to the same target)
--mapping-tablemode: rename a second haplotype using the mapping produced from the first (no re-alignment needed)- Optional alignment scatter plots (
--plot-alignments, requires matplotlib)
Installation
pip install rename-and-orient
# or with uv:
uv tool install rename-and-orient
Usage
PAF mode (standard)
rename-and-orient \
--fasta hap1.primary.curated.fa \
--paf hap1_vs_reference.paf \
--output-dir results/ \
--output-prefix ilMysSpe1.hap1.1
Mapping-table mode (second haplotype)
rename-and-orient \
--fasta hap2.primary.curated.fa \
--mapping-table results/ilMysSpe1.hap1.1.mapping.tsv \
--output-dir results_hap2/ \
--output-prefix ilMysSpe1.hap2.1
Options
| Option | Short | Default | Description |
|---|---|---|---|
--fasta |
-f |
required | Input FASTA (gzip supported) |
--paf |
-p |
required* | PAF alignment file |
--mapping-table |
-mt |
required* | Pre-built mapping TSV (mutually exclusive with --paf) |
--output-dir |
-d |
./rename_and_orient |
Output directory |
--output-prefix |
-o |
FASTA stem | Output file prefix |
--min-coverage |
-c |
0.5 |
Minimum alignment coverage to rename |
--query-chromosome-prefix |
-q |
SUPER_ |
Prefix for query scaffolds |
--output-chromosome-prefix |
-x |
SUPER_ |
Prefix for output chromosome names |
--reference-chromosome-prefix |
-r |
auto | Reference chromosome prefix in PAF |
--plot-alignments |
-P |
off | Generate alignment scatter plots (requires matplotlib) |
Output files
| File | Description |
|---|---|
<prefix>.fa |
Renamed and oriented FASTA |
<prefix>.chromosome.list.csv |
Chromosome list CSV (name,suffix,yes/no) |
<prefix>.mapping.tsv |
Mapping summary TSV (PAF mode only) |
plots/ |
Alignment scatter plots (if --plot-alignments) |
Development
git clone https://github.com/zilov/rename-and-orient
cd rename-and-orient
uv sync
uv run pytest tests/
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
rename_and_orient-1.2.0.tar.gz
(92.7 kB
view details)
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 rename_and_orient-1.2.0.tar.gz.
File metadata
- Download URL: rename_and_orient-1.2.0.tar.gz
- Upload date:
- Size: 92.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97ac5cd532f41d653f26146a36c52cf687251a48e60a2d30768deb5d186acc3e
|
|
| MD5 |
61e4f1a1ad66792e7b40412416a55d20
|
|
| BLAKE2b-256 |
50d7b3facc7a8fd8d7ece5ca8c61f7e417b6ace5766cd0c0c3be2f442a74f45a
|
File details
Details for the file rename_and_orient-1.2.0-py3-none-any.whl.
File metadata
- Download URL: rename_and_orient-1.2.0-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c3aef72414a62b93b19dba914621188bb62e630486211453241e0b469384726
|
|
| MD5 |
21f53688de5fce4faffa667af9bd2661
|
|
| BLAKE2b-256 |
a69ff22c49891ef0b4ed54e6ca4b5c516b93d4e5f11560b39234c934e43c5b0a
|