From 7347d75a4a36d42f8060e11d708291d796b266a5 Mon Sep 17 00:00:00 2001 From: Clayton Turner Date: Mon, 10 Feb 2014 16:00:30 -0500 Subject: [PATCH 1/2] Added ignore lines starting with specific characters to group tool --- tools/stats/grouping.py | 17 ++++++++++++++++- tools/stats/grouping.xml | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/tools/stats/grouping.py b/tools/stats/grouping.py index 084d5e253b3..0b2487fd0f9 100644 --- a/tools/stats/grouping.py +++ b/tools/stats/grouping.py @@ -37,7 +37,22 @@ def main(): round_val = [] data_ary = [] - for var in sys.argv[5:]: + if sys.argv[5] != "None": + oldfile = open(inputfile,'r') + oldfilelines = oldfile.readlines() + newinputfile = inputfile+'2' + newfile = open(newinputfile,'w') + asciitodelete = sys.argv[5].split(',') + for i in range(len(asciitodelete)): + asciitodelete[i] = chr(int(asciitodelete[i])) + for line in oldfilelines: + if line[0] not in asciitodelete: + newfile.write(line) + oldfile.close() + newfile.close() + inputfile = newinputfile + + for var in sys.argv[6:]: op, col, do_round = var.split() ops.append(op) cols.append(col) diff --git a/tools/stats/grouping.xml b/tools/stats/grouping.xml index 9d7815ac7a2..252cdc3ece0 100644 --- a/tools/stats/grouping.xml +++ b/tools/stats/grouping.xml @@ -6,6 +6,7 @@ $input1 $groupcol $ignorecase + $ignorelines #for $op in $operations '${op.optype} ${op.opcol} @@ -18,6 +19,24 @@ + + + + + + + + + + + + + + + + + + From fd85979a8651e0907bebce05cdfb59d77f0d0f64 Mon Sep 17 00:00:00 2001 From: Clayton Turner Date: Fri, 14 Feb 2014 12:25:20 -0500 Subject: [PATCH 2/2] Fixed XML versioning and inputfile name --- tools/stats/grouping.py | 2 +- tools/stats/grouping.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/stats/grouping.py b/tools/stats/grouping.py index 0b2487fd0f9..5920e19c0b3 100644 --- a/tools/stats/grouping.py +++ b/tools/stats/grouping.py @@ -40,7 +40,7 @@ def main(): if sys.argv[5] != "None": oldfile = open(inputfile,'r') oldfilelines = oldfile.readlines() - newinputfile = inputfile+'2' + newinputfile = "input_cleaned.tsv" newfile = open(newinputfile,'w') asciitodelete = sys.argv[5].split(',') for i in range(len(asciitodelete)): diff --git a/tools/stats/grouping.xml b/tools/stats/grouping.xml index 252cdc3ece0..58a9c7524ae 100644 --- a/tools/stats/grouping.xml +++ b/tools/stats/grouping.xml @@ -1,4 +1,4 @@ - + data by a column and perform aggregate operation on other columns. grouping.py