/usr/share/hyphy/ChartAddIns/Column Operations is in hyphy-common 2.2.6+dfsg-3build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | if (NON_EMPTY_SELECTION)
{
data_rows = Columns (SELECTED_CHART_ROWS);
selected_columns = {data_rows, 1};
different_columns = 0;
first_row = SELECTED_CHART_ROWS[0];
counter = 0;
while ((counter<data_rows)&&(SELECTED_CHART_ROWS[counter]==first_row))
{
selected_columns [different_columns] = SELECTED_CHART_COLS[counter];
different_columns = different_columns+1;
counter = counter + 1;
}
column_stensil = {different_columns,1};
for (counter=0; counter < different_columns; counter = counter + 1)
{
column_stensil [counter] = selected_columns[counter];
}
selected_columns = 0;
/*check selection consistency*/
counter = different_columns;
while (counter+different_columns < data_rows)
{
first_row = SELECTED_CHART_ROWS[counter];
for (counter2 = 0; counter2 < different_columns; counter2 = counter2 + 1)
{
if ((SELECTED_CHART_COLS[counter2+counter]==column_stensil[counter2])&&(SELECTED_CHART_ROWS[counter2+counter]==first_row))
{
continue;
}
break;
}
if (counter2 != different_columns)
{
counter = -1;
break;
}
counter = counter+different_columns;
}
if (counter+different_columns!=data_rows)
{
fprintf (stdout, "Invalid selection: the same rows must be selected in each column\n");
}
else
{
fprintf (stdout, "Enter the column operation in terms of data_column[index], where index is between 0 and ", different_columns-1, ":");
fscanf (stdin, "String", column_op);
data_column = {different_columns,1};
for (counter=0; counter < data_rows; counter = counter+different_columns)
{
for (counter2 = 0; counter2 < different_columns; counter2 = counter2 + 1)
{
data_column[counter2] = SELECTED_CHART_DATA[counter+counter2];
}
data_column2 = data_column;
ExecuteCommands (column_op);
for (counter2 = 0; counter2 < different_columns; counter2 = counter2 + 1)
{
if (data_column[counter2] != data_column2[counter2])
{
SELECTED_CHART_DATA[counter+counter2] = data_column[counter2];
break;
}
}
}
data_column = 0;
data_column2 = 0;
UPDATE_CELL_DATA = 1;
}
column_stensil = 0;
}
else
{
NON_EMPTY_SELECTION = -1;
}
|