/* * dcclass.c Jim Piper 21-01-87 * * perform box classification on dicentric candidate/feature data * * dcclass [-R method] [-C n] [-D dist] [-d dist] [-E dist ] [-p] [-m PC1 PC2] [-F n f1 .. fn] [file] * * -C n selects whether classification on type 1 candidates (n=1), * type 2 candidates (n=2), or some other candidate selection * method (to be determined). Default 1. * -D dist If flag -D is set, then * candidates of the "other" type are also included if their * nearest candidate of the selected type is more than * "dist" away (feature neardist). Default 8, i.e. will * reject "other" candidates within 1 micron of selected candidate. * -d dist If two candidates of the SAME selected type are closer than * "dist", reject one. Default 8. * -E dist reject any candidate less than "dist" to medial axis end. * Default 8. * -p turn on printing * -P print feature vectors and classification for objects classified * as dicentric (only the feature vectors selected by the method). * -R method Incorporate a final review stage of the positives, to reduce the * false positives. * -m PC1 PC2 setbox classifier percentages (see write-up). * -F n f1 ... fn select n features (numbered from one, as in dicen.h) * -X n box classifier method (default 0) * -Y file output FP/FN/TP identifiers to file * * MODIFICATIONS * ------------- * 22-01-91 jimp -R split to two methods, as on OS9 system * 21-09-88 jimp Option -Y added * 12-04-88 jimp Incorporate positives review (flag '-R'). * 07-04-88 jimp Flag '-P' for information about classified positives. * 26-02-88 jimp classifier limits set by selected candidate type only * 25-02-88 jimp Added flags -d, -E to reduce acceptable candidates. * 24-02-88 jimp Do not permit dicentrics smaller than cell median area */ #include #include #include #include #include #define SCALE 24 static struct pframe f; /* which features (numbering from one, as in dicen.h) */ int nfeat = 9; int selfeat[MAXFEATURES] = {1,3,5,6,8,9,13,14,15}; int selllim[MAXFEATURES] = {1,1,1,0,0,0, 1, 1, 0}; main(argc,argv) char **argv; { struct chromcands *chcp,chc[MAXOBJS]; struct cand *cndp,cnd[MAXCANDS]; int i, j, number, numberused; int PC1, PC2; char *cell,s[256]; FILE *infile, *pf, *idents; struct dcresults r; int DISPLAY = 0; int PRINT = 0; int POSPRINT = 0; int CANDSEL = 1; int OTHNEARDIST = 8; int SELNEARDIST = 8; int ENDDIST = 8; int BOXMETHOD = 0; int REVIEWP = 0; int IDENTS = 0; r.TP = r.FP = r.FN = r.UTP = r.UFN = 0; r.compoFP = r.twistedFP = r.acroFN = 0; r.onecandFN = r.nchrom = r.nwithcands = 0; r.areaFN = r.ovFP = r.ovFN = 0; /* * defaults for PC1, PC2 */ PC1 = 90; PC2 = 120; while (argc > 1 && argv[1][0] == '-') { switch (argv[1][1]) { case 'p': PRINT++; break; case 'P': POSPRINT++; break; case 'R': REVIEWP = atoi(argv[2]); argc--; argv++; break; case 'm': PC1 = atoi(argv[2]); PC2 = atoi(argv[3]); argc -= 2; argv += 2; break; case 'C': CANDSEL = atoi(argv[2]); argc--; argv++; if (CANDSEL != 1 && CANDSEL != 2) { fprintf(stderr,"Illegal -C value\n"); exit(1); } break; case 'D': OTHNEARDIST = atoi(argv[2]); argc--; argv++; break; case 'E': ENDDIST = atoi(argv[2]); argc--; argv++; break; case 'd': SELNEARDIST = atoi(argv[2]); argc--; argv++; break; case 'F': nfeat = atoi(argv[2]); argc--; argv++; for (i=0; i 7) { fprintf(stderr,"Unknown box method\n"); exit(1); } break; case 'Y': IDENTS++; idents = fopen(argv[2],"w"); if (idents == NULL) { fprintf(stderr,"Cannot open %s for identifiers\n",argv[2]); exit(1); } argc--; argv++; break; default: fprintf(stderr,"unrecognised switch -%c\n",argv[1][1]); break; } argc--; argv++; } if (argc > 1) { cell = argv[1]; infile = fopen(cell,"r"); if (infile == NULL) { fprintf(stderr,"Can't open %s\n",cell); exit(1); } } else { cell = "= 1) { fprintf(pf,"DATA FILE %s PC1 %d PC2 %d \n",cell,PC1,PC2); fprintf(pf,"FEATURES USED BY BOX CLASSIFIER: "); for (i=0; i