@@ -80,7 +80,11 @@ class ARD(object):
8080 """
8181
8282 def __init__ (
83- self , imgt_version : str = "Latest" , data_dir : str = None , config : dict = None
83+ self ,
84+ imgt_version : str = "Latest" ,
85+ data_dir : str = None ,
86+ load_mac : bool = True ,
87+ config : dict = None ,
8488 ):
8589 """
8690 ARD will load valid alleles, xx codes and MAC mappings for the given
@@ -97,10 +101,10 @@ def __init__(
97101 self ._config .update (config )
98102
99103 # Create a database connection for writing
100- self .db_connection = db .create_db_connection (data_dir , imgt_version )
104+ self .db_connection , _ = db .create_db_connection (data_dir , imgt_version )
101105
102106 # Load MAC codes
103- dr .generate_mac_codes (self .db_connection , False )
107+ dr .generate_mac_codes (self .db_connection , refresh_mac = False , load_mac = load_mac )
104108 # Load ARS mappings
105109 self .ars_mappings , p_group = dr .generate_ars_mapping (
106110 self .db_connection , imgt_version
@@ -140,7 +144,7 @@ def __init__(
140144 gc .freeze ()
141145
142146 # Re-open the connection in read-only mode as we're not updating it anymore
143- self .db_connection = db .create_db_connection (data_dir , imgt_version , ro = True )
147+ self .db_connection , _ = db .create_db_connection (data_dir , imgt_version , ro = True )
144148
145149 def __del__ (self ):
146150 """
@@ -393,7 +397,7 @@ def validate(self, glstring):
393397 except InvalidAlleleError as e :
394398 raise InvalidTypingError (
395399 f"{ glstring } is not valid GL String. \n { e .message } " , e
396- )
400+ ) from None
397401
398402 def is_XX (self , glstring : str , loc_antigen : str = None , code : str = None ) -> bool :
399403 if loc_antigen is None or code is None :
@@ -718,7 +722,7 @@ def refresh_mac_codes(self) -> None:
718722 Refreshes MAC code for the current IMGT db version.
719723 :return: None
720724 """
721- dr .generate_mac_codes (self .db_connection , True )
725+ dr .generate_mac_codes (self .db_connection , refresh_mac = True )
722726
723727 def get_db_version (self ) -> str :
724728 """
0 commit comments