test_class.file: singa-simulation/src/test/java/bio/singa/simulation/model/modules/qualitative/implementations/ClathrinMediatedEndocytosisTest.java
test_class.identifier: ClathrinMediatedEndocytosisTest
test_case.body: @Test
      void testEndocytosis() {
  
          ComparableQuantity<Length> systemExtend = Quantities.getQuantity(0.5, MICRO(METRE));
          Environment.setSystemExtend(systemExtend);
          Environment.setSimulationExtend(100);
          Environment.setNodeSpacingToDiameter(systemExtend, 1);
  
          ComparableQuantity<Time> timeStep = Quantities.getQuantity(1, MILLI(SECOND));
          UnitRegistry.setTime(timeStep);
  
          ChemicalEntity primaryCargo = SimpleEntity.create("PRIMARY_CARGO")
                  .membraneBound()
                  .build();
  
          ChemicalEntity otherCargo = SimpleEntity.create("OTHER_CARGO")
                  .membraneBound()
                  .build();
  
          ChemicalEntity inhibitor = SimpleEntity.create("INHIBITOR")
                  .membraneBound()
                  .build();
  
          ChemicalEntity accelerator = SimpleEntity.create("ACCELERATOR")
                  .membraneBound()
                  .build();
  
          ChemicalEntity initializedCargo = SimpleEntity.create("INITIALIZED_CARGO")
                  .membraneBound()
                  .build();
  
          ChemicalEntity substrate = SimpleEntity.create("SUBSTRATE").build();
          ChemicalEntity product = SimpleEntity.create("PRODUCT").build();
          ChemicalEntity enzyme = SimpleEntity.create("ENZYME")
                  .membraneBound()
                  .build();
  
          Simulation simulation = new Simulation();
          simulation.setMaximalTimeStep(Quantities.getQuantity(5, MILLI(SECOND)));
  
          // define graphs
          AutomatonGraph graph = AutomatonGraphs.singularGraph();
          AutomatonNode node = graph.getNode(0, 0);
          node.setPosition(new Vector2D(50.0, 50.0));
          node.setCellRegion(CellRegions.CELL_OUTER_MEMBRANE_REGION);
          simulation.setGraph(graph);
  
          ConcentrationBuilder.create(simulation)
                  .entity(primaryCargo)
                  .topology(MEMBRANE)
                  .concentrationValue(10)
                  .microMolar()
                  .onlyNodes()
                  .build();
  
          ConcentrationBuilder.create(simulation)
                  .entity(otherCargo)
                  .topology(MEMBRANE)
                  .concentrationValue(1)
                  .microMolar()
                  .onlyNodes()
                  .build();
  
          ConcentrationBuilder.create(simulation)
                  .entity(accelerator)
                  .topology(MEMBRANE)
                  .concentrationValue(1)
                  .microMolar()
                  .onlyNodes()
                  .build();
  
          ConcentrationBuilder.create(simulation)
                  .entity(inhibitor)
                  .topology(MEMBRANE)
                  .concentrationValue(0.05)
                  .microMolar()
                  .onlyNodes()
                  .build();
  
          InitialConcentration initializedConcentration = ConcentrationBuilder.create()
                  .entity(initializedCargo)
                  .topology(MEMBRANE)
                  .concentrationValue(10)
                  .microMolar()
                  .build();
  
          // add vesicle layer
          VesicleLayer vesicleLayer = new VesicleLayer(simulation);
          simulation.setVesicleLayer(vesicleLayer);
  
          // setup membrane
          List<Membrane> membranes = MembraneTracer.regionsToMembrane(graph);
          MembraneLayer membraneLayer = new MembraneLayer();
          membraneLayer.addMembranes(membranes);
          simulation.setMembraneLayer(membraneLayer);
  
  //         microtubule organizing centre
          MicrotubuleOrganizingCentre moc = new MicrotubuleOrganizingCentre(membraneLayer, new Circle(new Vector2D(50, 90),
                  Environment.convertSystemToSimulationScale(Quantities.getQuantity(50, NANO(METRE)))));
          membraneLayer.setMicrotubuleOrganizingCentre(moc);
  
          ComparableQuantity<FirstOrderRate> kf_endoAddition = Quantities.getQuantity(0.03, ONE.divide(SECOND)
                  .asType(FirstOrderRate.class));
  
          Quantity<MolarConcentration> checkpointConcentration = UnitRegistry.concentration(MolarConcentration.moleculesToConcentration(400));
  
          RateConstant k_on = RateConstant.create(0.1)
                  .forward().secondOrder()
                  .concentrationUnit(MICRO_MOLE_PER_LITRE)
                  .timeUnit(SECOND)
                  .build();
  
          RateConstant k_off = RateConstant.create(1)
                  .backward().firstOrder()
                  .timeUnit(SECOND)
                  .build();
  
          RateConstant k_cat = RateConstant.create(1)
                  .forward().firstOrder()
                  .timeUnit(SECOND)
                  .build();
  
          ReactionBuilder.FinalStep binding = ReactionBuilder.ruleBased(simulation)
                  .rule(ReactionChainBuilder.bind(substrate)
                          .to(enzyme)
                          .considerInversion()
                          .identifier("binding")
                          .build())
                  .reversible()
                  .forwardReactionRate(k_on)
                  .backwardReactionRate(k_off);
  
          ReactionBuilder.FinalStep catalysis = ReactionBuilder.ruleBased(simulation)
                  .rule(ReactionChainBuilder.add(product)
                          .to(enzyme)
                          .condition(CandidateConditionBuilder.hasOneOfEntity(substrate))
                          .and()
                          .remove(substrate)
                          .from(enzyme)
                          .and()
                          .release(product)
                          .from(enzyme)
                          .identifier("catalysis")
                          .build())
                  .irreversible()
                  .rate(k_cat);
  
          ReactionBuilder.generateNetwork();
  
          // clathrin mediated endocytosis
          ClathrinMediatedEndocytosis endocytosis = new ClathrinMediatedEndocytosis();
          endocytosis.limitPitsToOneAtATime();
          endocytosis.setIdentifier("endocytosis");
          endocytosis.setFeature(new AffectedRegion(CellRegions.CELL_OUTER_MEMBRANE_REGION));
          endocytosis.setFeature(new PitFormationRate(Quantities.getQuantity(4, PER_SQUARE_NANOMETRE_PER_SECOND)));
          endocytosis.setFeature(new VesicleRadius(Quantities.getQuantity(50.0, NANO(METRE))));
          endocytosis.setFeature(new EndocytosisCheckpointTime(Quantities.getQuantity(30.0, SECOND)));
          endocytosis.setFeature(new EndocytosisCheckpointConcentration(checkpointConcentration));
          endocytosis.setFeature(PrimaryCargoes.of(primaryCargo).build());
          Cargoes cargoes = Cargoes.of(primaryCargo, otherCargo, EntityRegistry.matchExactly("ENZYME")).build();
          endocytosis.setFeature(cargoes);
          endocytosis.setFeature(new MaturationTime(Quantities.getQuantity(50.0, SECOND)));
          endocytosis.setFeature(new InitialConcentrations(Collections.singletonList(initializedConcentration)));
          simulation.addModule(endocytosis);
  
          // pit addition
          EndocytoticPitAbsorption.inSimulation(simulation)
                  .forAllEntities(cargoes.getContent())
                  .acceleratingEntity(accelerator)
                  .inhibitingEntity(inhibitor)
                  .rate(kf_endoAddition)
                  .build();
  
          ConcentrationBuilder.create(simulation)
                  .entity(EntityRegistry.matchExactly("SUBSTRATE"))
                  .topology(INNER)
                  .concentrationValue(10)
                  .microMolar()
                  .build();
  
          ConcentrationBuilder.create(simulation)
                  .entity(EntityRegistry.matchExactly("ENZYME"))
                  .topology(MEMBRANE)
                  .concentrationValue(1)
                  .microMolar()
                  .build();
  
          binding.build();
          catalysis.build();
  
          simulation.nextEpoch();
  
          EndocytoticPit pit = vesicleLayer.getAspiringPits().get(0);
          System.out.println("initialized concentrations");
          printConcentrations(pit);
          System.out.println();
          printConcentrations(node);
  
          while (TimeStepManager.getElapsedTime().isLessThanOrEqualTo(Quantities.getQuantity(32, SECOND))) {
              simulation.nextEpoch();
              // System.out.println(TimeFormatter.formatTime(simulation.getElapsedTime()) + " " + MolarConcentration.concentrationToMolecules(pit.getConcentrationContainer().get(MEMBRANE, primaryCargo)));
          }
  
          // check if threshold has been reached
          System.out.println(MolarConcentration.concentrationToMolecules(pit.getConcentrationContainer().get(MEMBRANE, primaryCargo)));
          assertTrue(UnitRegistry.concentration(pit.getConcentrationContainer().get(MEMBRANE, primaryCargo)).getValue().doubleValue() >= checkpointConcentration.getValue().doubleValue());
  
          while (TimeStepManager.getElapsedTime().isLessThanOrEqualTo(Quantities.getQuantity(85, SECOND))) {
              simulation.nextEpoch();
          }
  
          List<Vesicle> vesicles = vesicleLayer.getVesicles();
          assertEquals(1, vesicles.size());
  
          Vesicle vesicle = vesicles.get(0);
          System.out.println(TimeFormatter.formatTime(TimeStepManager.getElapsedTime()));
          printConcentrations(vesicle);
          System.out.println();
          printConcentrations(node);
  
          assertTrue(400 < MolarConcentration.concentrationToMolecules(vesicle.getConcentrationContainer()
                  .get(CellRegions.VESICLE_REGION.getMembraneSubsection(), initializedCargo)).getValue().intValue());
  
          assertEquals(10, UnitRegistry.concentration(vesicle.getConcentrationContainer()
                  .get(MEMBRANE, initializedCargo)).to(MICRO_MOLE_PER_LITRE).getValue().doubleValue());
      }
