Skip to content

Commit 527ccab

Browse files
committed
Update pyard-status to show all the tables.
``` ============================================= IMGT DB Version: Latest (3530) You're up to date. 3530 is the most recent version. File: /var/folders/nm/nyjkgrfn3fg207v5z5rz1w8m0000gp/T/pyard-pbashyal/pyard-Latest.sqlite3 Size: 568.36MB --------------------------------------------- |Table Name | Rows| |-------------------------------------------| |alleles | 39,977| |cwd2 | 336| |dup_g | 70| |dup_lgx | 2| |exon_group | 13,406| |exp_alleles | 91| |g_group | 14,736| |lgx_group | 14,736| |mac_codes | 1,124,465| |p_group | 21,534| |p_not_g | 1,709| |serology_broad_split_mapping | 23| |serology_mapping | 131| |shortnulls | 176| |v2_mapping | 11| |who_alleles | 37,619| |who_group | 36,576| |xx_codes | 2,019| --------------------------------------------- ```
1 parent 1efb092 commit 527ccab

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

pyard/mappings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@
4242
"who_alleles",
4343
]
4444

45+
serology_tables = [
46+
"serology_broad_split_mapping",
47+
"serology_mapping",
48+
]
49+
50+
misc_tables = ["cwd2", "shortnulls", "v2_mapping", "mac_codes"]
51+
4552
ARSMapping = namedtuple("ARSMapping", ars_mapping_tables)
4653
CodeMappings = namedtuple("CodeMappings", code_mapping_tables)
4754
AlleleGroups = namedtuple("AlleleGroups", allele_tables)

scripts/pyard-status

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import pyard.mappings
3030
from pyard import db, data_repository
3131
from pyard.misc import get_data_dir
3232

33+
LONG_DASH_LINE_LENGTH = 45
34+
3335

3436
def get_latest_imgt_version() -> int:
3537
"""
@@ -70,7 +72,7 @@ if __name__ == "__main__":
7072
db_connection, db_filename = db.create_db_connection(
7173
data_dir, imgt_version, ro=True
7274
)
73-
print("-" * 43)
75+
print("=" * LONG_DASH_LINE_LENGTH)
7476
if imgt_version == "Latest":
7577
db_version = data_repository.get_db_version(db_connection)
7678
print(f"IMGT DB Version: {imgt_version} ({db_version})")
@@ -90,19 +92,20 @@ if __name__ == "__main__":
9092
file_size = get_file_size(db_filename)
9193
print(f"File: {db_filename}")
9294
print(f"Size: {file_size:.2f}MB")
93-
print("-" * 43)
94-
print(f"|{'Table Name':20}|{'Rows':20}|")
95-
print(f"|{'-' * 41}|")
96-
for table in (
95+
print("-" * LONG_DASH_LINE_LENGTH)
96+
print(f"|{'Table Name':30}|{'Rows':>12}|")
97+
print(f"|{'-' * (LONG_DASH_LINE_LENGTH - 2)}|")
98+
for table in sorted(
9799
pyard.mappings.ars_mapping_tables
98100
+ pyard.mappings.code_mapping_tables
99101
+ pyard.mappings.allele_tables
100-
+ ["mac_codes"]
102+
+ pyard.mappings.serology_tables
103+
+ pyard.mappings.misc_tables
101104
):
102105
if db.table_exists(db_connection, table):
103106
total_rows = db.count_rows(db_connection, table)
104-
print(f"|{table:20}|{total_rows:20}|")
107+
print(f"|{table:30}|{int(total_rows):12,d}|")
105108
else:
106109
print(f"MISSING: {table} table")
107-
print("-" * 43)
110+
print("-" * LONG_DASH_LINE_LENGTH)
108111
db_connection.close()

0 commit comments

Comments
 (0)