-
Notifications
You must be signed in to change notification settings - Fork 8
MoleculeProperties Local Parameters from Spatial Structure: How does this work?
Michael Sevestre edited this page Mar 9, 2022
·
1 revision
This is the code in question (Defined in ModelConstructor)
private void addLocalParametersToMolecule(IModel model, IBuildConfiguration buildConfiguration)
{
// retrieve all molecules container defined int the spatial structure
var allMoleculePropertiesContainer = model.Root.GetAllChildren<IContainer>(x => x.IsNamed(Constants.MOLECULE_PROPERTIES)).ToList();
var allPresentMolecules = buildConfiguration.AllPresentXenobioticFloatingMoleculeNames();
var allEndogenous = buildConfiguration.AllPresentEndogenousStationaryMoleculeNames();
foreach (var moleculePropertiesContainer in allMoleculePropertiesContainer)
{
addLocalStructureMoleculeParametersToMoleculeAmount(allPresentMolecules, moleculePropertiesContainer, buildConfiguration, model,
x => !isEndogenousParameter(x));
addLocalStructureMoleculeParametersToMoleculeAmount(allEndogenous, moleculePropertiesContainer, buildConfiguration, model,
isEndogenousParameter);
// remove the molecule properties container only used as template
moleculePropertiesContainer.ParentContainer.RemoveChild(moleculePropertiesContainer);
}
}
private static bool isEndogenousParameter(IParameter parameter)
{
return parameter.NameIsOneOf(Constants.ONTOGENY_FACTOR, Constants.HALF_LIFE, Constants.DEGRADATION_COEFF);
}
In short: We have two specific set of molecules for which we copy parameters
Drugs Floating (Xenobiotic, Floating) or allPresentMolecules
We copy everything except only ONTOGENY_FACTOR, HALF_LIFE, DEGRADATION_COEFF
For Endogenous non floating or allEndogenous
(such as Enzyme etc)
We only ONTOGENY_FACTOR, HALF_LIFE, DEGRADATION_COEFF
I