/* sample program for invoking sub.c */ #include #include "sub.h" main(int argc, char *argv[]) { double atof(); char *ckalloc(); FILE *qp, *ckopen(); char *seq1, *seq2; char *name1, *name2; int from1, to1, from2, to2; int M, N; /* lengths of sequences */ long low, up, ms, G, H, W[128][128], CUT_OFF; int *L, *R; int i, j; int c; if (argc != 7) fatalf("%s seq1 seq2 ms(<0) g(>=0) h(>0) cut_off",argv[0]); M = get_seq(argv[1], &seq1, &name1, &from1, &to1); N = get_seq(argv[2], &seq2, &name2, &from2, &to2); ms = DIGIT * atof(argv[3]); if (ms > 0) fatal("The mismatch weight should be nonpositive."); G = DIGIT * atof(argv[4]); if (G < 0) fatal("The gap-open penalty should be nonnegative."); H = DIGIT * atof(argv[5]); if (H < 0) fatal("The gap-extend penalty should be positive."); CUT_OFF = DIGIT * atof(argv[6]); /* set up match and mismatch weights */ for (i = 0; i < 128; i++) for (j = 0; j < 128; j++) if (i == j) W[i][j] = DIGIT; else W[i][j] = ms; printf("%s[%d,%d]: length = %d\n",name1,from1,to1,M); printf("%s[%d,%d]: length = %d\n",name2,from2,to2,N); printf("mismatch = %.1f, gap_open = %.1f, gap_ext = %.1f, cut_off = %.1f\n\n",ms/DIGIT,G/DIGIT,H/DIGIT,CUT_OFF/DIGIT); c = ALL_SUB(seq1-1,seq2-1,M,N,W,G,H,CUT_OFF); if (c == -1) printf("No alignment is of score >= cut_off\n"); exit(0); }