Download and output sequences from IMGT/HLA
Project description
hladl
(HLA downloader)
JH @ MGH, 2025
This is a simple CLI to make grabbing specific HLA allele sequences easier. It aims to be similar to hladownload but without the more advanced features that offers (although that script appears to be out of action due to Biopython version changes since its last update).
Effectively, this script will spit out a cDNA nucleotide or protein amino acid sequence, given an allele identifier and a number of digits resolution. Sequences are grabbed from the IMGTHLA Github repo and stored locally in a gzippd json, allowing them to be output without a need for later internet connectivity.
Installation
hladl was made with poetry and typer. It can be installed from PyPI:
pip install hladl
Usage
Sequences can be downloaded to the installed data directory using hladl init. Users specify the sequence type (nucleotide, protein, or both) with the -s flag, and the HLA allele digit resolution (i.e. 2, 4, 6, or 8 digit, being HLA-X*22:44:66:88) wit the -d flag like so:
# Download nucleotide (cDNA) sequences for 4 digit alleles
hladl init -s nuc -d 4
# Download protein (AA) sequences for 2 digit alleles
hladl init -s prot -d 2
Sequences can then be output to stdout using the seq command:
hladl seq -a DRA*01:01
hladl seq -a A*02 -s prot -d 2
Class I MHC protein sequences can also be automatically trimmed to remove leader and transmembrane/intracellular domains, yielding the extracellular domain, by specifying this in the mode option:
hladl seq -a A*02:01 -m ecd -s prot
Users can also instead choose to produce a FASTA file of the designated allele using the -om / --output_mode flag, which saves to the current directory:
hladl seq -a B*07:02 -om fasta
The location of the data directory can be determined using the dd command:
hladl dd
# Will produce something like
/path/to/where/its/saving/stuff
Notes
-
If you run the
hladl seqscript without running the appropriatehladl init, it will try to download the appropriate sequences on the fly. -
While the IMGTHLA repo does also store unspliced genomic DNA files, these are handled slightly different, are much larger files, and frankly I don't need them in my pipelines right now, so they're not yet catered to.
-
Pseudogenes and other aberrent length entries in the dataset cannot be used for
ecdmode.
Project details
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 hladl-0.1.0.tar.gz.
File metadata
- Download URL: hladl-0.1.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a451a4b26435759ee0c428ada131bb6a208cda20ea83c9ed20750ef870ce5972
|
|
| MD5 |
37f335c1cc1afdfc6006f34a97abd0da
|
|
| BLAKE2b-256 |
43e2f64dd67bb2094d931624100abe2bbe55ae533d395246490e84b4103ba7df
|
File details
Details for the file hladl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hladl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ff2598805231877560b1b5b0e1ee0bc8d63b050013d35c1fc60e561da57adbc
|
|
| MD5 |
36afe5a610b50cfff8aa2eb05b18713a
|
|
| BLAKE2b-256 |
35276c903287c36e4f0ecff46409c34747cd88a6e1afea47a386ead605e876fe
|