From 53060dabd7eea7e55522fa51736e16699e6dcbaf Mon Sep 17 00:00:00 2001 From: Dan Vasilescu Date: Tue, 8 Oct 2024 16:39:23 -0400 Subject: [PATCH] Site location initialization for membrane molecules --- .../vcell/mapping/SpeciesContextSpec.java | 61 +++++++++++++++---- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/vcell-core/src/main/java/cbit/vcell/mapping/SpeciesContextSpec.java b/vcell-core/src/main/java/cbit/vcell/mapping/SpeciesContextSpec.java index a84f4ccaac..180fed64f1 100644 --- a/vcell-core/src/main/java/cbit/vcell/mapping/SpeciesContextSpec.java +++ b/vcell-core/src/main/java/cbit/vcell/mapping/SpeciesContextSpec.java @@ -69,6 +69,7 @@ public class SpeciesContextSpec implements Matchable, ScopedSymbolTable, Seriali public static final String PARAMETER_NAME_PROXY_PARAMETERS = "proxyParameters"; private static final String PROPERTY_NAME_WELL_MIXED = "wellMixed"; private static final String PROPERTY_NAME_FORCECONTINUOUS = "forceContinuous"; + private static final int INITIAL_YZ_SITE_OFFSET = 4; public static final boolean TrackClusters = true; // SpringSaLaD specific public static final boolean InitialLocationRandom = true; @@ -754,24 +755,62 @@ public void initializeForSpringSaLaD(MolecularType molecularType) { oldMcpSet.clear(); // step 3.4: we add any new instance of authoritative mcp not there yet, and we initialize with default sas - int componentCount = 0; - for (MolecularComponent mc : componentList) { + boolean isMmembraneMolecule = false; + boolean hasAnchor = false; + int anchorIndex = 0; + if(getSpeciesContext().getStructure().getName().equals(Structure.SpringStructureEnum.Membrane.columnName)) { + isMmembraneMolecule = true; + // in a membrane molecule, we arrange Sites left to the anchor as located in Extracellular, + // the Anchor site is on the Membrane, + // the sites right to the anchor are to be initialized as located in Intracellular + for (int count = 0; count anchorIndex) { // Intracellular + Structure struct = getSimulationContext().getModel().getStructure(Structure.SpringStructureEnum.Intracellular.columnName); + sas = new SiteAttributesSpec(this, mcp, struct); + } else { // Anchor, the only site located on the Membrane + Structure struct = getSimulationContext().getModel().getStructure(Structure.SpringStructureEnum.Membrane.columnName); + sas = new SiteAttributesSpec(this, mcp, struct); + } + } else { sas = new SiteAttributesSpec(this, mcp, getSpeciesContext().getStructure()); - if(initialPass == true) { - Coordinate coordinate = new Coordinate(0, 0, (componentCount+1)*4); - sas.setCoordinate(coordinate); - NamedColor nextColor = Colors.COLORARRAY[componentCount]; - sas.setColor(nextColor); + } + if(initialPass == true) { + Coordinate coordinate = new Coordinate(0, INITIAL_YZ_SITE_OFFSET, INITIAL_YZ_SITE_OFFSET + (componentCount * 4)); + sas.setCoordinate(coordinate); + NamedColor nextColor; + if(componentCount == anchorIndex) { + nextColor = Colors.DARKGRAY; + } else { + nextColor = Colors.COLORARRAY[componentCount]; } - siteAttributesMap.put(mcp, sas); + sas.setColor(nextColor); + } else { // if this is a new site added to an existing molecule, the existing sites already have + ; // attributes (like coordinates, diffusion rates, colors) and links. + // We cannot guess how the user will want to deal with the new site. } - componentCount++; + siteAttributesMap.put(mcp, sas); } // at this point the siteAttributesMap should be fully reconstructed