test_case.class_method_signature: ClathrinMediatedEndocytosisTest.testEndocytosis()
test_case.full_signature: @Test void testEndocytosis()
test_case.identifier: testEndocytosis
test_case.invocations: getQuantity MICRO setSystemExtend setSimulationExtend setNodeSpacingToDiameter getQuantity MILLI setTime build membraneBound create build membraneBound create build membraneBound create build membraneBound create build membraneBound create build create build create build membraneBound create setMaximalTimeStep getQuantity MILLI singularGraph getNode setPosition setCellRegion setGraph build onlyNodes microMolar concentrationValue topology entity create build onlyNodes microMolar concentrationValue topology entity create build onlyNodes microMolar concentrationValue topology entity create build onlyNodes microMolar concentrationValue topology entity create build microMolar concentrationValue topology entity create setVesicleLayer regionsToMembrane addMembranes setMembraneLayer convertSystemToSimulationScale getQuantity NANO setMicrotubuleOrganizingCentre getQuantity asType divide concentration moleculesToConcentration build timeUnit concentrationUnit secondOrder forward create build timeUnit firstOrder backward create build timeUnit firstOrder forward create backwardReactionRate forwardReactionRate reversible rule ruleBased build identifier considerInversion to bind rate irreversible rule ruleBased build identifier from release and from remove and condition to add hasOneOfEntity generateNetwork limitPitsToOneAtATime setIdentifier setFeature setFeature getQuantity setFeature getQuantity NANO setFeature getQuantity setFeature setFeature build of build of matchExactly setFeature setFeature getQuantity setFeature singletonList addModule build rate inhibitingEntity acceleratingEntity forAllEntities inSimulation getContent build microMolar concentrationValue topology entity create matchExactly build microMolar concentrationValue topology entity create matchExactly build build nextEpoch get getAspiringPits println printConcentrations println printConcentrations isLessThanOrEqualTo getElapsedTime getQuantity nextEpoch println concentrationToMolecules get getConcentrationContainer assertTrue doubleValue getValue concentration get getConcentrationContainer doubleValue getValue isLessThanOrEqualTo getElapsedTime getQuantity nextEpoch getVesicles assertEquals size get println formatTime getElapsedTime printConcentrations println printConcentrations assertTrue intValue getValue concentrationToMolecules get getConcentrationContainer getMembraneSubsection assertEquals doubleValue getValue to concentration get getConcentrationContainer
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEndocytosis()
focal_class.declarator: logger = LoggerFactory.getLogger(ClathrinMediatedEndocytosis.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(ClathrinMediatedEndocytosis.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: vesicleLayer
focal_class.modifier: private
focal_class.original_string: private VesicleLayer vesicleLayer;
focal_class.type: VesicleLayer
focal_class.var_name: vesicleLayer
focal_class.declarator: segments
focal_class.modifier: private
focal_class.original_string: private List<MembraneSegment> segments;
focal_class.type: List<MembraneSegment>
focal_class.var_name: segments
focal_class.declarator: preAspiringPits
focal_class.modifier: private
focal_class.original_string: private List<EndocytoticPit> preAspiringPits;
focal_class.type: List<EndocytoticPit>
focal_class.var_name: preAspiringPits
focal_class.declarator: preMaturingPits
focal_class.modifier: private
focal_class.original_string: private List<EndocytoticPit> preMaturingPits;
focal_class.type: List<EndocytoticPit>
focal_class.var_name: preMaturingPits
focal_class.declarator: maturedPits
focal_class.modifier: private
focal_class.original_string: private List<EndocytoticPit> maturedPits;
focal_class.type: List<EndocytoticPit>
focal_class.var_name: maturedPits
focal_class.declarator: abortedPits
focal_class.modifier: private
focal_class.original_string: private List<EndocytoticPit> abortedPits;
focal_class.type: List<EndocytoticPit>
focal_class.var_name: abortedPits
focal_class.declarator: pitRegion
focal_class.modifier: private
focal_class.original_string: private CellRegion pitRegion;
focal_class.type: CellRegion
focal_class.var_name: pitRegion
focal_class.declarator: limitPits = false
focal_class.modifier: private
focal_class.original_string: private boolean limitPits = false;
focal_class.type: boolean
focal_class.var_name: limitPits
focal_class.file: singa-simulation/src/main/java/bio/singa/simulation/model/modules/qualitative/implementations/ClathrinMediatedEndocytosis.java
focal_class.identifier: ClathrinMediatedEndocytosis
focal_class.class_method_signature: ClathrinMediatedEndocytosis.ClathrinMediatedEndocytosis()
focal_class.full_signature: public  ClathrinMediatedEndocytosis()
focal_class.identifier: ClathrinMediatedEndocytosis
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  ClathrinMediatedEndocytosis()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.limitPitsToOneAtATime()
focal_class.full_signature:  void limitPitsToOneAtATime()
focal_class.identifier: limitPitsToOneAtATime
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void limitPitsToOneAtATime()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.initialize()
focal_class.full_signature: @Override public void initialize()
focal_class.identifier: initialize
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void initialize()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.initializeMembraneRegion(CellRegion region)
focal_class.full_signature: private void initializeMembraneRegion(CellRegion region)
focal_class.identifier: initializeMembraneRegion
focal_class.modifiers: private
focal_class.parameters: (CellRegion region)
focal_class.return: void
focal_class.signature: void initializeMembraneRegion(CellRegion region)
focal_class.class_method_signature: ClathrinMediatedEndocytosis.initializePitRegion(CellRegion region)
focal_class.full_signature: private void initializePitRegion(CellRegion region)
focal_class.identifier: initializePitRegion
focal_class.modifiers: private
focal_class.parameters: (CellRegion region)
focal_class.return: void
focal_class.signature: void initializePitRegion(CellRegion region)
focal_class.class_method_signature: ClathrinMediatedEndocytosis.calculateUpdates()
focal_class.full_signature: @Override public void calculateUpdates()
focal_class.identifier: calculateUpdates
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void calculateUpdates()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.optimizeTimeStep()
focal_class.full_signature: public void optimizeTimeStep()
focal_class.identifier: optimizeTimeStep
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void optimizeTimeStep()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.onReset()
focal_class.full_signature: @Override public void onReset()
focal_class.identifier: onReset
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void onReset()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.onCompletion()
focal_class.full_signature: @Override public void onCompletion()
focal_class.identifier: onCompletion
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void onCompletion()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.prepareAspiringPits()
focal_class.full_signature: private void prepareAspiringPits()
focal_class.identifier: prepareAspiringPits
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void prepareAspiringPits()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.initializeAspiringPit(MembraneSegment segment)
focal_class.full_signature: private void initializeAspiringPit(MembraneSegment segment)
focal_class.identifier: initializeAspiringPit
focal_class.modifiers: private
focal_class.parameters: (MembraneSegment segment)
focal_class.return: void
focal_class.signature: void initializeAspiringPit(MembraneSegment segment)
focal_class.class_method_signature: ClathrinMediatedEndocytosis.spawnAspiringPits()
focal_class.full_signature: private void spawnAspiringPits()
focal_class.identifier: spawnAspiringPits
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void spawnAspiringPits()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.prepareMaturePits()
focal_class.full_signature: private void prepareMaturePits()
focal_class.identifier: prepareMaturePits
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void prepareMaturePits()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.spawnMaturingPits()
focal_class.full_signature: private void spawnMaturingPits()
focal_class.identifier: spawnMaturingPits
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void spawnMaturingPits()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.spawnVesicles()
focal_class.full_signature: private void spawnVesicles()
focal_class.identifier: spawnVesicles
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void spawnVesicles()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.initializeCargo(Vesicle vesicle, EndocytoticPit maturedPit)
focal_class.full_signature: private void initializeCargo(Vesicle vesicle, EndocytoticPit maturedPit)
focal_class.identifier: initializeCargo
focal_class.modifiers: private
focal_class.parameters: (Vesicle vesicle, EndocytoticPit maturedPit)
focal_class.return: void
focal_class.signature: void initializeCargo(Vesicle vesicle, EndocytoticPit maturedPit)
focal_class.class_method_signature: ClathrinMediatedEndocytosis.checkPitState()
focal_class.full_signature: private void checkPitState()
focal_class.identifier: checkPitState
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void checkPitState()
focal_class.class_method_signature: ClathrinMediatedEndocytosis.abortPits()
focal_class.full_signature: private void abortPits()
focal_class.identifier: abortPits
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void abortPits()
focal_class.superclass: extends QualitativeModule
focal_method.body: void limitPitsToOneAtATime() {
          limitPits = true;
      }
focal_method.class_method_signature: ClathrinMediatedEndocytosis.limitPitsToOneAtATime()
focal_method.full_signature:  void limitPitsToOneAtATime()
focal_method.identifier: limitPitsToOneAtATime
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void limitPitsToOneAtATime()