public void SetDefaultSettingsForTransporter(IndividualTransporter transporter, string species, string transporterName)
        {
            transporter.TransportType = _transporterContainerTemplateRepository.TransportTypeFor(species, transporterName);

            foreach (var transporterContainer in transporter.AllExpressionsContainers())
            {
                //there is a db template
                var tranporterTemplate = _transporterContainerTemplateRepository.TransportersFor(species, transporterContainer.Name, transporterName).FirstOrDefault();
                if (tranporterTemplate != null)
                {
                    transporterContainer.UpdatePropertiesFrom(tranporterTemplate);
                }
                else
                {
                    UpdateTransporterFromTemplate(transporterContainer, species, MembraneLocationToUse(transporterContainer, transporter.TransportType), transporter.TransportType);
                }
            }

            if (_transporterContainerTemplateRepository.HasTransporterTemplateFor(species, transporterName))
            {
                return;
            }

            //No template was found for the given name. Raise event warning
            _eventPublisher.PublishEvent(new NoTranporterTemplateAvailableEvent(transporter));
        }
        public TransporterExpressionDTO MapFrom(IndividualTransporter transporter)
        {
            var transporterExpressionDTO = new TransporterExpressionDTO(transporter);

            foreach (var transporterExpressionContainer in transporter.AllExpressionsContainers())
            {
                addContainerExpression(transporterExpressionDTO, transporter, transporterExpressionContainer);
            }
            return(transporterExpressionDTO);
        }
示例#3
0
        public override void Execute(IExecutionContext context)
        {
            var transportContainerUpdater = context.Resolve <ITransportContainerUpdater>();

            Add(new SetTransportTypeInTransporterCommand(_individualTransporter, NewTransportType, context));

            //Check if a template is available for the given container. If yes, we're good to go and can create a change transporter type command
            //we need to retrieve the process name for the given MembraneTupe/Process Type combo
            foreach (var transporterContainer in _individualTransporter.AllExpressionsContainers())
            {
                var membraneLocationToUse = transportContainerUpdater.MembraneLocationToUse(transporterContainer, NewTransportType);

                //change transport type
                Add(new SetTransportTypeCommand(transporterContainer, OldTransportType, NewTransportType, membraneLocationToUse, context));
            }

            //now execute all commands
            base.Execute(context);

            //clear references
            _individualTransporter = null;
            _individual            = null;
        }
示例#4
0
 private TransporterExpressionContainer transporterContainerFrom(TransporterExpressionContainerDTO transporterExpressionContainerDTO)
 {
     return(_transporter.AllExpressionsContainers().FindByName(transporterExpressionContainerDTO.ContainerName));
 }
示例#5
0
 private static void validateTransporterMembrane(IndividualTransporter transporter, MembraneLocation membraneLocation)
 {
     CoreConstants.Compartment.LiverZones.Each(z => transporter.AllExpressionsContainers().FindByName(z).MembraneLocation.ShouldBeEqualTo(membraneLocation));
 }