/* * dcmerge.c Jim Piper 23-09-86 * (from comptype.old) * * Get chromosomes, dicentrics and composites from two files: * (1) Original unsegmented file * (2) File of segmented chromosomes (only) with biological typing. * Pass all these objects to standard output. */ #include #include #include #include main(argc,argv) char **argv; { struct chromosome *obj, *objl[MAXOBJS], *pobj, *readobj(); struct chromplist *makechromplist(); FILE *in1, *in2; int i,j,k,num,numorig,pnum,ccount[MAXOBJS]; in1 = fopen(argv[1],"r"); if (in1 == NULL) { fprintf(stderr,"Cannot open first file %s\n",argv[1]); exit(1); } in2 = fopen(argv[2],"r"); if (in2 == NULL) { fprintf(stderr,"Cannot open second file %s\n",argv[2]); exit(1); } for (i=0; iplist == NULL) obj->plist = makechromplist(); obj->plist->number = num+1; obj->plist->otype = 5; /* force noise */ objl[num++] = obj; } numorig = num; /* read derived objects */ while ((obj = readobj(in2)) != NULL) { num = obj->plist->number - 1; if (objl[num] != NULL) freeobj(objl[num]); objl[num] = obj; } /* count offspring, make parents composites */ for (i=0; i<=num; i++) { obj = objl[i]; if (obj != NULL) { if (obj->plist->pnumber > 0) { pnum = obj->plist->pnumber - 1; pobj = objl[pnum]; if (pobj != NULL) { ccount[pnum]++; pobj->plist->history[1] = obj->plist->history[0]; switch(obj->plist->history[0]) { case 1: case 8: default: pobj->plist->otype = 2; pobj->plist->Cotype = 2; break; case 2: pobj->plist->otype = 3; pobj->plist->Cotype = 3; break; case 4: pobj->plist->otype = 4; pobj->plist->Cotype = 4; break; } } } } } /* classify and write away */ for (i=0; i<=num; i++) { obj = objl[i]; if (obj != NULL) { if (obj->plist->otype <= 3) { writeobj(stdout,obj); } } } }