jpayne@13: #! /usr/bin/env python jpayne@13: jpayne@13: from __future__ import print_function jpayne@13: jpayne@13: import csv jpayne@13: import sys jpayne@13: from collections import Counter, OrderedDict jpayne@13: jpayne@13: def main(table): jpayne@13: with open(table, 'rU') as table_f: jpayne@13: rdr = csv.DictReader(table_f, delimiter='\t', dialect='excel') jpayne@13: summary = OrderedDict() jpayne@13: data = list(rdr) jpayne@13: for name in rdr.fieldnames[1:]: jpayne@13: summary[name] = Counter([r[name] for r in data]) jpayne@13: total = len(data) jpayne@13: print("Summary:") jpayne@13: for name, results in summary.items(): jpayne@13: print('{}:'.format(name)) jpayne@13: for result, num in results.items(): jpayne@13: if result: jpayne@13: print("\t - {}: {} of {}".format(result, num, total)) jpayne@13: jpayne@13: jpayne@13: jpayne@13: if __name__ == '__main__': jpayne@13: main(sys.argv[1])