sciforge-hub 0.0.4

Central hub orchestrating Sciforge subsystems (api, engine, tools).
Documentation
1
2
3
4
5
6
7
8
9
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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
//! Dispatch handler for radiobiology functions.

use super::super::params::*;
use crate::domain::biology as bio;
use crate::domain::common::errors::{HubError, HubResult};
use crate::engine::experience::runner::RunOutput;

pub(super) fn dispatch(func: &str, p: &Params) -> HubResult<RunOutput> {
    match func {
        "dna_strand_break_probability" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::dna_strand_break_probability(
                get_f(p, "dose")?,
                get_f(p, "target_size")?,
                get_f(p, "repair_efficiency")?,
            ),
        )),
        "base_excision_repair_rate" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::base_excision_repair_rate(
                get_f(p, "damage_sites")?,
                get_f(p, "enzyme_concentration")?,
                get_f(p, "km")?,
            ),
        )),
        "misrepair_probability" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::misrepair_probability(
                get_f(p, "damage_density")?,
                get_f(p, "complexity_factor")?,
            ),
        )),
        "chromosome_aberration_yield" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::chromosome_aberration_yield(
                get_f(p, "dose")?,
                get_f(p, "alpha")?,
                get_f(p, "beta")?,
            ),
        )),
        "lethal_aberration_fraction" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::lethal_aberration_fraction(get_f(p, "aberrations")?),
        )),
        "mutation_frequency" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::mutation_frequency(
                get_f(p, "dose")?,
                get_f(p, "spontaneous_rate")?,
                get_f(p, "induced_rate_per_gy")?,
            ),
        )),
        "double_strand_break_yield" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::double_strand_break_yield(
                get_f(p, "dose")?,
                get_f(p, "let_factor")?,
            ),
        )),
        "nhej_repair_kinetics" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::nhej_repair_kinetics(
                get_f(p, "breaks")?,
                get_f(p, "fast_rate")?,
                get_f(p, "slow_rate")?,
                get_f(p, "fast_fraction")?,
                get_f(p, "t")?,
            ),
        )),
        "homologous_recombination_probability" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::homologous_recombination_probability(
                get_f(p, "cell_cycle_s_g2_fraction")?,
                get_b(p, "sister_chromatid_available")?,
            ),
        )),
        "clustered_damage_probability" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::clustered_damage_probability(
                get_f(p, "dose")?,
                get_f(p, "let_val")?,
                get_f(p, "target_radius")?,
            ),
        )),
        "single_strand_break_yield" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::single_strand_break_yield(get_f(p, "dose")?),
        )),
        "oxidative_base_damage_yield" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::oxidative_base_damage_yield(
                get_f(p, "dose")?,
                get_f(p, "oxygen_concentration")?,
            ),
        )),
        "dna_damage_complexity_score" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::dna_damage_complexity_score(
                get_f(p, "ssb")?,
                get_f(p, "dsb")?,
                get_f(p, "base_damage")?,
            ),
        )),
        "foci_formation_kinetics" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::foci_formation_kinetics(
                get_f(p, "dsb")?,
                get_f(p, "recruitment_rate")?,
                get_f(p, "t")?,
            ),
        )),
        "foci_resolution_kinetics" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::foci_resolution_kinetics(
                get_f(p, "foci_max")?,
                get_f(p, "repair_rate")?,
                get_f(p, "t")?,
            ),
        )),
        "micronucleus_formation" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::micronucleus_formation(
                get_f(p, "dose")?,
                get_f(p, "alpha_mn")?,
                get_f(p, "beta_mn")?,
            ),
        )),
        "comet_tail_moment" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::comet_tail_moment(
                get_f(p, "tail_length")?,
                get_f(p, "tail_dna_fraction")?,
            ),
        )),
        "gamma_h2ax_signal" => Ok(RunOutput::Scalar(
            bio::radiobiology::dna_damage::gamma_h2ax_signal(
                get_f(p, "dsb")?,
                get_f(p, "spreading_factor")?,
                get_f(p, "background")?,
            ),
        )),
        "repair_pathway_choice" => {
            let (a, b) = bio::radiobiology::dna_damage::repair_pathway_choice(
                get_f(p, "dsb")?,
                get_f(p, "cell_cycle_phase")?,
                get_f(p, "brca_status")?,
            );
            Ok(RunOutput::Pair(a, b))
        }
        "radio_linear_quadratic_survival" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::linear_quadratic_survival(
                get_f(p, "dose")?,
                get_f(p, "alpha")?,
                get_f(p, "beta")?,
            ),
        )),
        "radio_biologically_effective_dose" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::biologically_effective_dose(
                get_f(p, "n")?,
                get_f(p, "d")?,
                get_f(p, "alpha_beta")?,
            ),
        )),
        "radio_equivalent_dose_2gy" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::equivalent_dose_2gy(
                get_f(p, "bed")?,
                get_f(p, "alpha_beta")?,
            ),
        )),
        "tcp" => Ok(RunOutput::Scalar(bio::radiobiology::dose_response::tcp(
            get_f(p, "n_cells")?,
            get_f(p, "survival_fraction")?,
        ))),
        "ntcp_lyman" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::ntcp_lyman(
                get_f(p, "dose")?,
                get_f(p, "td50")?,
                get_f(p, "m")?,
            ),
        )),
        "oxygen_enhancement_ratio" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::oxygen_enhancement_ratio(
                get_f(p, "dose_hypoxic")?,
                get_f(p, "dose_oxic")?,
            ),
        )),
        "dna_dsb_yield" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::dna_dsb_yield(
                get_f(p, "dose")?,
                get_f(p, "yield_per_gray")?,
            ),
        )),
        "repair_kinetics" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::repair_kinetics(
                get_f(p, "dsb0")?,
                get_f(p, "repair_rate")?,
                get_f(p, "t")?,
            ),
        )),
        "fractionation_survival" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::fractionation_survival(
                get_u(p, "n_fractions")?,
                get_f(p, "dose_per_fraction")?,
                get_f(p, "alpha")?,
                get_f(p, "beta")?,
                get_f(p, "repair_factor")?,
            ),
        )),
        "relative_biological_effectiveness" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::relative_biological_effectiveness(
                get_f(p, "dose_ref")?,
                get_f(p, "dose_test")?,
            ),
        )),
        "let_to_rbe" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::let_to_rbe(
                get_f(p, "let_val")?,
                get_f(p, "rbe_max")?,
                get_f(p, "let_half")?,
            ),
        )),
        "protraction_factor" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::protraction_factor(
                get_f(p, "dose_rate")?,
                get_f(p, "repair_half_time")?,
                get_f(p, "total_time")?,
            ),
        )),
        "bystander_effect" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::bystander_effect(
                get_f(p, "dose")?,
                get_f(p, "max_effect")?,
                get_f(p, "dose_half")?,
            ),
        )),
        "adaptive_response" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::adaptive_response(
                get_f(p, "priming_dose")?,
                get_f(p, "challenge_dose")?,
                get_f(p, "alpha")?,
                get_f(p, "beta")?,
                get_f(p, "reduction_factor")?,
            ),
        )),
        "low_dose_hypersensitivity" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::low_dose_hypersensitivity(
                get_f(p, "dose")?,
                get_f(p, "alpha_r")?,
                get_f(p, "alpha_s")?,
                get_f(p, "dc")?,
                get_f(p, "beta")?,
            ),
        )),
        "tumor_growth_delay" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::tumor_growth_delay(
                get_f(p, "dose")?,
                get_f(p, "alpha")?,
                get_f(p, "beta")?,
                get_f(p, "doubling_time")?,
            ),
        )),
        "complication_free_cure" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::complication_free_cure(
                get_f(p, "tcp_val")?,
                get_f(p, "ntcp_val")?,
            ),
        )),
        "isoeffect_dose" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::isoeffect_dose(
                get_f(p, "n1")?,
                get_f(p, "d1")?,
                get_f(p, "alpha_beta")?,
                get_f(p, "n2")?,
            ),
        )),
        "bed_biologically_effective_dose" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::bed_biologically_effective_dose(
                get_f(p, "n")?,
                get_f(p, "d")?,
                get_f(p, "alpha_beta")?,
            ),
        )),
        "eqd2" => Ok(RunOutput::Scalar(bio::radiobiology::fractionation::eqd2(
            get_f(p, "n")?,
            get_f(p, "d")?,
            get_f(p, "alpha_beta")?,
        ))),
        "radio_tumor_control_probability" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::tumor_control_probability(
                get_f(p, "n_clonogens")?,
                get_f(p, "surviving_fraction")?,
            ),
        )),
        "radio_normal_tissue_complication_probability" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::normal_tissue_complication_probability(
                get_f(p, "dose")?,
                get_f(p, "td50")?,
                get_f(p, "gamma50")?,
            ),
        )),
        "incomplete_repair_factor" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::incomplete_repair_factor(
                get_f(p, "delta_t")?,
                get_f(p, "repair_half_time")?,
            ),
        )),
        "repopulation_dose_equivalent" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::repopulation_dose_equivalent(
                get_f(p, "doubling_time")?,
                get_f(p, "treatment_duration")?,
                get_f(p, "alpha")?,
            ),
        )),
        "lq_with_repopulation" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::lq_with_repopulation(
                get_f(p, "alpha")?,
                get_f(p, "beta")?,
                get_f(p, "dose")?,
                get_f(p, "n_fractions")?,
                get_f(p, "treatment_days")?,
                get_f(p, "tp")?,
                get_f(p, "tk")?,
            ),
        )),
        "radio_therapeutic_ratio" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::therapeutic_ratio(
                get_f(p, "tcp")?,
                get_f(p, "ntcp")?,
            ),
        )),
        "fraction_size_optimization" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::fraction_size_optimization(
                get_f(p, "alpha_beta_tumor")?,
                get_f(p, "alpha_beta_normal")?,
            ),
        )),
        "hyperfractionation_advantage" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::hyperfractionation_advantage(
                get_f(p, "d_conventional")?,
                get_f(p, "d_hyper")?,
                get_f(p, "alpha_beta")?,
            ),
        )),
        "radiation_shielding_half_value" => Ok(RunOutput::Scalar(
            bio::radiobiology::shielding::radiation_shielding_half_value(
                get_f(p, "initial_intensity")?,
                get_f(p, "hvl")?,
                get_f(p, "thickness")?,
            ),
        )),
        "shielding_tenth_value" => Ok(RunOutput::Scalar(
            bio::radiobiology::shielding::shielding_tenth_value(
                get_f(p, "initial_intensity")?,
                get_f(p, "tvl")?,
                get_f(p, "thickness")?,
            ),
        )),
        "mass_attenuation" => Ok(RunOutput::Scalar(
            bio::radiobiology::shielding::mass_attenuation(
                get_f(p, "intensity")?,
                get_f(p, "mu_over_rho")?,
                get_f(p, "density")?,
                get_f(p, "thickness")?,
            ),
        )),
        "buildup_factor" => Ok(RunOutput::Scalar(
            bio::radiobiology::shielding::buildup_factor(
                get_f(p, "beam_layers")?,
                get_f(p, "mu")?,
                get_f(p, "thickness")?,
            ),
        )),
        "concrete_shielding_thickness" => Ok(RunOutput::Scalar(
            bio::radiobiology::shielding::concrete_shielding_thickness(
                get_f(p, "dose_rate")?,
                get_f(p, "dose_limit")?,
                get_f(p, "hvl")?,
            ),
        )),
        "lead_equivalent_thickness" => Ok(RunOutput::Scalar(
            bio::radiobiology::shielding::lead_equivalent_thickness(
                get_f(p, "mu_material")?,
                get_f(p, "mu_lead")?,
                get_f(p, "thickness_material")?,
            ),
        )),
        "inverse_square_distance" => Ok(RunOutput::Scalar(
            bio::radiobiology::shielding::inverse_square_distance(
                get_f(p, "dose_at_d1")?,
                get_f(p, "d1")?,
                get_f(p, "d2")?,
            ),
        )),
        "occupancy_factor_dose" => Ok(RunOutput::Scalar(
            bio::radiobiology::shielding::occupancy_factor_dose(
                get_f(p, "dose_unshielded")?,
                get_f(p, "occupancy")?,
                get_f(p, "use_factor")?,
            ),
        )),
        "neutron_shielding_hydrogen" => Ok(RunOutput::Scalar(
            bio::radiobiology::shielding::neutron_shielding_hydrogen(
                get_f(p, "thickness_cm")?,
                get_f(p, "cross_section")?,
                get_f(p, "density_h")?,
            ),
        )),
        "annual_dose_limit_check" => Ok(RunOutput::Scalar(
            bio::radiobiology::shielding::annual_dose_limit_check(
                get_f(p, "dose_received")?,
                get_f(p, "dose_limit")?,
            ),
        )),
        "biologically_effective_dose" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::biologically_effective_dose(
                get_f(p, "n")?,
                get_f(p, "d")?,
                get_f(p, "alpha_beta")?,
            ),
        )),
        "equivalent_dose_2gy" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::equivalent_dose_2gy(
                get_f(p, "bed")?,
                get_f(p, "alpha_beta")?,
            ),
        )),
        "linear_quadratic_survival" => Ok(RunOutput::Scalar(
            bio::radiobiology::dose_response::linear_quadratic_survival(
                get_f(p, "dose")?,
                get_f(p, "alpha")?,
                get_f(p, "beta")?,
            ),
        )),
        "normal_tissue_complication_probability" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::normal_tissue_complication_probability(
                get_f(p, "dose")?,
                get_f(p, "td50")?,
                get_f(p, "gamma50")?,
            ),
        )),
        "therapeutic_ratio" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::therapeutic_ratio(
                get_f(p, "tcp")?,
                get_f(p, "ntcp")?,
            ),
        )),
        "tumor_control_probability" => Ok(RunOutput::Scalar(
            bio::radiobiology::fractionation::tumor_control_probability(
                get_f(p, "n_clonogens")?,
                get_f(p, "surviving_fraction")?,
            ),
        )),
        _ => Err(HubError::InvalidInput(format!("unknown function: {func}"))),
    }
}