コード例 #1
0
        private void exportToFolder(string exportFolder)
        {
            var defaultIndividual = _defaultIndividualRetriever.DefaultHuman();
            var batchSimulation   = new Simulation();

            batchSimulation.Individual = new Individual
            {
                Age        = defaultIndividual.Age,
                Height     = defaultIndividual.MeanHeight,
                Species    = defaultIndividual.Species.Name,
                Population = defaultIndividual.Population.Name,
            };

            batchSimulation.Compounds.Add(new Compound {
                Name = "Standard Molecule", Lipophilicity = 3, FractionUnbound = 0.1, MolWeight = 4E-7, SolubilityAtRefpH = 9999, RefpH = 7
            });
            var intrevanousBolus = new ApplicationProtocol {
                CompoundName = "Standard Molecule", ApplicationType = CoreConstants.Application.Name.IntravenousBolus, Dose = 1, DoseUnit = "mg/kg", DosingInterval = DosingIntervals.Single.ToString()
            };


            batchSimulation.Configuration = new SimulationConfiguration {
                Model = CoreConstants.Model.FourComp
            };
            batchSimulation.ApplicationProtocols.Add(intrevanousBolus);
            var fourCompIvBolusMgPerKg = configurationFrom(batchSimulation);

            batchSimulation.Configuration = new SimulationConfiguration {
                Model = CoreConstants.Model.TwoPores
            };
            var twoPore = configurationFrom(batchSimulation);

            batchSimulation.ApplicationProtocols.Clear();
            intrevanousBolus.DoseUnit = "mg";
            batchSimulation.ApplicationProtocols.Add(intrevanousBolus);
            batchSimulation.Configuration = new SimulationConfiguration {
                Model = CoreConstants.Model.FourComp
            };
            var fourCompIvBolusMg = configurationFrom(batchSimulation);


            twoPore.SpatialStructure.Name  = "Human 2 Pores";
            twoPore.PassiveTransports.Name = "2 Pores Passive Transports";

            fourCompIvBolusMgPerKg.SpatialStructure.Name  = "Human Standard";
            fourCompIvBolusMgPerKg.PassiveTransports.Name = "Standard Passive Transports";
            fourCompIvBolusMgPerKg.EventGroups.Name       = "IV Bolus";
            fourCompIvBolusMgPerKg.Molecules.Name         = "Standard Molecule";
            fourCompIvBolusMgPerKg.Observers.Name         = "Standard Observer";


            fourCompIvBolusMg.EventGroups.Name = "IV Bolus (mg)";

            var defaultCompound = fourCompIvBolusMgPerKg.Molecules.First();

            defaultCompound.Name = string.Empty;
            defaultCompound.Parameter(CoreConstants.Parameter.LIPOPHILICITY).Value     = double.NaN;
            defaultCompound.Parameter(CoreConstants.Parameter.MOLECULAR_WEIGHT).Value  = double.NaN;
            defaultCompound.Parameter(CoreConstants.Parameter.FractionUnbound).Value   = double.NaN;
            defaultCompound.Parameter(CoreConstants.Parameter.SolubilityAtRefpH).Value = double.NaN;

            _moBiExportTask.UpdateObserverForAllFlag(fourCompIvBolusMgPerKg.Observers);

            var buildingBlocks = new IBuildingBlock[]
            {
                twoPore.SpatialStructure, twoPore.PassiveTransports,
                fourCompIvBolusMgPerKg.SpatialStructure, fourCompIvBolusMgPerKg.PassiveTransports, fourCompIvBolusMgPerKg.EventGroups, fourCompIvBolusMgPerKg.Molecules, fourCompIvBolusMgPerKg.Observers,
                fourCompIvBolusMg.EventGroups
            };

            buildingBlocks.Each(bb => saveToPKML(bb, exportFolder));
        }
コード例 #2
0
        private async Task exportToFolder(string exportFolder)
        {
            var project    = new Project();
            var individual = await _snapshotObjectCreator.DefaultIndividual();

            project.Individuals = new[] { individual };

            var compound = await _snapshotObjectCreator.StandardCompound(lipophilicity : 3, fractionUnbound : 0.1, molWeight : 400, name : "Standard Molecule");

            compound.Name     = "Standard Molecule";
            project.Compounds = new[] { compound };

            var intrevanousBolusMgPerKg = await _snapshotObjectCreator.SimpleProtocol(dose : 1, doseUnit : "mg/kg", applicationType : ApplicationTypes.IntravenousBolus);

            var intrevanousBolusMg = await _snapshotObjectCreator.SimpleProtocol(dose : 1, doseUnit : "mg", applicationType : ApplicationTypes.IntravenousBolus);

            project.Protocols = new[] { intrevanousBolusMgPerKg, intrevanousBolusMg };

            var snapshotConfiguration = new SimulationConstruction
            {
                Individual = individual,
                Compounds  = new[] { compound },
                Protocols  = new [] { intrevanousBolusMgPerKg },
                ModelName  = CoreConstants.Model.FourComp,
            };

            var fourCompIvBolusMgPerKg = await configurationFrom(snapshotConfiguration);

            snapshotConfiguration.ModelName = CoreConstants.Model.TwoPores;
            var twoPore = await configurationFrom(snapshotConfiguration);

            snapshotConfiguration.Protocols = new[] { intrevanousBolusMg };
            snapshotConfiguration.ModelName = CoreConstants.Model.FourComp;
            var fourCompIvBolusMg = await configurationFrom(snapshotConfiguration);


            twoPore.SpatialStructure.Name  = "Human 2 Pores";
            twoPore.PassiveTransports.Name = "2 Pores Passive Transports";

            fourCompIvBolusMgPerKg.SpatialStructure.Name  = "Human Standard";
            fourCompIvBolusMgPerKg.PassiveTransports.Name = "Standard Passive Transports";
            fourCompIvBolusMgPerKg.EventGroups.Name       = "IV Bolus";
            fourCompIvBolusMgPerKg.Molecules.Name         = "Standard Molecule";
            fourCompIvBolusMgPerKg.Observers.Name         = "Standard Observer";


            fourCompIvBolusMg.EventGroups.Name = "IV Bolus (mg)";

            var defaultCompound = fourCompIvBolusMgPerKg.Molecules.First();

            defaultCompound.Name = string.Empty;
            defaultCompound.Parameter(CoreConstants.Parameters.LIPOPHILICITY).Value    = double.NaN;
            defaultCompound.Parameter(CoreConstants.Parameters.MOLECULAR_WEIGHT).Value = double.NaN;
            defaultCompound.Parameter(CoreConstants.Parameters.FRACTION_UNBOUND_PLASMA_REFERENCE_VALUE).Value = double.NaN;
            defaultCompound.Parameter(CoreConstants.Parameters.SOLUBILITY_AT_REFERENCE_PH).Value = double.NaN;

            _moBiExportTask.UpdateObserverForAllFlag(fourCompIvBolusMgPerKg.Observers);

            var buildingBlocks = new IBuildingBlock[]
            {
                twoPore.SpatialStructure,
                twoPore.PassiveTransports,
                fourCompIvBolusMgPerKg.SpatialStructure,
                fourCompIvBolusMgPerKg.PassiveTransports,
                fourCompIvBolusMgPerKg.EventGroups,
                fourCompIvBolusMgPerKg.Molecules,
                fourCompIvBolusMgPerKg.Observers,
                fourCompIvBolusMg.EventGroups
            };

            buildingBlocks.Each(bb => saveToPKML(bb, exportFolder));
        }