|
24 | 24 | import sqlite3 |
25 | 25 | from typing import Tuple, Dict, Set, List |
26 | 26 |
|
27 | | -from .data_repository import ARSMapping |
| 27 | +from .mappings import ARSMapping |
28 | 28 | from .misc import get_imgt_db_versions, get_default_db_directory |
29 | 29 |
|
30 | 30 |
|
@@ -374,73 +374,68 @@ def load_ars_mappings(db_connection): |
374 | 374 | db_connection, table_name="dup_lgx", columns=("allele", "lgx_group") |
375 | 375 | ) |
376 | 376 | g_group = load_dict(db_connection, table_name="g_group", columns=("allele", "g")) |
| 377 | + p_group = load_dict(db_connection, table_name="p_group", columns=("allele", "p")) |
377 | 378 | lgx_group = load_dict( |
378 | 379 | db_connection, table_name="lgx_group", columns=("allele", "lgx") |
379 | 380 | ) |
380 | 381 | exon_group = load_dict( |
381 | 382 | db_connection, table_name="exon_group", columns=("allele", "exon") |
382 | 383 | ) |
383 | 384 | p_not_g = load_dict(db_connection, table_name="p_not_g", columns=("allele", "lgx")) |
384 | | - return ( |
385 | | - ARSMapping( |
386 | | - dup_g=dup_g, |
387 | | - dup_lgx=dup_lgx, |
388 | | - g_group=g_group, |
389 | | - lgx_group=lgx_group, |
390 | | - exon_group=exon_group, |
391 | | - p_not_g=p_not_g, |
392 | | - ), |
393 | | - None, |
| 385 | + return ARSMapping( |
| 386 | + dup_g=dup_g, |
| 387 | + dup_lgx=dup_lgx, |
| 388 | + g_group=g_group, |
| 389 | + p_group=p_group, |
| 390 | + lgx_group=lgx_group, |
| 391 | + exon_group=exon_group, |
| 392 | + p_not_g=p_not_g, |
394 | 393 | ) |
395 | 394 |
|
396 | 395 |
|
397 | | -def save_ars_mappings( |
398 | | - db_connection, dup_g, dup_lgx, exon_group, g_group, lgx_group, p_group, p_not_g |
399 | | -): |
| 396 | +def save_ars_mappings(db_connection: sqlite3.Connection, ars_mapping: ARSMapping): |
400 | 397 | save_dict( |
401 | 398 | db_connection, |
402 | 399 | table_name="p_not_g", |
403 | | - dictionary=p_not_g, |
| 400 | + dictionary=ars_mapping.p_not_g, |
404 | 401 | columns=("allele", "lgx"), |
405 | 402 | ) |
406 | 403 | save_dict( |
407 | 404 | db_connection, |
408 | 405 | table_name="dup_g", |
409 | | - dictionary=dup_g, |
| 406 | + dictionary=ars_mapping.dup_g, |
410 | 407 | columns=("allele", "g_group"), |
411 | 408 | ) |
412 | 409 | save_dict( |
413 | 410 | db_connection, |
414 | 411 | table_name="dup_lgx", |
415 | | - dictionary=dup_lgx, |
| 412 | + dictionary=ars_mapping.dup_lgx, |
416 | 413 | columns=("allele", "lgx_group"), |
417 | 414 | ) |
418 | 415 | save_dict( |
419 | | - db_connection, table_name="g_group", dictionary=g_group, columns=("allele", "g") |
| 416 | + db_connection, |
| 417 | + table_name="g_group", |
| 418 | + dictionary=ars_mapping.g_group, |
| 419 | + columns=("allele", "g"), |
| 420 | + ) |
| 421 | + save_dict( |
| 422 | + db_connection, |
| 423 | + table_name="p_group", |
| 424 | + dictionary=ars_mapping.p_group, |
| 425 | + columns=("allele", "p"), |
420 | 426 | ) |
421 | 427 | save_dict( |
422 | 428 | db_connection, |
423 | 429 | table_name="lgx_group", |
424 | | - dictionary=lgx_group, |
| 430 | + dictionary=ars_mapping.lgx_group, |
425 | 431 | columns=("allele", "lgx"), |
426 | 432 | ) |
427 | 433 | save_dict( |
428 | 434 | db_connection, |
429 | 435 | table_name="exon_group", |
430 | | - dictionary=exon_group, |
| 436 | + dictionary=ars_mapping.exon_group, |
431 | 437 | columns=("allele", "exon"), |
432 | 438 | ) |
433 | | - return ( |
434 | | - ARSMapping( |
435 | | - dup_g=dup_g, |
436 | | - dup_lgx=dup_lgx, |
437 | | - g_group=g_group, |
438 | | - lgx_group=lgx_group, |
439 | | - exon_group=exon_group, |
440 | | - p_not_g=p_not_g, |
441 | | - ), |
442 | | - p_group, |
443 | | - ) |
444 | 439 |
|
445 | 440 |
|
446 | 441 | def save_code_mappings( |
|
0 commit comments