static void getFastaOffsets(struct brokenRefPepTbl *brpTbl, struct sqlConnection *conn, struct extFileTbl* extFileTbl, char *faPath) /* parse fasta file to get offsets of proteins */ { struct gbFa *fa = gbFaOpen(faPath, "r"); char acc[GB_ACC_BUFSZ]; struct brokenRefPep *brp; HGID extId = extFileTblGet(extFileTbl, conn, faPath); gbVerbMsg(5, "scanning fasta: %s", faPath); while (gbFaReadNext(fa)) { gbVerbMsg(5, " %s: %lld", fa->id, (long long)fa->recOff); /* save only if same acecss, version, and file (to match mrna fa) */ short ver = gbSplitAccVer(fa->id, acc); brp = hashFindVal(brpTbl->protAccHash, acc); if ((brp != NULL) && (ver == brp->protVer) && sameString(faPath, brp->newFaPath)) { gbFaGetSeq(fa); /* force read of sequence data */ brp->newFaId = extId; brp->newFaOff = fa->recOff; brp->newSeqSize = fa->seqLen; brp->newRecSize = fa->off-fa->recOff; gbVerbMsg(5, " save: %s %lld for %lld\n", fa->id, (long long)fa->recOff, (long long)fa->off); } } gbFaClose(&fa); }
static HGID getExtFileId(struct sqlConnection *conn, char* relPath) /* get the extFile id for a file, prepending the gbdb root dir */ { char path[PATH_LEN]; path[0] = '\0'; if (gGbdbGenBank[0] != '\0') { strcpy(path, gGbdbGenBank); strcat(path, "/"); } strcat(path, relPath); if (extFiles == NULL) { gbVerbMsg(4, "loading extFile table"); extFiles = extFileTblLoad(conn); } return extFileTblGet(extFiles, conn, path); }