#define BOUNDJUNK #define FIX_CVHHWDIFF /* * dcselcand.c Jim Piper 05-02-89 * * Select candidates found by feature measurement, for subsequent * classification. Derived from "dcread.c". Selection criteria * are e.g. candidate may not be too close to chromosome tip, or * to another candidate. * * MODIFICATIONS * ------------- * 25-04-91 jimp Don't do anything with unanalysed objects - * dcsc1() returns zero in this case. */ #include #include #include #include dcselcand(chc,cnd,chco,no,candsel,othneardist,selneardist,enddist,r) struct chromcands *chc,*chco; struct cand *cnd; struct dcresults *r; { int i, number = 0; for (i=0; inchrom++; cnd += chc->ncands; if (chc->ncands > 0) r->nwithcands++; chc++; } } return(number); } dcsc1(chc,cnd,chco,candsel,othneardist,selneardist,enddist) register struct chromcands *chc,*chco; register struct cand *cnd; { register int i,j; register struct cand *cnd1, *cndo; if (chco->number <= 0) return(0); *chc = *chco; /* _strass(chc,chco,sizeof(struct chromcands)); */ chc->cands = cnd; cndo = chco->cands; for (i=0; incands; i++,cndo++) { *cnd = *cndo; /* _strass(cnd,cndo,sizeof(struct cand)); */ #ifdef FIX_CVHHWDIFF if (cnd->u.sy.modality <= 1) cnd->u.sy.cvhhwdiff = 0; #endif FIX_CVHHWDIFF /* * make curvatures > 0 */ cnd->u.sy.curvmax += 180; cnd->u.sy.curvmin += 180; cnd->u.sy.curvsum += 180; /* * check various candidate selection conditions */ if (cnd->candtype <= 0) { i--; chc->ncands--; } else if (cnd->candtype == 3) cnd++; else if (cnd->profpos <= enddist || cnd->profpos >= chc->axislen-enddist) { i--; chc->ncands--; } #ifdef BOUNDJUNK else if (cnd->candtype == 2 && (cnd->u.sy.curvmax+cnd->u.sy.curvmin > 360-20)) { i--; chc->ncands--; } else if (cnd->candtype == 2 && 100*cnd->u.sy.profval > 90*chc->profmax) { i--; chc->ncands--; } #endif BOUNDJUNK else if (cnd->candtype == candsel) { cnd1 = chc->cands; for (j=0; jcandtype == candsel && abs(cnd1->profpos - cnd->profpos) < selneardist) { i--; chc->ncands--; cnd--; break; } } cnd++; } else if (cnd->neardist > othneardist && cnd->candtype > 0) { cnd1 = chc->cands; for (j=0; jcandtype == cnd->candtype && abs(cnd1->profpos - cnd->profpos) < selneardist) { i--; chc->ncands--; cnd--; break; } } cnd++; } else { i--; chc->ncands--; } } return(1); }