GLC
glc.GLCModel
Graph-based lipid classifier (GLC).
This class predicts lipid classes using a Gaussian Graphical Model (GGM), feature metadata, and accurate mass matches to database (LMSD). Scoring uses first-hop and second-hop neighbor information, weighted by partial correlations and with retention-time filtering.
Source code in src/glc/glc_model.py
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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
__init__(ggm, feat_dicts, node_ids, db_df, db_id_col='LM_ID', class_level='SUB_CLASS', rt_thresh=50.0, feat_weight=5.0, label_propogation=False)
Initialize the GLC predictor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ggm
|
GGM
|
Object containing the graph ( |
required |
feat_dicts
|
FeatDicts
|
Object providing metadata (e.g., retention times via |
required |
node_ids
|
Dict[int, List[str]]
|
Mapping of feature/node IDs to lists of database IDs. |
required |
db_df
|
DataFrame
|
Database dataframe containing lipid annotations. |
required |
db_id_col
|
str
|
Column in |
'LM_ID'
|
class_level
|
str
|
Level of lipid classification to predict (e.g., "SUB_CLASS"). |
'SUB_CLASS'
|
rt_thresh
|
float
|
Maximum retention-time difference allowed for neighbor filtering. |
50.0
|
feat_weight
|
float
|
Weight multiplier for the feature itself when scoring. |
5.0
|
label_propogation
|
bool
|
Whether to use harmonic label propagation for nodes with
no assigned class. (Default: |
False
|
Source code in src/glc/glc_model.py
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 | |
convert2mainclass(predictions)
Convert predicted SUB_CLASS values to MAIN_CLASS values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictions
|
Dict[int, List[Tuple[str, float]]]
|
Output from |
required |
Returns:
| Type | Description |
|---|---|
Dict[int, List[Tuple[str, float]]]
|
A dict mapping feature IDs -> list of |
Source code in src/glc/glc_model.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
predict_all()
Predict classes for all features in the main GGM subgraph.
Returns:
| Type | Description |
|---|---|
Dict[int, List[Tuple[str, float]]]
|
A dict mapping feature IDs → list of |
Source code in src/glc/glc_model.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
score_node(feature_id)
Score lipid classes for a single feature ID.
Scoring is based on
- filtered first-hop neighbors,
- second-hop neighbors,
- partial correlations as weights,
- retention-time constraints.
- feature itself weighted by
feat_weight.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_id
|
int
|
Node/feature ID to classify. |
required |
Returns:
| Type | Description |
|---|---|
List[Tuple[str, float]]
|
A list of |
Source code in src/glc/glc_model.py
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 121 122 123 124 125 126 127 128 129 130 | |