@@ -200,13 +200,13 @@ public void step(MersenneTwisterFast random, Simulation sim) {
200200 super .step (random , sim );
201201 ((PottsCellFly ) cell ).setProspero (((PottsCellFly ) cell ).getProspero () + prosperoRate );
202202 ((PottsCellFly ) cell ).setDeadpan (((PottsCellFly ) cell ).getDeadpan () + deadpanRate );
203- System .out .println (
204- "Stem ID "
205- + cell .getID ()
206- + " prospero: "
207- + ((PottsCellFly ) cell ).getProspero ()
208- + ", deadpan: "
209- + ((PottsCellFly ) cell ).getDeadpan ());
203+ // System.out.println(
204+ // "Stem ID "
205+ // + cell.getID()
206+ // + " prospero: "
207+ // + ((PottsCellFly) cell).getProspero()
208+ // + ", deadpan: "
209+ // + ((PottsCellFly) cell).getDeadpan());
210210 }
211211
212212 @ Override
@@ -257,7 +257,8 @@ public void addCell(MersenneTwisterFast random, Simulation sim) {
257257 random ,
258258 divisionPlane .getUnitNormalVector (),
259259 daughterProspero ,
260- daughterDeadpan );
260+ daughterDeadpan ,
261+ parentDeadpan - daughterDeadpan );
261262 }
262263 }
263264
@@ -446,29 +447,25 @@ private boolean daughterStemRuleBasedDifferentiation(
446447 PottsLocation loc2 ,
447448 double daughterProspero ,
448449 double daughterDeadpan ) {
449- if (((PottsCellFlyStem ) cell ).getStemType () == StemType .WT ) {
450- return false ;
451- } else if (((PottsCellFlyStem ) cell ).getStemType () == StemType .MUDMUT ) {
452- if (differentiationRuleset .equals ("volume" )) {
453- double vol1 = loc1 .getVolume ();
454- double vol2 = loc2 .getVolume ();
455- if (Math .abs (vol1 - vol2 ) < range ) {
456- return true ;
457- } else {
458- return false ;
459- }
460- } else if (differentiationRuleset .equals ("location" )) {
461- double [] centroid1 = loc1 .getCentroid ();
462- double [] centroid2 = loc2 .getCentroid ();
463- return (centroidsWithinRangeAlongApicalAxis (
464- centroid1 , centroid2 , ((PottsCellFlyStem ) cell ).getApicalAxis (), range ));
465- } else if (differentiationRuleset .equals ("tfRatio" )) {
466- System .out .println ("WOO: Prospero comparison branch reached" );
467- if (daughterDeadpan <= 0 ) {
468- return daughterProspero <= 0 ;
469- }
470- return (daughterProspero / daughterDeadpan ) <= tfRatio ;
450+ if (differentiationRuleset .equals ("volume" )) {
451+ double vol1 = loc1 .getVolume ();
452+ double vol2 = loc2 .getVolume ();
453+ if (Math .abs (vol1 - vol2 ) < range ) {
454+ return true ;
455+ } else {
456+ return false ;
457+ }
458+ } else if (differentiationRuleset .equals ("location" )) {
459+ double [] centroid1 = loc1 .getCentroid ();
460+ double [] centroid2 = loc2 .getCentroid ();
461+ return (centroidsWithinRangeAlongApicalAxis (
462+ centroid1 , centroid2 , ((PottsCellFlyStem ) cell ).getApicalAxis (), range ));
463+ } else if (differentiationRuleset .equals ("tfRatio" )) {
464+ System .out .println ("WOO: Prospero comparison branch reached" );
465+ if (daughterDeadpan <= 0 ) {
466+ return daughterProspero <= 0 ;
471467 }
468+ return (daughterProspero / daughterDeadpan ) <= tfRatio ;
472469 }
473470 throw new IllegalArgumentException (
474471 "Invalid differentiation ruleset: " + differentiationRuleset );
@@ -604,8 +601,23 @@ private void makeDaughterGMC(
604601 MersenneTwisterFast random ,
605602 Vector divisionPlaneNormal ,
606603 double daughterProspero ,
607- double daughterDeadpan ) {
608- Location gmcLoc = determineGMCLocation (parentLoc , daughterLoc , divisionPlaneNormal );
604+ double daughterDeadpan ,
605+ double parentDeadpan ) {
606+ Location gmcLoc =
607+ determineGMCLocation (
608+ parentLoc ,
609+ daughterLoc ,
610+ divisionPlaneNormal ,
611+ daughterDeadpan ,
612+ parentDeadpan );
613+
614+ if (differentiationRuleset .equals ("tfRatio" ) && daughterDeadpan > 0 && daughterProspero >= tfRatio * daughterDeadpan ) {
615+ if (gmcLoc == daughterLoc && daughterDeadpan > parentDeadpan ) {
616+ throw new IllegalStateException ("tfRatio GMC division Prospero to Deadpan ratio assertion failed" );
617+ } else if (gmcLoc == parentLoc && parentDeadpan > daughterDeadpan ) {
618+ throw new IllegalStateException ("tfRatio GMC division Prospero to Deadpan ratio assertion failed" );
619+ }
620+ }
609621
610622 if (parentLoc == gmcLoc ) {
611623 PottsLocation .swapVoxels (parentLoc , daughterLoc );
@@ -740,16 +752,19 @@ public Vector getDaughterCellApicalAxis(MersenneTwisterFast random) {
740752 * @return the location that should be the GMC
741753 */
742754 private Location determineGMCLocation (
743- PottsLocation parentLoc , PottsLocation daughterLoc , Vector divisionPlaneNormal ) {
755+ PottsLocation parentLoc ,
756+ PottsLocation daughterLoc ,
757+ Vector divisionPlaneNormal ,
758+ double daughterDeadpan ,
759+ double parentDeadpan ) {
744760 switch (differentiationRuleset ) {
745761 case "volume" :
746762 return getSmallerLocation (parentLoc , daughterLoc );
747763 case "location" :
748764 return getBasalLocation (parentLoc , daughterLoc , divisionPlaneNormal );
749765 case "tfRatio" :
750- return getSmallerLocation (
751- parentLoc ,
752- daughterLoc ); // TODO: Ask Sophia which location makes more biological sense
766+ return getLowerDeadpanLocation (
767+ parentLoc , parentDeadpan , daughterLoc , daughterDeadpan );
753768 default :
754769 throw new IllegalArgumentException (
755770 "Invalid differentiation ruleset: " + differentiationRuleset );
@@ -811,6 +826,20 @@ public static PottsLocation getBasalLocation(
811826 return (proj1 < proj2 ) ? loc2 : loc1 ; // higher projection = more basal
812827 }
813828
829+ /**
830+ * Gets the location with lower Deadpan and returns it.
831+ *
832+ * @param loc1 the {@link PottsLocation} to compare.
833+ * @param deadpan1 the amount of deadpan in loc1.
834+ * @param loc2 {@link PottsLocation} to compare.
835+ * @param deadpan2 the amount of deadpan in loc2.
836+ * @return the smaller location.
837+ */
838+ public static Location getLowerDeadpanLocation (
839+ Location loc1 , double deadpan1 , Location loc2 , double deadpan2 ) {
840+ return (deadpan2 - deadpan1 <= EPSILON ) ? loc2 : loc1 ;
841+ }
842+
814843 public HashSet <PottsCellFlyStem > getNBsInSimulation (Simulation sim ) {
815844 HashSet <PottsCellFlyStem > nbsInSimulation = new HashSet <>();
816845 Bag simObjects = sim .getGrid ().getAllObjects ();
0 commit comments