Annotation mixin
annotation_mixin
¶
Mixin for antibody sequence annotation using ANARCI/riot_na.
Classes¶
AnnotationMixin
¶
Mixin for ANARCI sequence annotation capabilities.
Source code in src/antibody_training_esm/datasets/mixins/annotation_mixin.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
Functions¶
annotate_sequence(sequence_id, sequence, chain)
¶
Annotate a single sequence using ANARCI (IMGT numbering).
This method wraps riot_na.create_riot_aa() to extract CDR/FWR regions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sequence_id
|
str
|
Unique identifier for the sequence |
required |
sequence
|
str
|
Protein sequence to annotate |
required |
chain
|
str
|
Chain type ("H" for heavy, "L" for light) |
required |
Returns:
| Type | Description |
|---|---|
dict[str, str] | None
|
Dictionary with keys: FWR1, CDR1, FWR2, CDR2, FWR3, CDR3, FWR4 |
dict[str, str] | None
|
Returns None if annotation fails |
Source code in src/antibody_training_esm/datasets/mixins/annotation_mixin.py
annotate_all(df)
¶
Annotate all sequences in a DataFrame.
Adds annotation columns for heavy and light chains.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame with VH_sequence and optionally VL_sequence columns |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with annotation columns added |