Exemplo n.º 1
0
        public override async Task <ModelIndividual> MapToModel(SnapshotIndividual individualSnapshot)
        {
            var originData = await _originDataMapper.MapToModel(individualSnapshot.OriginData);

            var individual = _individualFactory.CreateAndOptimizeFor(originData, individualSnapshot.Seed);

            MapSnapshotPropertiesToModel(individualSnapshot, individual);
            await updateIndividualParameters(individualSnapshot, individual);

            var molecules = await _moleculeMapper.MapToModels(individualSnapshot.Molecules, individual);

            molecules?.Each(individual.AddMolecule);
            return(individual);
        }
Exemplo n.º 2
0
        public override async Task <ModelIndividual> MapToModel(SnapshotIndividual individualSnapshot, SnapshotContext snapshotContext)
        {
            var originData = await _originDataMapper.MapToModel(individualSnapshot.OriginData, snapshotContext);

            var individual = _individualFactory.CreateAndOptimizeFor(originData, individualSnapshot.Seed);

            MapSnapshotPropertiesToModel(individualSnapshot, individual);

            await updateIndividualParameters(individualSnapshot, individual, snapshotContext);

            if (snapshotContext.IsV10FormatOrEarlier)
            {
                await convertMoleculesToExpressionProfiles(individualSnapshot, snapshotContext);
            }

            individualSnapshot.ExpressionProfiles?.Each(x =>
            {
                var expressionProfile = snapshotContext.Project.BuildingBlockByName <Model.ExpressionProfile>(x);
                _moleculeExpressionTask.AddExpressionProfile(individual, expressionProfile);
            });

            individual.Icon = individual.Species.Icon;
            return(individual);
        }