int wb_dbms::del_family(wb_dbms_txn *txn, wb_dbms_cursor *cp, pwr_tOid poid) { int ret = 0; #if 0 dbName name; name.poid = poid; name.normname = ""; pwr_tOid oid = 0; FamilyKey nk(po, ); FamiltData nd(&oid, sizeof(oid)); wb_dbms_cursor *ncp; cp->dup(*ncp, 0); while ((ret = cp->get(&nk, &nd, DB_NEXT)) != DB_NOTFOUND) { del_family(txn, ncp, oid); cp->del(); oh_k ok(nd); oh_d od(); m_dbms_ohead->get(txn, &ok, &od, 0); wb_DbClistK ck(od); m_db_class->del(txn, &ck, 0); wb_DbBodyK bk(od); m_db_obody->del(txn, &bk, 0); m_db_ohead->del(txn, &ok, 0); } ncp->close(); ret = m_db_name->del(txn, &key, 0); #endif return ret; }
void hap_transmit(int *n, int *ped, int *id, int *father, int *mother, int *sex, int *aff, int *if_qt, double *qt, int *m, int *markers, int *multiple_cases, int *impute_using_affected, char **ofname) { Family *first, *f, *prev; FILE *outfile; int nn, mm, hr, iqt; char *tmp; nn = *n; mm = *m; iqt = *if_qt; if (!*if_qt) qt = (double *) 0; first = nuclear(nn, ped, id, father, mother, sex, aff, qt, mm, markers); /* Multiple case treatment */ if (*multiple_cases) { for (f=first; f; f=f->next) { if (*multiple_cases == 1) { prev = f; f = expand_family(f, mm); if (!f) goto overflow; } else if (*multiple_cases == 2) { use_only_first(f); } } } /* Do remaining computations on families */ prev = (Family *) 0; for (f=first; f; f=f->next) { /* Impute missing parental genotypes */ impute_parent(f, mm, (int) *impute_using_affected); /* Compute inheritance vectors */ inheritance(f, mm); /* Resolve haplotype phase and transmission */ hr = haplotype(f, mm, 1); /* If recombination, write error message */ if (hr<0) { REprintf("*** Recombination/expaternity at locus %d *** ", -hr); show_family(f); } /* If no information or recombination, omit family */ if (hr!=0) { if (prev) prev->next = f->next; else first = f->next; } else { prev = f; } } /* Write haplotypes to disk */ tmp = *ofname; /* If no file name supplied, generate one */ if (!*tmp) { tmp = tmpnam((char *) 0); *ofname = tmp; } outfile = fopen(tmp, "wb"); if (outfile) { *n = hap_write(first, mm, iqt, outfile); fclose(outfile); } else { REprintf("*** Couldn't open temporary file %s\n", tmp); *n = 0; } /* Now return memory to system */ while (first) { f = first; first = first->next; del_family(f); } return; /* Memory overflow */ overflow: warn("Memory overflow while or after expanding family", f); }