AnnotationPreprocessor.register_feature
- AnnotationPreprocessor.register_feature(key, subcategory=None, normalization=None)[source]
Register (or override) an open-vocabulary Functional-sites key.
Adds a new
feature_typelabel to the per-instance registry so thatencode()knows how many output dimensions to allocate and which normalization recipe to apply. Unknown keys that arrive duringingest()are auto-registered with default settings; call this method first to supply a customsubcategoryor normalization function.Added in version 1.1.0.
- Parameters:
- Return type:
None
- Raises:
ValueError – If
keyis not a non-empty string.
Examples
register_featureexplicitly registers (or overrides) an open-vocabulary Functional sites key before ingest — giving it asubcategorylabel and an optional customnormalizationcallable (default: identity, values must already lie in[0, 1]). Use it when you want a predictor channel named and normalized your way rather than auto-registered.import warnings import numpy as np import pandas as pd import aaanalysis as aa import aaanalysis.utils as ut aa.options['verbose'] = False warnings.filterwarnings('ignore') ap = aa.AnnotationPreprocessor(verbose=False) df_seq = pd.DataFrame({'entry': ['AF_TINY'], 'sequence': ['ACDEFGHIKLMNPQRSTVWYACDEFGHIKL']}) ap.register_feature(key='kinase_site', subcategory='Kinase site (predictor)') print('registered:', 'kinase_site' in ap._registry) print(ap._registry['kinase_site'])
registered: True {'method': 'encode', 'num_dims': 1, 'dim_names': ['kinase_site'], 'category': 'Functional sites', 'subcategory': 'Kinase site (predictor)'}