#include main(int argc, char **argv) { FILE *fp, *ckopen(); char buf[1000], *strstr(); int n_pct, pct10, n_seq; float total_pct, pct, max_pct; double atof(); if (argc != 2) fatalf("%s results_file", argv[0]); fp = ckopen(argv[1], "r"); pct10 = n_pct = n_seq = 0; max_pct = total_pct = 0.0; while (fgets(buf, 1000, fp)) if (strstr(buf, "mismatches")) { ++n_pct; pct = atof(buf); total_pct += pct; if (pct > max_pct) max_pct = pct; if (pct >= 10.0) ++pct10; } else if (strstr(buf, "contig")) n_seq += atoi(buf); else if (!strstr(buf, ".seq")) fatalf("impossible line: %s", buf); printf("%d alignments, %d seqs, %2.1f%% ave., %2.1f%% max, %d over 10%%.\n", n_pct, n_seq, total_pct/(float)n_pct, max_pct, pct10); exit(0); }