Calculate and add dose range based on provided valuesI am building a script to import and analyze raw sample data generated in a bioassay.
For this, it is necessary to identify reference data and sample data and to set the corresponding dose range.
In my script I included a ‘sample info’ pop-up window in which operators can identify sample locations (Row x + x) and enter the desired dose-range for these samples. And this is where my struggle comes in!

The sample names are correctly added to the data table, but how do I get the dose points based on entered values in there?
The script should be able to calculate each dose point based on a starting concentration and dilution factor.
What I want it to look like (see 'Dose' column, manually entered for this example):

Any suggestions?
I am working in JMP 18, my script for the sample info pop up so far:
nw = New Window( "Sample info", << Modal,
H List Box(
Panel Box( "Enter Sample names",
V List Box(
Text Box( "Row A+E" ),
AE = Text Edit Box( "", << Set Width( 200 ) ),
Text Box( "Row B+F" ),
BF = val2 = Text Edit Box( "", << Set Width( 200 ) ),
Text Box( "Row C+G" ),
CG = val3 = Text Edit Box( "", << Set Width( 200 ) ),
Text Box( "Row D+H" ),
DH = val4 = Text Edit Box( "", << Set Width( 200 ) );
)
),
Spacer Box( Size( 10, 10 ) ),
V List Box(
Panel Box("Calculate dosepoints",
V List Box(
Text Box( "Start Conc. (ng/mL)" ),
Conc = Number Edit Box( ),
Text Box( "n Dosepoints" ),
nDP = Number Edit Box( 12 ),
Text Box( "Factor" ),
xF = Number Edit Box( 0.2 ),
)
),
Spacer Box( Size( , 8 ) ),
H List Box(
Spacer Box( Size( 77, 1 ) ),
Button Box("Ok",
val1 = AE << Get text ();
val2 = BF << Get text ();
val3 = CG << Get text ();
val4 = DH << Get text ();
val5 = Conc << Get ();
val6 = nDP << Get ();
val7 = xF << Get ();
Current Data Table() << New Column( "Sample", Character, "Nominal",
Formula(
Match( :Row,
"A", val1,
"E", val1,
"B", val2,
"F", val2,
"C", val3,
"G", val3,
"D", val4,
"H", val4
)
)
);
Current Data Table() << New Column( "Dose", Character, "Nominal",
//Formula( ????
// )
),
)
)
)
)
);I have added an example Data table in which the above script should work.
Automation and ScriptingData Exploration and VisualizationRe: Calculate and add dose range based on provided valuesMaybe something like this
Eval(EvalExpr(
dt << New Column("R", Numeric, Continuous, Formula(
Expr(start_conc)/ Expr(factor) ^ (Col Number(:Sample, :Sample) - Col Cumulative Sum(1, :Sample))
));
));
Re: Calculate and add dose range based on provided valuesAlmost!
I adapted your script a little and was able to calculate the right dose range for 1 of the replicates! (see attachment). The other replicate should have the same values (i.e. 20.000 - 0.0004 ) but instead keeps dividing the last result of replicate 2.
So, for Sample 'RS', located in Row A (replicate 1) and E (replicate 2), Row E values range from the desired 20.000 to 0.0004 range, but for Row A the range is 0.0008 - 1.67e-12.
nw = New Window( "Sample info", << Modal,
H List Box(
Panel Box( "Enter Sample names",
V List Box(
Text Box( "Row A+E" ),
AE = Text Edit Box( "", << Set Width( 200 ) ),
Text Box( "Row B+F" ),
BF = val2 = Text Edit Box( "", << Set Width( 200 ) ),
Text Box( "Row C+G" ),
CG = val3 = Text Edit Box( "", << Set Width( 200 ) ),
Text Box( "Row D+H" ),
DH = val4 = Text Edit Box( "", << Set Width( 200 ) );
)
),
Spacer Box( Size( 10, 10 ) ),
V List Box(
Panel Box("Calculate dosepoints",
V List Box(
Text Box( "Start Conc. (ng/mL)" ),
Conc = Number Edit Box( ),
Text Box( "n Dosepoints" ),
nDP = Number Edit Box( 12 ),
Text Box( "Factor" ),
xF = Number Edit Box( 0.2 ),
)
),
Spacer Box( Size( , 8 ) ),
H List Box(
Spacer Box( Size( 77, 1 ) ),
Button Box("Ok",
val1 = AE << Get text ();
val2 = BF << Get text ();
val3 = CG << Get text ();
val4 = DH << Get text ();
val5 = Conc << Get ();
val6 = nDP << Get ();
val7 = xF << Get ();
Current Data Table() << New Column( "Sample", Character, "Nominal",
Formula(
Match( :Row,
"A", val1,
"E", val1,
"B", val2,
"F", val2,
"C", val3,
"G", val3,
"D", val4,
"H", val4
)
)
);
Eval(
EvalExpr(
Current Data Table() << New Column( "R", Numeric, Continuous,
Formula(
Expr(val5) / Expr(val7) ^ ( Col Number( :Sample, :Sample ) - Col Cumulative Sum( 1, :Sample ))
)
);
)
);
)
)
)
)
);
Re: Calculate and add dose range based on provided valuesYou have to add additional grouping to Col Number and Col Cumulative Sum (Row might work for example)
20000 / 5 ^ (Col Number(:Sample, :Sample, :Row) - Col Cumulative Sum(1, :Sample, :Row))

Re: Calculate and add dose range based on provided valuesYes, this works perfectly! Thank you!