cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Have your say in shaping JMP's future by participating in the new JMP Wish List Prioritization Survey
Choose Language Hide Translation Bar
Sburel
Level IV

Getting an error in a window UI related to the button Box

Hello,

 

I have created a script that depends on a UI to make some selections.

For some reason, the script is giving an error when selecting either the OK or the CANCEL buttons.

Can't figure out why, in a previous iteration it was working.

Any input would be greatly appreciated.

 

Thanks in advance,

 

Sebasten

 

Names Default To Here( 1 );
clear log();

P12_DGE=New Table( "Subset of NT191209_P12_DGE",
	Add Rows( 16 ),
	New Column( "symbol",
		Character,
		"Nominal",
		Set Values(
			{"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
			"A", "A"}
		)
	),	
	New Column( "Genelist_concat",
		Character,
		"Multiple Response",
		Set Values(
			{"", "", "", "", "", "", "", "c", "b,c", "a,b", "", "", "", "a", "a", ""}
		)
	),
	New Column( "Log2 TPM_norm to PBS, 0 ug (by specimen_material_type)",
		Numeric,
		"Continuous",
		Format( "Best", 10 ),		
		Set Values(
			[-2.48733482857376, -0.624682475325802, -0.615692449761937,
			1.2902214351926, -2.48733482857376, 0.370997758551945, -1.83635492333803,
			2.37835375673671, -1.83635492333803, -0.116151955497186,
			-1.83635492333803, -1.83635492333803, 0.671865760464638,
			0.133186242337643, -0.09670852998485, -1.83635492333803]
		)
	),
	New Column( "Log2 TPM_median norm",
		Numeric,
		"Continuous",
		Format( "Best", 10 ),
		Set Values(
			[0, 1.86265235324796, 1.87164237881182, 3.77755626376636, 0,
			2.8583325871257, 0, 4.86568858531047, 0, 1.72020296784084, 0, 0,
			3.1592005890384, 1.96954116567567, 1.73964639335318, 0]
		)
	),
	New Column( "Genelist TEST (local",
		Character( 3 ),
		"Nominal",
		Set Values(
			{"", "", "", "", "", "", "", "No", "No", "No", "No", "No", "No", "No",
			"No", "No"}
		)
	),
	Group Columns(
		"TPM data", :"Log2 TPM_norm to PBS, 0 ug (by specimen_material_type)"n, 2
	)
);


TPMls = {"Log2 TPM_norm to PBS, 0 ug (by specimen_material_type)", "Log2 TPM_median norm"};
lbWidth = 208;
pnwidth = 400;
nc = 20;
nloc = 1;
locls = {"Genelist TEST (local"};

uniquegenels = {"a", "b", "c", "d"};

window_UI=expr(
response = New Window( "Hierachical Clustering of Transcritps of interests ",
	<<MODAL,
	Panel Box( "Select TPM type column - Response",
		Text Box( "Select the relevant Log2 normalized TPM data" ),
		Lineup Box( N Col( 3 ), spacing( 5 ),
			colListTPM = Col List Box( <<append( TPMls ), width( pnWidth ), nLines( Min( nc, 2 ) ), "numeric", <<set analysis type( "continuous" ) ),
			Button Box( "TPM", TPM << Append( colListTPM << GetSelected ) ),
			TPM = Col List Box( width( lbWidth ), nLines( 1 ), Minitems( 1 ), Maxitems( 1 ), "numeric" )
		)
	),
	Panel Box( "Choose, left or right panel to cluster",
		H List Box(
			Panel Box( "Pick one of more genelist to cluster on",
				V List Box(
					
					Text Box( "Selected Genelist below. Recommend working with a smallish set of genes (<1000)", set wrap( 600 ) ),
					selectuniquegenels = Check Box( uniquegenels )
				)
				
			),
			Panel Box( "Pick a local gene list (Ignore the data filter)",
				V List Box(
					colListlocal = Col List Box( width( pnWidth ), <<append( locls ), nLines( nloc ), "Character" ),
					Button Box( "Local", lcol << Append( colListlocal << GetSelected ) ),
					lcol = Col List Box( width( lbWidth ), nLines( 1 ), Maxitems( 1 ), "Character" )
				)
			)
		)
	),
	Spacer Box( size( 20, 10 ) ),
	Panel Box( "Action",
		Lineup Box( N Col( 3 ), spacing( 5 ),
			ex = Button Box( "OK" ),
			Button Box( "Cancel",
				response << close window;
				Stop()
			),
			Button Box( "Remove column", TPM << remove selected ),
			ex << set script(
				today = " " || Char( Format( Today(), "Format Pattern", "<YY><-><MM><-><DD> <hh24><:><mm>" ) ); 
								
				LogTPM_column = TPM << get items;
				LogTPM_column = Column( LogTPM_column[1] );
				Show( LogTPM_column );
				response << close window; 
					
				Try(
					l = lcol << get items;
					Show( l, lcol );
				); 
				
				If( N Items( l ) == 1,
					(//a local gene list has been selected
					P12_DGE << clear select ; P12_DGE << select hidden << hide and exclude( 0 ) ; P12_DGE << select where( As Column( lcol1 ) != "" )
					 ; P12_DGE << Name Selection in Column( Column Name( "Genelist Cluster " || today ), Selected( "Yes" ), Unselected( "No" ) ) ;
					genelist_cluster_col = Column( "Genelist Cluster " || today ) ; Show( genelist_cluster_col ) ; P12_DGE << invert row selection
					 << hide and exclude)
				,
					(//some global genelist(s) have been selected
					select_uniquegenels = selectuniquegenels << get selected ; ngenels = N Items( select_uniquegenels ) ;
					Show( ngenels, select_uniquegenels ) ; P12_DGE << clear select ; P12_DGE << select hidden << hide and exclude( 0 ) ;
					For( i = 1, i <= ngenels, i++,
						P12_DGE << select where( Contains( :Genelist_concat, select_uniquegenels[i] ) )
					) ; P12_DGE << Name Selection in Column( Column Name( "Genelist Cluster " || today ), Selected( "Yes" ), Unselected( "No" ) ) ;
					genelist_cluster_col = Column( "Genelist Cluster " || today ) ; Show( genelist_cluster_col ) ; P12_DGE << invert row selection
					 << hide and exclude)
				)
			)
		)
	)
);
);
window_UI;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Getting an error in a window UI related to the button Box

At least you are trying to close response window which will be closed when OK or Cancel is pressed as it is a modal window. So removing these lines (if you want to use modal)

response << close window;

should get you somewhere.

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Getting an error in a window UI related to the button Box

At least you are trying to close response window which will be closed when OK or Cancel is pressed as it is a modal window. So removing these lines (if you want to use modal)

response << close window;

should get you somewhere.

-Jarmo
Sburel
Level IV

Re: Getting an error in a window UI related to the button Box

Hi Jarmo,

 

That did the trick. 

 

Thanks a lot for your help.

 

Very appreciated.

 

Sebastien