-
Notifications
You must be signed in to change notification settings - Fork 13
Using py‐ard from the command line
Various command line interface (CLI) tools are available to use for managing local IPD-IMGT/HLA cache database, running impromptu reduction queries and batch processing of CSV files.
For all tools, use --imgt-version
and --data-dir
to specify the IPD-IMGT/HLA database version and the directory where the SQLite files are created.
pyard-import
helps with importing and reinstalling of prepared IPD-IMGT/HLA and MAC data.
Use pyard-import -h
to see all the options available.
$ pyard-import -h
usage: pyard-import [-h] [--list] [-i IMGT_VERSION] [-d DATA_DIR] [--v2-to-v3-mapping V2_V3_MAPPING] [--refresh-mac] [--re-install] [--skip-mac]
py-ard tool to generate reference SQLite database. Allows updating db with custom V2 to V3 mappings. Displays the list of available IMGT database
versions.
options:
-h, --help show this help message and exit
--list Show Versions of available IMGT Databases
-i IMGT_VERSION, --imgt-version IMGT_VERSION
Import supplied IMGT_VERSION DB Version
-d DATA_DIR, --data-dir DATA_DIR
Data directory to store imported data
--v2-to-v3-mapping V2_V3_MAPPING
V2 to V3 mapping CSV file
--refresh-mac Only refresh MAC data
--re-install reinstall a fresh version of database
--skip-mac Skip creating MAC mapping
Run pyard-import
without any option to download and prepare the latest version of IPD-IMGT/HLA and MAC data.
$ pyard-import
Created Latest py-ard database
$ pyard-import --db-version 3.29.0
Created py-ard version 3290 database
Import particular version of IMGT database and replace the v2 to v3 mapping table from a CSV file.
$ pyard-import --imgt-version 3.29.0 --v2-to-v3-mapping map2to3.csv
Created py-ard version 3290 database
Updated v2_mapping table with 'map2to3.csv' mapping file.
pyard-import --imgt-version 3340 --re-install
$ pyard-import --v2-to-v3-mapping map2to3.csv
$ pyard-import --imgt-version 3450 --refresh-mac
You can skip loading MAC if you don't need by using --skip-mac
$ pyard-import --imgt-version 3150 --skip-mac
Show the statuses of all py-ard
databases
pyard-status
goes through all the available databases and checks all the tables that should be available. This is very helpful to show all the databases, number of rows in each table, any missing tables and the stored IPD-IMGT/HLA version.
$ pyard-status
Use --data-dir
to specify an alternate directory for cached database files.
$ pyard-status --data-dir ~/.pyard/
IMGT DB Version: Latest (3440)
There is a newer IMGT release than version 3440
Upgrade to latest version '3510' with 'pyard-import --re-install'
File: /Users/pbashyal/.pyard/pyard-Latest.sqlite3
Size: 533.37MB
-------------------------------------------
|Table Name |Rows |
|-----------------------------------------|
|dup_g | 59|
|dup_lgx | 1|
|g_group | 14223|
|p_group | 18872|
|lgx_group | 14223|
|exon_group | 12934|
|p_not_g | 1681|
|xx_codes | 1517|
|who_group | 30785|
|alleles | 32504|
|exp_alleles | 60|
|who_alleles | 30523|
|mac_codes | 1089379|
-------------------------------------------
pyard
command can be used for quick reductions from the command line. Use --help
option to see all the available options.
$ pyard --help
usage: pyard [-h] [-v] [-d DATA_DIR] [-i IMGT_VERSION] [-g GL_STRING]
[-r {G,P,lg,lgx,W,exon,U2}] [--splits SPLITS]
py-ard tool to redux GL String
options:
-h, --help show this help message and exit
-v, --version IPD-IMGT/HLA DB Version number
-d DATA_DIR, --data-dir DATA_DIR
Data directory to store imported data
-i IMGT_VERSION, --imgt-version IMGT_VERSION
IPD-IMGT/HLA db to use for redux
-g GL_STRING, --gl GL_STRING
GL String to reduce
-r {G,P,lg,lgx,W,exon,U2}, --redux-type {G,P,lg,lgx,W,exon,U2}
Reduction Method
--splits SPLITS Find Broad and Splits
Reduce from command line by specifying any typing with -g
or --gl
option and the reduction method with -r
or --redux-type
option.
$ pyard -g 'A*01:AB' -r lgx
A*01:01/A*01:02
$ pyard --gl 'DRB1*08:XX' -r G
DRB1*08:01:01G/DRB1*08:02:01G/DRB1*08:03:02G/DRB1*08:04:01G/DRB1*08:05/ ...
$ pyard -i 3290 --gl 'A1' -r lgx # For a particular version of DB
A*01:01/A*01:02/A*01:03/A*01:06/A*01:07/A*01:08/A*01:09/A*01:10/A*01:12/ ...
If the -r
option is left out, pyard
will print out the result of all reduction methods.
$ pyard -g 'A*01:01:01:01'
Reduction Method: G
-------------------
A*01:01:01G
Reduction Method: P
-------------------
A*01:01P
Reduction Method: lg
--------------------
A*01:01g
Reduction Method: lgx
---------------------
A*01:01
Reduction Method: W
-------------------
A*01:01:01:01
Reduction Method: exon
----------------------
A*01:01:01
Reduction Method: U2
--------------------
A*01:01
py-ard
knows about the broad/splits of serology and DNA, you can find by using --splits
option to pyard
command.
$ pyard --splits "A*10"
A*10 = A*25/A*26/A*34/A*66
$ pyard --splits B14
B14 = B64/B65
pyard-csv-reduce
can be used to batch process a CSV file with HLA typings. See documentation for detailed information about all the options.