/* Function: p7_filtermx_GrowTo() * Synopsis: Resize filter DP matrix for new profile size. * * Purpose: Given an existing filter matrix structure <fx>, * and the dimension <M> of a new profile that * we're going to use (in consensus positions), * assure that <fx> is large enough for such a * profile; reallocate and reinitialize as needed. * * <p7_filtermx_Reuse(fx); p7_filtermx_GrowTo(fx, M)> * is essentially equivalent to <p7_filtermx_Create(M)>, * while minimizing reallocation. * * Returns: <eslOK> on success. * * Throws: <eslEMEM> on allocation failure. The state of * <fx> is now undefined, and it should not be used. */ int p7_filtermx_GrowTo_neon64(P7_FILTERMX *fx, int allocM) { #ifdef HAVE_NEON64 int status; /* Contract checks / argument validation */ ESL_DASSERT1( (allocM >= 1 && allocM <= 100000) ); if (allocM <= fx->allocM) return eslOK; /* if not, grow it */ ESL_REALLOC(fx->dp_mem, (sizeof(esl_neon_128i_t) * (p7F_NSCELLS * P7_NVW(allocM))) + (p7_VALIGN-1)); fx->allocM = allocM; fx->dp = (esl_neon_128i_t *) ( (unsigned long int) ( (char *) fx->dp_mem + (p7_VALIGN-1)) & p7_VALIMASK); return eslOK; ERROR: return status; #endif //HAVE_NEON64 #ifndef HAVE_NEON64 return eslENORESULT; #endif }
/* Function: p7_filtermx_MinSizeof() * Synopsis: Calculate minimum size of a filter matrix, in bytes. * * Purpose: Calculate and return the minimum allocation size * required for a one-row filter matrix for a query * profile of <M> consensus positions. */ size_t p7_filtermx_MinSizeof_neon64(int M) { size_t n = sizeof(P7_FILTERMX); #ifdef HAVE_NEON64 n += (sizeof(esl_neon_128i_t) * p7F_NSCELLS * P7_NVW(M)) + (p7_VALIGN-1); #endif return n; }
/* Function: p7_filtermx_Sizeof() * Synopsis: Calculate and return the current size, in bytes. * * Purpose: Calculate and return the current allocated size * of the filter matrix <fx>, in bytes. * * Used in diagnostics, benchmarking of memory usage. * * Returns: the allocation size. */ size_t p7_filtermx_Sizeof_neon64(const P7_FILTERMX *fx) { size_t n = sizeof(P7_FILTERMX); #ifdef HAVE_NEON64 n += (sizeof(esl_neon_128i_t) * p7F_NSCELLS * P7_NVW(fx->allocM)) + (p7_VALIGN-1); #endif return n; }
/* Function: p7_filtermx_Create() * Synopsis: Create a one-row DP matrix for MSV, VF. * * Purpose: Allocate a reusable, resizeable one-row <P7_FILTERMX> * suitable for MSV and Viterbi filter calculations on * query profiles of up to <allocM> consensus positions. * * <allocM> must be $\leq$ 100,000. This is an H3 design * limit. * * Args: allocM - initial allocation size, in profile positions. (>=1, <=100000) * * Returns: ptr to new <P7_FILTERMX> * * Throws: <NULL> on allocation failure. */ P7_FILTERMX * p7_filtermx_Create_neon64(int allocM) { #ifdef HAVE_NEON64 P7_FILTERMX *fx = NULL; int status; /* Contract checks / argument validation */ ESL_DASSERT1( (allocM >= 1 && allocM <= 100000) ); ESL_ALLOC(fx, sizeof(P7_FILTERMX)); fx->simd = NEON64; fx->M = 0; fx->dp = NULL; fx->dp_mem = NULL; fx->allocM = 0; fx->type = p7F_NONE; #ifdef p7_DEBUGGING fx->do_dumping= FALSE; fx->dfp = NULL; #endif // ISA we're using /* 16B per vector * (MDI)states * ~M/4 vectors + alignment slop */ ESL_ALLOC(fx->dp_mem, (sizeof(esl_neon_128i_t) * p7F_NSCELLS * P7_NVW(allocM)) + (p7_VALIGN-1)); fx->allocM = allocM; /* Manual memory alignment incantation: */ fx->dp = (esl_neon_128i_t *) ( (unsigned long int) ( (char *) fx->dp_mem + (p7_VALIGN-1) ) & p7_VALIMASK); return fx; ERROR: p7_filtermx_Destroy(fx); return NULL; #endif //HAVE_NEON64 #ifndef HAVE_NEON64 return NULL; #endif }
/* Function: p7_filtermx_DumpVFRow() * Synopsis: Dump current row of ViterbiFilter (int16) filter matrix. * * Purpose: Dump current row of ViterbiFilter (int16) filter DP * matrix <fx> for diagnostics, and include the values of * specials <xE>, etc. The index <rowi> for the current row * is used as a row label. * * If <rowi> is 0, print a header first too. * * The output format is coordinated with <p7_refmx_Dump()> to * facilitate comparison to a known answer. * * Returns: <eslOK> on success. * * Throws: <eslEMEM> on allocation failure. */ int p7_filtermx_DumpVFRow_neon64(const P7_FILTERMX *fx, int rowi, int16_t xE, int16_t xN, int16_t xJ, int16_t xB, int16_t xC) { #ifdef HAVE_NEON64 esl_neon_128i_t *dp = fx->dp; /* enable MMXf(q), DMXf(q), IMXf(q) macros */ int Q = P7_NVW(fx->M); /* number of vectors in the VF row */ int16_t *v = NULL; /* array of unstriped, uninterleaved scores */ int q,z,k; union { esl_neon_128i_t v; int16_t i[8]; } tmp; int status; ESL_ALLOC(v, sizeof(int16_t) * ((Q*8)+1)); v[0] = 0; /* Header (if we're on the 0th row) */ if (rowi == 0) { fprintf(fx->dfp, " "); for (k = 0; k <= fx->M; k++) fprintf(fx->dfp, "%6d ", k); fprintf(fx->dfp, "%6s %6s %6s %6s %6s\n", "E", "N", "J", "B", "C"); fprintf(fx->dfp, " "); for (k = 0; k <= fx->M+5; k++) fprintf(fx->dfp, "%6s ", "------"); fprintf(fx->dfp, "\n"); } /* Unpack and unstripe, then print M's. */ for (q = 0; q < Q; q++) { tmp.v = MMXf(q); for (z = 0; z < 8; z++) v[q+Q*z+1] = tmp.i[z]; } fprintf(fx->dfp, "%4d M ", rowi); for (k = 0; k <= fx->M; k++) fprintf(fx->dfp, "%6d ", v[k]); /* The specials */ fprintf(fx->dfp, "%6d %6d %6d %6d %6d\n", xE, xN, xJ, xB, xC); /* Unpack and unstripe, then print I's. */ for (q = 0; q < Q; q++) { tmp.v = IMXf(q); for (z = 0; z < 8; z++) v[q+Q*z+1] = tmp.i[z]; } fprintf(fx->dfp, "%4d I ", rowi); for (k = 0; k <= fx->M; k++) fprintf(fx->dfp, "%6d ", v[k]); fprintf(fx->dfp, "\n"); /* Unpack, unstripe, then print D's. */ for (q = 0; q < Q; q++) { tmp.v = DMXf(q); for (z = 0; z < 8; z++) v[q+Q*z+1] = tmp.i[z]; } fprintf(fx->dfp, "%4d D ", rowi); for (k = 0; k <= fx->M; k++) fprintf(fx->dfp, "%6d ", v[k]); fprintf(fx->dfp, "\n\n"); free(v); return eslOK; ERROR: free(v); return status; #endif //HAVE_NEON64 #ifndef HAVE_NEON64 return eslENORESULT; #endif }
/* Function: p7_oprofile_Write() * Synopsis: Write an optimized profile in two files. * * Purpose: Write the MSV filter part of <om> to open binary stream * <ffp>, and the rest of the model to <pfp>. These two * streams will typically be <.h3f> and <.h3p> files * being created by hmmpress. * * Args: ffp - open binary stream for saving MSV filter part * pfp - open binary stream for saving rest of profile * om - optimized profile to save * * Returns: <eslOK> on success. * * Throws: <eslEWRITE> on any write failure, such as filling * the disk. */ int p7_oprofile_Write(FILE *ffp, FILE *pfp, P7_OPROFILE *om) { int Q4 = P7_NVF(om->M); int Q8 = P7_NVW(om->M); int Q16 = P7_NVB(om->M); int Q16x = P7_NVB(om->M) + p7O_EXTRA_SB; int n = strlen(om->name); int x; /* <ffp> is the part of the oprofile that MSVFilter() needs */ if (fwrite((char *) &(v3f_fmagic), sizeof(uint32_t), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->M), sizeof(int), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->abc->type), sizeof(int), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &n, sizeof(int), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->name, sizeof(char), n+1, ffp) != n+1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->max_length),sizeof(int), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->tbm_b), sizeof(uint8_t), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->tec_b), sizeof(uint8_t), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->tjb_b), sizeof(uint8_t), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->scale_b), sizeof(float), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->base_b), sizeof(uint8_t), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->bias_b), sizeof(uint8_t), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); for (x = 0; x < om->abc->Kp; x++) if (fwrite( (char *) om->sbv[x], sizeof(__m128i), Q16x, ffp) != Q16x) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); for (x = 0; x < om->abc->Kp; x++) if (fwrite( (char *) om->rbv[x], sizeof(__m128i), Q16, ffp) != Q16) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->evparam, sizeof(float), p7_NEVPARAM, ffp) != p7_NEVPARAM) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->offs, sizeof(off_t), p7_NOFFSETS, ffp) != p7_NOFFSETS) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->compo, sizeof(float), p7_MAXABET, ffp) != p7_MAXABET) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(v3f_fmagic), sizeof(uint32_t), 1, ffp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); /* sentinel */ /* <pfp> gets the rest of the oprofile */ if (fwrite((char *) &(v3f_pmagic), sizeof(uint32_t), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->M), sizeof(int), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->abc->type), sizeof(int), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &n, sizeof(int), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->name, sizeof(char), n+1, pfp) != n+1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (om->acc == NULL) { n = 0; if (fwrite((char *) &n, sizeof(int), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); } else { n = strlen(om->acc); if (fwrite((char *) &n, sizeof(int), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->acc, sizeof(char), n+1, pfp) != n+1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); } if (om->desc == NULL) { n = 0; if (fwrite((char *) &n, sizeof(int), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); } else { n = strlen(om->desc); if (fwrite((char *) &n, sizeof(int), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->desc, sizeof(char), n+1, pfp) != n+1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); } if (fwrite((char *) om->rf, sizeof(char), om->M+2, pfp) != om->M+2) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->mm, sizeof(char), om->M+2, pfp) != om->M+2) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->cs, sizeof(char), om->M+2, pfp) != om->M+2) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->consensus, sizeof(char), om->M+2, pfp) != om->M+2) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); /* ViterbiFilter part */ if (fwrite((char *) om->twv, sizeof(__m128i), 8*Q8, pfp) != 8*Q8) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); for (x = 0; x < om->abc->Kp; x++) if (fwrite( (char *) om->rwv[x], sizeof(__m128i), Q8, pfp) != Q8) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); for (x = 0; x < p7O_NXSTATES; x++) if (fwrite( (char *) om->xw[x], sizeof(int16_t), p7O_NXTRANS, pfp) != p7O_NXTRANS) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->scale_w), sizeof(float), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->base_w), sizeof(int16_t), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->ddbound_w), sizeof(int16_t), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->ncj_roundoff), sizeof(float), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); /* Forward/Backward part */ if (fwrite((char *) om->tfv, sizeof(__m128), 8*Q4, pfp) != 8*Q4) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); for (x = 0; x < om->abc->Kp; x++) if (fwrite( (char *) om->rfv[x], sizeof(__m128), Q4, pfp) != Q4) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); for (x = 0; x < p7O_NXSTATES; x++) if (fwrite( (char *) om->xf[x], sizeof(float), p7O_NXTRANS, pfp) != p7O_NXTRANS) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) om->cutoff, sizeof(float), p7_NCUTOFFS, pfp) != p7_NCUTOFFS) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->nj), sizeof(float), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->mode), sizeof(int), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(om->L) , sizeof(int), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); if (fwrite((char *) &(v3f_pmagic), sizeof(uint32_t), 1, pfp) != 1) ESL_EXCEPTION_SYS(eslEWRITE, "oprofile write failed"); /* sentinel */ return eslOK; }
/* Function: p7_oprofile_ReadRest() * Synopsis: Read the rest of an optimized profile. * * Purpose: Read the rest of an optimized profile <om> from * the <.h3p> file associated with an open HMM * file <hfp>. * * This is the second part of a two-part calling sequence. * The <om> here must be the result of a previous * successful <p7_oprofile_ReadMSV()> call on the same * open <hfp>. * * Args: hfp - open HMM file, from which we've previously * called <p7_oprofile_ReadMSV()>. * om - optimized profile that was successfully * returned by <p7_oprofile_ReadMSV()>. * * Returns: <eslOK> on success, and <om> is now a complete * optimized profile. * * Returns <eslEFORMAT> if <hfp> has no <.h3p> file open, * or on any parsing error, and set <hfp->errbuf> to * an informative error message. * * Throws: <eslESYS> if an <fseek()> fails to reposition the * binary <.h3p> file. * * <eslEMEM> on allocation error. */ int p7_oprofile_ReadRest(P7_HMMFILE *hfp, P7_OPROFILE *om) { uint32_t magic; int M, Q4, Q8; int x,n; char *name = NULL; int alphatype; int status; #ifdef HMMER_THREADS /* lock the mutex to prevent other threads from reading from the optimized * profile at the same time. */ if (hfp->syncRead) { if (pthread_mutex_lock (&hfp->readMutex) != 0) ESL_EXCEPTION(eslESYS, "mutex lock failed"); } #endif hfp->errbuf[0] = '\0'; if (hfp->pfp == NULL) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "no MSV profile file; hmmpress probably wasn't run"); /* Position the <hfp->pfp> using offset stored in <om> */ if (fseeko(hfp->pfp, om->offs[p7_POFFSET], SEEK_SET) != 0) ESL_EXCEPTION(eslESYS, "fseeko() failed"); if (! fread( (char *) &magic, sizeof(uint32_t), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read magic"); if (magic == v3a_pmagic) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "binary auxfiles are in an outdated HMMER format (3/a); please hmmpress your HMM file again"); if (magic == v3b_pmagic) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "binary auxfiles are in an outdated HMMER format (3/b); please hmmpress your HMM file again"); if (magic == v3c_pmagic) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "binary auxfiles are in an outdated HMMER format (3/c); please hmmpress your HMM file again"); if (magic == v3d_pmagic) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "binary auxfiles are in an outdated HMMER format (3/d); please hmmpress your HMM file again"); if (magic == v3e_pmagic) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "binary auxfiles are in an outdated HMMER format (3/e); please hmmpress your HMM file again"); if (magic != v3f_pmagic) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "bad magic; not an HMM database file?"); if (! fread( (char *) &M, sizeof(int), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read model size M"); if (! fread( (char *) &alphatype, sizeof(int), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read alphabet type"); if (! fread( (char *) &n, sizeof(int), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read name length"); if (M != om->M) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "p/f model length mismatch"); if (alphatype != om->abc->type) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "p/f alphabet type mismatch"); ESL_ALLOC(name, sizeof(char) * (n+1)); if (! fread( (char *) name, sizeof(char), n+1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read name"); if (strcmp(name, om->name) != 0) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "p/f name mismatch"); if (! fread((char *) &n, sizeof(int), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read accession length"); if (n > 0) { ESL_ALLOC(om->acc, sizeof(char) * (n+1)); if (! fread( (char *) om->acc, sizeof(char), n+1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read accession"); } if (! fread((char *) &n, sizeof(int), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read description length"); if (n > 0) { ESL_ALLOC(om->desc, sizeof(char) * (n+1)); if (! fread( (char *) om->desc, sizeof(char), n+1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read description"); } if (! fread((char *) om->rf, sizeof(char), M+2, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read rf annotation"); if (! fread((char *) om->mm, sizeof(char), M+2, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read mm annotation"); if (! fread((char *) om->cs, sizeof(char), M+2, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read cs annotation"); if (! fread((char *) om->consensus, sizeof(char), M+2, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read consensus annotation"); Q4 = P7_NVF(om->M); Q8 = P7_NVW(om->M); if (! fread((char *) om->twv, sizeof(__m128i), 8*Q8, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read <tu>, vitfilter transitions"); for (x = 0; x < om->abc->Kp; x++) if (! fread( (char *) om->rwv[x], sizeof(__m128i), Q8, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read <ru>[%d], vitfilter emissions for sym %c", x, om->abc->sym[x]); for (x = 0; x < p7O_NXSTATES; x++) if (! fread( (char *) om->xw[x], sizeof(int16_t), p7O_NXTRANS, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read <xu>[%d], vitfilter special transitions", x); if (! fread((char *) &(om->scale_w), sizeof(float), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read scale_w"); if (! fread((char *) &(om->base_w), sizeof(int16_t), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read base_w"); if (! fread((char *) &(om->ddbound_w), sizeof(int16_t), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read ddbound_w"); if (! fread((char *) &(om->ncj_roundoff), sizeof(float), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read ddbound_w"); if (! fread((char *) om->tfv, sizeof(__m128), 8*Q4, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read <tf> transitions"); for (x = 0; x < om->abc->Kp; x++) if (! fread( (char *) om->rfv[x], sizeof(__m128), Q4, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read <rf>[%d] emissions for sym %c", x, om->abc->sym[x]); for (x = 0; x < p7O_NXSTATES; x++) if (! fread( (char *) om->xf[x], sizeof(float), p7O_NXTRANS, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read <xf>[%d] special transitions", x); if (! fread((char *) om->cutoff, sizeof(float), p7_NCUTOFFS, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read Pfam score cutoffs"); if (! fread((char *) &(om->nj), sizeof(float), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read nj"); if (! fread((char *) &(om->mode), sizeof(int), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read mode"); if (! fread((char *) &(om->L) , sizeof(int), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "failed to read L"); /* record ends with magic sentinel, for detecting binary file corruption */ if (! fread( (char *) &magic, sizeof(uint32_t), 1, hfp->pfp)) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "no sentinel magic: .h3p file corrupted?"); if (magic != v3f_pmagic) ESL_XFAIL(eslEFORMAT, hfp->errbuf, "bad sentinel magic; .h3p file corrupted?"); #ifdef HMMER_THREADS if (hfp->syncRead) { if (pthread_mutex_unlock (&hfp->readMutex) != 0) ESL_EXCEPTION(eslESYS, "mutex unlock failed"); } #endif free(name); return eslOK; ERROR: #ifdef HMMER_THREADS if (hfp->syncRead) { if (pthread_mutex_unlock (&hfp->readMutex) != 0) ESL_EXCEPTION(eslESYS, "mutex unlock failed"); } #endif if (name != NULL) free(name); return status; }