Hello,
I'm writing a script to deconvolute a json file.
Once in jmp, the resulting table is composed of groups of columns labelled such as study.xyz, study.cro, groups.xyz, groups.id, test.xyz, test.name,...
I'm trying to create a series of tables for each of the groups such as study/groups/test.
I have a script that does that well when each subset is handle separately but for some reasons it stops creating the subset table when it moves to the next group.
I can move around the order in which those groups are processed and the first group to be 'subseted' for well.
In other words, if I try to subset 'study' first, then 'groups' is not processed
If I move the script portion dedicated to 'groups' in first position, it get processed but then 'study' does not.
I'm baffled. Any suggestions would be greatly appreciated.
Best,
Sebastien
try(data table("P0_json")<<close window);
try(data table("study")<<close window);
try(data table("groups")<<close window);
New Table( "P0_json",
Add Rows( 16 ),
New Column( "groups.group_id",
Character,
"Nominal",
Set Values(
{"A", "B", "C", "D", "E", "F", "G", "H", "A", "B", "C", "D", "E", "F",
"G", "H"}
)
),
New Column( "groups.strain",
Character,
"Nominal",
Set Values(
{"C57BL/6", "C57BL/6", "C57BL/6", "C57BL/6", "C57BL/6", "C57BL/6",
"C57BL/6", "C57BL/6", "C57BL/6", "C57BL/6", "C57BL/6", "C57BL/6",
"C57BL/6", "C57BL/6", "C57BL/6", "C57BL/6"}
)
),
New Column( "groups.study_id",
Character,
"Nominal",
Set Values(
{"ELN-19-0587", "ELN-19-0587", "ELN-19-0587", "ELN-19-0587",
"ELN-19-0587", "ELN-19-0587", "ELN-19-0587", "ELN-19-0587",
"ELN-19-0588", "ELN-19-0588", "ELN-19-0588", "ELN-19-0588",
"ELN-19-0588", "ELN-19-0588", "ELN-19-0588", "ELN-19-0588"}
)
),
New Column( "study.investigator_study_id",
Character,
"Nominal",
Set Values(
{"NT200109", "NT191209", "", "", "", "", "", "", "", "", "", "", "", "",
"", ""}
)
),
New Column( "study.cro",
Character,
"Nominal",
Set Values(
{"XYZ", "XYZ", "", "", "", "", "", "", "", "", "", "", "", "", "",
""}
)
)
);
//create study subset
json = Data Table("P0_json");
json<< clear column selection();
json << select all rows;
tab = "study.";
nm="study";
Col_List = json << Get Column Names( "String" );
For( i = 1, i <= N Items( Col_List ), i++,
If( Contains( Col_List[i], tab ),
Column( Col_List[i] ) << Set Selected( 1 )
)
);
json<< Subset(
Output Table( nm ),
Selected Rows( 1 ),
Selected columns only( 1 )
);
Data Table( nm ) << select where( :study.cro == "" ) << delete rows;
col = Data Table( nm ) << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
If( Contains( col[i], tab ),
show(col[i]);
column(col[i]) << set name(munger(col[i],1,tab,""))
)
);
//create group subset
//json = Data Table("P0_json");
json<< clear column selection();
json << select all rows;
tab = "groups.";
nm="groups";
//Col_list = json << Get Column Names( "String" );
For( i = 1, i <= N Items( Col_List ), i++,
If( Contains( Col_List[i], tab ),
Column( Col_List[i] ) << Set Selected( 1 )
)
);
json<< Subset(
Output Table( nm ),
Selected Rows( 1 ),
Selected columns only( 1 )
);
Data Table( tab ) << select where( :groups.group_id == "" ) << delete rows;
col = Data Table( nm ) << get column names( string );
nc = N Items( col);
For( i = 1, i <= nc, i++,
If( Contains( col[i], tab ),
show(col[i]);
column(col[i]) << set name(munger(col[i],1,tab,""))
)
);
Here's the scripts: