cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Thierry_S
Super User

JMP > JSL > How to Pass Arguments to Add-In included my own script?

Hi JMP Community,

 

I am an avid user of John Sall's FDR calculation Add-In (com.sas.sall.fdrpvalue.jmpaddin) in analyzing large biomarker data.

While the manual input of data in this Add-In is straightforward, I have not figured out how to pass arguments from my JSL scripts into this tool.

 

I know that I have to use the Include ("[Add-in]") command to enable the use of the Add-In in my scripts, but how do I point to specific columns generated by my script into the Add-In?

 

Thank you for your help.

 

Best,

TS 

Thierry R. Sornasse
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: JMP > JSL > How to Pass Arguments to Add-In included my own script?

I installed the addin from here and looked at the code. I would most likely rewrite it and use functions, but you should be able to use the New Window that the addin creates with something like this:

Names Default To Here(1);

//This will immediately launch New Window with reference fdrDlg
Include("$ADDIN_HOME(com.sas.sall.fdrpvalue)/falseDiscoveryPValue.jsl");

dt = Open("$SAMPLE_DATA/Big Class.jmp");
colListLabel << Set Items({"age", "sex"}); //Label Columns
colListPVal << Set Items({"height"}); //PValue Column

//ok button doesn't have direct reference, so we can look for it with XPath for example
ok_btn = (fdrDlg << XPath("//ButtonBox[@title='OK']"))[1];

//to launch we can press ok_btn
ok_btn << Click;
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: JMP > JSL > How to Pass Arguments to Add-In included my own script?

I installed the addin from here and looked at the code. I would most likely rewrite it and use functions, but you should be able to use the New Window that the addin creates with something like this:

Names Default To Here(1);

//This will immediately launch New Window with reference fdrDlg
Include("$ADDIN_HOME(com.sas.sall.fdrpvalue)/falseDiscoveryPValue.jsl");

dt = Open("$SAMPLE_DATA/Big Class.jmp");
colListLabel << Set Items({"age", "sex"}); //Label Columns
colListPVal << Set Items({"height"}); //PValue Column

//ok button doesn't have direct reference, so we can look for it with XPath for example
ok_btn = (fdrDlg << XPath("//ButtonBox[@title='OK']"))[1];

//to launch we can press ok_btn
ok_btn << Click;
-Jarmo
Thierry_S
Super User

Re: JMP > JSL > How to Pass Arguments to Add-In included my own script?

Hi JMP Community,

 

First, thanks to @jthi for a quick and efficient solution.

Just for completeness, I used a crude alternative option where I created a function out of the core elements of the FDR JSL script (see below). I then called this function in my script.

IMPORTANTLY: the core code used in this function was created by John Sall.

NamesDefaultToHere(1);

fdr = Function ({dtf, pvalCol},

	pvalues = pvalCol<<Get Values;
	if (min(pvalues)<0 | max(pvalues)>1,dialog("PValues must be between 0 and 1");throw());

	index = rankIndex(pvalues);	// removes missing values
	n = nrow(index);

	ordPValue = pvalues[index];
	adjPValue = J(n,1,.);

	for(i=1,i<=n,i++,
		j = n-i+1;
		ratio = n/(n-i+1);
		adjPValue[j] = if (i==1,ordPValue[j],min(ratio*ordPValue[j],adjPValue[j+1]));
	);
	
	rowPValues = J(NRow(dtf),1,.);
	rowPValues[index] = adjPValue;
	sfx = pvalCol << get name ();
	n_col_name = "FDR " || sfx;
	dtf<<NewColumn(n_col_name,Numeric,Values(rowPValues));
	
);

Best ,

 

TS

Thierry R. Sornasse