diff --git a/argnorm/normalizers.py b/argnorm/normalizers.py index 7fb4b3f..7907850 100644 --- a/argnorm/normalizers.py +++ b/argnorm/normalizers.py @@ -16,6 +16,18 @@ _ROOT = os.path.abspath(os.path.dirname(__file__)) +def is_number(num): + """ + Required for checking aro mappings to discern between numbers and other + string identifiers. + """ + try: + float(num) + except ValueError: + return False + + return True + def get_data_path(path, getting_manual_curation): """ Gets mapping tables and manual curation tables. @@ -126,6 +138,7 @@ def get_aro_mapping_table(self): if self.tool != 'argsoap' and self.mode != 'orfs': df.loc[aro_nan_indices[i], 'Gene Name in CARD'] = manual_curation.loc[i, 'Gene Name in CARD'] + df[TARGET_ARO_COL] = df[TARGET_ARO_COL].map(lambda a: f'ARO:{int(float(a)) if is_number(a) == True else a}') return df def load_input(self, input_file):