/* 03.06.22, 13:20 Norbert Vischer Steady-state of a cell population can be achieved by keeping its volume and cell concentration constant, while the cells are allowed to replicate according to the current growth conditions. To keep cell concentration constant, a portion of the cell suspension is periodically replaced by fresh medium. After changing conditions, it takes a number of generations until the culture is in steady state again. Fig (1) Age distribution of a steady-state population: oldest cells appear with half frequency of youngest cells (exponential relationship) Red line (median, age = 0.415) divides population into two equal areas (orange area represents younger half of all cells) Fig (2) Cumulative plot, i.e. (Fig 1) is integrated assuming population size=1. It shows relation of rank vs age. Rank is here a relative number between 0 and 1. The rank of a cell is its position when sorting the cells for length. The smallest cell has rank=0, the largest has rank=1, the median cell has rank = 0.5. Length of orange line corresponds to orange area in Fig(1) The equation allows to convert age into rank. Fig (3) This is the same as Fig 2 with x and y swapped. The equation (2) is solved for age. Here, we can convert rank into age. (1) Frequency = 2^-Age (2) Rank = 2-2*2^-Age (3) Age = log(1-0.5*rank)/log(0.5) */ nPoints = 100; ageX = 0.414; close("*_"); xValues = newArray(nPoints); yValues1 = newArray(nPoints); yValues2 = newArray(nPoints); yValues3 = newArray(nPoints); for (p = 0; p < nPoints; p++) { age = p/nPoints; xValues[p] = age; freq = pow(2, -age); yValues1[p] = freq; yValues2[p] = 2-2* pow(2, -age); if(age < ageX){ yValues3[p] = freq; last = p; } //age = log(1-0.5*rank)/log(0.5); } yValues3 = Array.trim(yValues3, last+1); Plot.create("(1) Age distribution_", "Age", "(1) Frequency = 2^^-Age^^"); Plot.setFrameSize(400, 250 ); Plot.setColor( "#ddddff"); Plot.setLineWidth(3); Plot.setColor("blue", "#eeeeff"); Plot.add("filled", xValues, yValues1); //Plot.setColor("blue", "#ddddff"); Plot.setColor("blue", "orange"); Plot.add("filled", xValues, yValues3); Plot.setLineWidth(2); Plot.setColor( "red"); Plot.drawLine(ageX, 0.75, ageX, 0); Plot.drawGrid; Plot.setLimits(0, 1, 0, 1); Plot.setAxisLabelSize(18.0, "plain"); Plot.setFontSize(12.0); Plot.show; Plot.create("(2) Cumulative Plot_", "Age", "(2) Rank = 2-2*2^^-Age^^"); Plot.setFrameSize(400, 250 ); Plot.setColor( "#ddddff"); Plot.setLineWidth(3); Plot.setColor("blue", "#eeeeff"); Plot.add("line", xValues, yValues2); Plot.setLineWidth(4); Plot.setColor( "orange"); Plot.drawLine(ageX, 0.5, ageX, 0); Plot.setColor( "#009900"); Plot.drawLine(0, 0.5, ageX, 0.5); Plot.drawGrid; Plot.setLimits(0, 1, 0, 1); Plot.setAxisLabelSize(18.0, "plain"); Plot.setFontSize(12.0); Plot.show; Plot.create("(3) Cumulative Plot swapped_", "Rank", "(3) Age=log(1-0.5*rank)/log(0.5)"); Plot.setFrameSize(400, 250 ); Plot.setColor( "#ddddff"); Plot.setLineWidth(3); Plot.setColor("blue", "#eeeeff"); Plot.add("line", yValues2, xValues); Plot.setLineWidth(4); Plot.setColor( "orange"); Plot.drawLine(0, ageX, 0.5, ageX); Plot.setColor( "#009900"); Plot.drawLine(0.5, 0, 0.5, ageX); Plot.drawGrid; Plot.setLimits(0, 1, 0, 1); Plot.setAxisLabelSize(18.0, "plain"); Plot.setFontSize(12.0); Plot.show;