cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Pim
Pim
Level III

Calculate and add dose range based on provided values

I 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!

Pim_0-1734691408011.png

 

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):

Pim_1-1734691408014.png

 

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.

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Calculate and add dose range based on provided values

Maybe 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))
	));	
));
-Jarmo

View solution in original post

jthi
Super User

Re: Calculate and add dose range based on provided values

You 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))

jthi_0-1734698375363.png

 

-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Calculate and add dose range based on provided values

Maybe 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))
	));	
));
-Jarmo
Pim
Pim
Level III

Re: Calculate and add dose range based on provided values

Almost!
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 ))
			)
		);	
	)
);

				)
			)
		)
	)
);


jthi
Super User

Re: Calculate and add dose range based on provided values

You 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))

jthi_0-1734698375363.png

 

-Jarmo
Pim
Pim
Level III

Re: Calculate and add dose range based on provided values

Yes, this works perfectly! Thank you!

Recommended Articles