Debian Codegraph @

hmmer/src/hmmpgmd2msa.c

raw symbols SCIP
1 /* Function for conversion of binary data to MSA.
2 *
3 * Contents:
4 * 1. The <esl_msa_hmmpgmd2msa> function
5 * 2. Test driver
6 */
7 #include <p7_config.h>
8
9 #include <stdlib.h>
10 #include <stdio.h>
11 #include <string.h>
12
13 #include "hmmer.h"
14 #include "hmmpgmd.h"
15
16 #include "esl_sqio.h"
17
18
19 /******************************************************************************
20 *# 1. The <hmmpgmd2msa> function
21 *****************************************************************************/
22
23
24
25 /* Function: hmmpgmd2msa()
26 * Synopsis: Convert an HMMPGMD-derived data stream to an MSA, based
27 * on the corresponding hmm
28 *
29 * Purpose: Given a data stream from HMMPGMD of the form shown
30 * here, produce an MSA:
31 * HMMD_SEARCH_STATS
32 * P7_HITS array of size (nhits) from above?
33 * then repeats of P7_DOMAIN and P7_ALIDISPLAY data
34 * for the hits, where each hit with d domains
35 * produces
36 * d P7_DOMAINs
37 * then
38 * d P7_ALIDISPLAYs
39 * ... optionally adding a sequence with length matching
40 * that of the hmm, which will be included in the alignment.
41 *
42 * A further extension has been the ability to include or exclude
43 * sequences form the list of hits.
44 *
45 * This function's expected use is as a helper function for
46 * the hmmer website, which gets the above data stream from
47 * hmmpgmd.
48 *
49 * Args : data: a pointer to binary data in the format given above
50 * hmm: the HMM against which the alidisplay traces and
51 * additional sequences/traces are threaded to reach
52 * the returned msa.
53 * qsq : optional sequence to be included in the output msa;
54 * must have the same number of residues as the hmm
55 * has states, as each residue i will be aligned to
56 * state i.
57 * incl: optional array of sequence names, in the case of
58 * hmmpgmd a list of ints, which are are excluded due
59 * to the sequence threshold, but have been selected
60 * to be included in the alignment. This ties in
61 * with the way jackhmmer is implemented on the
62 * HMMER website.
63 * incl_size: required size of the incl array. zero if incl is null.
64 * excl: optional array of sequence names, in the case of
65 * hmmpgmd a list of ints, which are are included as they
66 * score above threshold, but have been selected
67 * to be excluded from the alignment.
68 * excl_size: required size of the excl array. zero if excl is null.
69 *
70 *
71 * Returns: Pointer to completed MSA object. NULL on error
72 *
73 */
74 int
75 hmmpgmd2msa(void *data, P7_HMM *hmm, ESL_SQ *qsq, int *incl, int incl_size, int *excl, int excl_size, int excl_all, ESL_MSA **ret_msa)
76 {
77 HMMD_SEARCH_STATS *stats = NULL; // pointer to a single stats object, at the beginning of data
78 P7_TRACE *qtr = NULL; // trace of the query sequence with N residues onto model with N match states
79 P7_TOPHITS *th = NULL;
80 ESL_MSA *msa = NULL;
81 char *p = (char*)data; // pointer used to walk along data, must be char* to allow pointer arithmetic
82 int extra_sqcnt = 0;
83 uint32_t n = 0;
84 int i;
85 int c;
86 int status;
87
88
89 th = p7_tophits_Create();
90 ESL_ALLOC(stats, sizeof(HMMD_SEARCH_STATS));
91 stats->hit_offsets = NULL; // we don't use hit_offsets for this test
92 /* optionally build a faux trace for the query sequence: relative to core model (B->M_1..M_L->E) */
93 if (qsq != NULL) {
94 if (qsq->n != hmm->M) {
95 status = eslFAIL;
96 goto ERROR;
97 }
98
99 if ((qtr = p7_trace_Create()) == NULL) {status = eslFAIL; goto ERROR; }
100 if ((status = p7_trace_Append(qtr, p7T_B, 0, 0)) != eslOK) goto ERROR;
101 for (i = 1; i <= qsq->n; i++)
102 if ((status = p7_trace_Append(qtr, p7T_M, i, i)) != eslOK) goto ERROR;
103 if ((status = p7_trace_Append(qtr, p7T_E, 0, 0)) != eslOK) goto ERROR;
104 qtr->M = qsq->n;
105 qtr->L = qsq->n;
106 extra_sqcnt = 1;
107 }
108
109 /* get search stats + hit info */
110 if(p7_hmmd_search_stats_Deserialize((uint8_t *) p, &n, stats) != eslOK){
111 status = eslFAIL;
112 goto ERROR;
113 }
114
115 /* sanity check */
116 if ( ( stats->Z_setby != p7_ZSETBY_NTARGETS && stats->Z_setby != p7_ZSETBY_OPTION && stats->Z_setby != p7_ZSETBY_FILEINFO )
117 || ( stats->domZ_setby != p7_ZSETBY_NTARGETS && stats->domZ_setby != p7_ZSETBY_OPTION && stats->domZ_setby != p7_ZSETBY_FILEINFO )
118 || stats->nhits > 10000000
119 || stats->elapsed > 1000000
120 ) {
121 status = eslFAIL;
122 goto ERROR;
123 }
124
125 /* ok, it looks legitimate */
126 while(stats->nhits > th->Nalloc){ // make sure we have enough space in the tophits structure
127 p7_tophits_Grow(th);
128 }
129
130 // deserialize all the hits
131 for (i = 0; i < stats->nhits; ++i) {
132 // set all internal pointers of the hit to NULL before deserializing into it
133 th->unsrt[i].name = NULL;
134 th->unsrt[i].acc = NULL;
135 th->unsrt[i].desc = NULL;
136 th->unsrt[i].dcl = NULL;
137
138 if(p7_hit_Deserialize((uint8_t *) p, &n, &(th->unsrt[i])) != eslOK){
139 printf("Unable to deserialize hit %d\n", i);
140 exit(0);
141 }
142 }
143
144 for (i=0; i<stats->nhits; i++) {
145 th->hit[i] = &(th->unsrt[i]);
146 if ( th->hit[i]->ndom > 10000
147 || th->hit[i]->flags > p7_IS_INCLUDED + p7_IS_REPORTED + p7_IS_NEW + p7_IS_DROPPED + p7_IS_DUPLICATE
148 ) {
149 status = eslFAIL;
150 goto ERROR;
151 }
152 }
153
154 // th.unsrt = NULL;
155 th->N = stats->nhits;
156 th->nreported = 0;
157 th->nincluded = 0;
158 th->is_sorted_by_sortkey = 0;
159 th->is_sorted_by_seqidx = 0;
160
161 /* jackhmmer (hmmer web) - allow all hits to be unchecked */
162 if(excl_all){
163 for (i = 0; i < th->N; i++) {
164 /* Go through the hits and set all to be excluded */
165 if(th->hit[i]->flags & p7_IS_INCLUDED){
166 th->hit[i]->flags = p7_IS_DROPPED;
167 th->hit[i]->nincluded = 0;
168 }
169 }
170 }
171
172 for (i = 0; i < th->N; i++) {
173 /* Go through the hits and set to be excluded or included as necessary */
174 if(th->hit[i]->flags & p7_IS_INCLUDED){
175 if(excl_size > 0){
176 for( c = 0; c < excl_size; c++){
177 if(excl[c] == (long)(th->hit[i]->name) ){
178 th->hit[i]->flags = p7_IS_DROPPED;
179 th->hit[i]->nincluded = 0;
180 break;
181 }
182 }
183 }
184 }else{
185 if(incl_size > 0){
186 for( c = 0; c < incl_size; c++){
187 if(incl[c] == (long)th->hit[i]->name ){
188 th->hit[i]->flags = p7_IS_INCLUDED;
189 }
190 }
191 }
192 }
193 }
194
195
196 /* use the tophits and trace info above to produce an alignment */
197 if ( (status = p7_tophits_Alignment(th, hmm->abc, &qsq, &qtr, extra_sqcnt, p7_ALL_CONSENSUS_COLS, &msa)) != eslOK) goto ERROR;
198 esl_msa_SetName (msa, hmm->name, -1);
199 esl_msa_SetAccession(msa, hmm->acc, -1);
200 esl_msa_SetDesc (msa, hmm->desc, -1);
201 esl_msa_FormatAuthor(msa, "hmmpgmd (HMMER %s)", HMMER_VERSION);
202
203 if (qtr != NULL) free(qtr);
204 p7_tophits_Destroy(th);
205
206 free(stats);
207 *ret_msa = msa;
208 return eslOK;
209
210 ERROR:
211 if (qtr != NULL) free(qtr);
212 p7_tophits_Destroy(th);
213 if(stats != NULL) free(stats);
214 return status;
215 }
216
217 /******************************************************************************
218 *# 2. The <hmmpgmd2stats> function
219 *****************************************************************************/
220
221
222 // This function is believed to be defunct. Name has been changed by adding _old so that EBI can verify
223 /* Function: hmmpgmd2stats()
224 * Synopsis: Use a HMMPGMD-derived data stream to extract some simple
225 * statistics regarding its alignment.
226 * Purpose: Given a data stream from HMMPGMD of the form shown
227 * here, produce a vector of floats:
228 * positions 0 to hmm->M-1 are:
229 * Fraction of alignments which cover model at that position
230 * positions hmm->M to hmm->M*2-1
231 * Fraction of alignments which cover model at that position (mod hmm->M)
232 * with a similar residue
233 * positions hmm->M*2 to hmm->M*3-1
234 * Fraction of alignments which cover model at that position (mod hmm->M)
235 * with the consensus residue
236 *
237 * Args : data: a pointer to binary data in the format given above
238 * hmm: the HMM against which the alidisplay traces and
239 * additional sequences/traces are threaded to reach
240 * the returned msa.
241 *
242 * Returns: the location where the output vector will be placed.
243 * caller is responsible for freeing it later
244 *
245 */
246 int hmmpgmd2stats_old(void *data, P7_HMM *hmm, float** statsOut)
247 {
248 int i, j, k;
249 int status;
250
251 /* trace of the query sequence with N residues onto model with N match states */
252 P7_TRACE *qtr = NULL;
253
254 /* vars used to read from the binary data */
255 HMMD_SEARCH_STATS *stats = NULL; /* pointer to a single stats object, at the beginning of data */
256 P7_HIT *hits = NULL; /* an array of hits, at the appropriate offset in data */
257
258 P7_TOPHITS th;
259 P7_DOMAIN *dom;
260 P7_ALIDISPLAY *ad, *ad2;
261
262 int *cover, *id, *similar; //store statistics result per hit
263 int readPos, writePos; //for converting alignment contents into model indexing
264
265 char *p = (char*)data; /*pointer used to walk along data, must be char* to allow pointer arithmetic */
266
267 th.N = 0;
268 th.unsrt = NULL;
269 th.hit = NULL;
270
271 //storage for output
272 ESL_ALLOC( *statsOut, sizeof(float) * hmm->M * 3);
273
274 //storage for accumulation per hit
275 ESL_ALLOC( cover, sizeof(int) * hmm->M);
276 ESL_ALLOC( id, sizeof(int) * hmm->M);
277 ESL_ALLOC( similar, sizeof(int) * hmm->M);
278 for(k = 0; k < hmm->M; k++)
279 {
280 cover[k] = 0;
281 id[k] = 0;
282 similar[k] = 0;
283
284 (*statsOut)[k ] = 0;
285 (*statsOut)[k+hmm->M ] = 0;
286 (*statsOut)[k+hmm->M*2] = 0;
287 }
288
289 /* get search stats + hit info */
290 stats = (HMMD_SEARCH_STATS*)p;
291
292 /* sanity check */
293 if ( ( stats->Z_setby != p7_ZSETBY_NTARGETS && stats->Z_setby != p7_ZSETBY_OPTION && stats->Z_setby != p7_ZSETBY_FILEINFO )
294 || ( stats->domZ_setby != p7_ZSETBY_NTARGETS && stats->domZ_setby != p7_ZSETBY_OPTION && stats->domZ_setby != p7_ZSETBY_FILEINFO )
295 || stats->nhits > 10000000
296 || stats->elapsed > 1000000
297 ) {
298 status = eslFAIL;
299 goto ERROR;
300 }
301
302 /* ok, it looks legitimate */
303 p += sizeof(HMMD_SEARCH_STATS);
304 hits = (P7_HIT*)p;
305 p += sizeof(P7_HIT) * stats->nhits;
306
307 /* create a tophits object, use it to step through the alignments */
308 ESL_ALLOC( th.unsrt, sizeof(P7_HIT) * stats->nhits);
309 memcpy( th.unsrt, hits, sizeof(P7_HIT) * stats->nhits);
310 ESL_ALLOC( th.hit, sizeof(P7_HIT*) * stats->nhits);
311 for (i=0; i<stats->nhits; i++) {
312 th.hit[i] = &(th.unsrt[i]);
313 if ( th.hit[i]->ndom > 10000
314 || th.hit[i]->flags > p7_IS_INCLUDED + p7_IS_REPORTED + p7_IS_NEW + p7_IS_DROPPED + p7_IS_DUPLICATE
315 ) {
316 status = eslFAIL;
317 goto ERROR;
318 }
319 }
320
321 th.N = stats->nhits;
322 th.nreported = 0;
323 th.nincluded = 0;
324 th.is_sorted_by_sortkey = 0;
325 th.is_sorted_by_seqidx = 0;
326
327 for (i = 0; i < th.N; i++)
328 {
329 ESL_ALLOC( th.hit[i]->dcl, sizeof(P7_DOMAIN) * th.hit[i]->ndom);
330
331 if(th.hit[i]->flags & p7_IS_INCLUDED) th.nincluded++;
332
333 /* first grab all the P7_DOMAINs for the hit */
334 for (j=0; j < th.hit[i]->ndom; j++)
335 {
336 dom = (P7_DOMAIN*)p;
337 th.hit[i]->dcl[j].is_included = dom->is_included;
338 p += sizeof(P7_DOMAIN);
339 }
340
341 /* then grab the P7_ALIDISPLAYs for the hit */
342 for (j=0; j < th.hit[i]->ndom; j++)
343 {
344 ad = (P7_ALIDISPLAY*)p;
345 ESL_ALLOC(th.hit[i]->dcl[j].ad, sizeof(P7_ALIDISPLAY));
346 ad2 = th.hit[i]->dcl[j].ad;
347
348 ad2->memsize = ad->memsize;
349 ad2->rfline = ad->rfline;
350 ad2->mmline = ad->mmline;
351
352 ad2->csline = ad->csline ;
353 ad2->model = ad->model ;
354 ad2->mline = ad->mline ;
355 ad2->aseq = ad->aseq ;
356 ad2->ppline = ad->ppline;
357 ad2->N = ad->N;
358
359 ad2->hmmname = ad->hmmname;
360 ad2->hmmacc = ad->hmmacc ;
361 ad2->hmmdesc = ad->hmmdesc;
362 ad2->hmmfrom = ad->hmmfrom;
363 ad2->hmmto = ad->hmmto;
364 ad2->M = ad->M;
365
366 ad2->sqname = ad->sqname;
367 ad2->sqacc = ad->sqacc ;
368 ad2->sqdesc = ad->sqdesc;
369 ad2->sqfrom = ad->sqfrom;
370 ad2->sqto = ad->sqto;
371 ad2->L = ad->L;
372
373 p += sizeof(P7_ALIDISPLAY);
374
375 ESL_ALLOC(ad2->mem, ad2->memsize);
376
377 memcpy(ad2->mem, p, ad->memsize);
378
379 p += ad2->memsize;
380
381 p7_alidisplay_Deserialize_old(ad2);
382
383 if(th.hit[i]->flags & p7_IS_INCLUDED && th.hit[i]->dcl[j].is_included)
384 {
385 writePos = ad2->hmmfrom-1;
386 readPos = 0;
387 while(readPos < ad2->N)
388 {
389 //check if model covers residue
390 if(isupper(ad2->aseq[readPos]) || ad2->aseq[readPos] == '-')
391 {
392 cover[writePos]++;
393
394 //check mline for id
395 if(isalpha(ad2->mline[readPos]))
396 {
397 id[writePos]++;
398 similar[writePos]++;
399 }
400 //check mline for not-a-space
401 else if(ad2->mline[readPos] == '+')
402 {
403 similar[writePos]++;
404 }
405 writePos++;
406 }
407 readPos++;
408 }
409 }
410 }
411
412 //increment output, adjusting for overlaps
413 for(k = 0; k < hmm->M; k++)
414 {
415 if(cover[k]) (*statsOut)[k]+=1.0;
416
417 if(id[k]) (*statsOut)[k+hmm->M]+=(id[k]/cover[k]);
418 id[k] = 0;
419
420 if(similar[k]) (*statsOut)[k+hmm->M*2]+=(similar[k]/cover[k]);
421 similar[k] = 0;
422
423 cover[k] = 0;
424 }
425
426 }
427
428 for(i = 0; i < hmm->M*3; i++)
429 {
430 (*statsOut)[i] = (*statsOut)[i]/(th.nincluded);
431 }
432
433 for(i = hmm->M; i < hmm->M*3; i++)
434 {
435 if((*statsOut)[i%hmm->M])
436 {
437 (*statsOut)[i] = (*statsOut)[i]/(*statsOut)[i%hmm->M];
438 }
439 else
440 {
441 (*statsOut)[i] = 0.0;
442 }
443 }
444
445
446 /* free memory */
447 if (qtr != NULL) free(qtr);
448 qtr = NULL;
449
450 for (i = 0; i < th.N; i++) {
451 for (j=0; j < th.hit[i]->ndom; j++)
452 if(th.hit[i]->dcl[j].ad)
453 {
454 p7_alidisplay_Destroy(th.hit[i]->dcl[j].ad);
455 th.hit[i]->dcl[j].ad = NULL;
456 }
457
458 if (th.hit[i]->dcl != NULL) free (th.hit[i]->dcl);
459 th.hit[i]->dcl = NULL;
460 }
461 if (th.unsrt != NULL) free (th.unsrt);
462 th.unsrt = NULL;
463 if (th.hit != NULL) free (th.hit);
464 th.hit = NULL;
465
466 return eslOK;
467
468 ERROR:
469 /* free memory */
470 if (qtr != NULL) free(qtr);
471 qtr = NULL;
472
473 for (i = 0; i < th.N; i++) {
474 for (j=0; j < th.hit[i]->ndom; j++)
475 if(th.hit[i]->dcl[j].ad)
476 {
477 p7_alidisplay_Destroy(th.hit[i]->dcl[j].ad);
478 th.hit[i]->dcl[j].ad = NULL;
479 }
480
481 if (th.hit[i]->dcl != NULL) free (th.hit[i]->dcl);
482 th.hit[i]->dcl = NULL;
483 }
484 if (th.unsrt != NULL) free (th.unsrt);
485 th.unsrt = NULL;
486 if (th.hit != NULL) free (th.hit);
487 th.hit = NULL;
488
489
490 return status;
491 }
492
493
494
495
496 /*****************************************************************
497 * 3. Test driver
498 *****************************************************************/
499
500 //#define hmmpgmd2msa_TESTDRIVE
501 #ifdef p7HMMPGMD2MSA_TESTDRIVE
502 #define NUM_TEST_SEQUENCES 20
503
504 void hmmpgmd2msa_utest(int ntrials, char *hmmfile){
505 char msg[] = "hmmpgmd2msa_utest failed";
506 ESL_RANDOMNESS *rng = esl_randomness_Create(0);
507 P7_HMM *hmm;
508 ESL_ALPHABET *abc = esl_alphabet_Create(eslAMINO);
509 P7_OPROFILE *oprofile;
510 P7_TOPHITS *hitlist;
511 P7_HMMFILE *hfp = NULL;
512 P7_BG *bg = p7_bg_Create(abc);
513 ESL_MSA *msa, *deser_msa;
514 ESL_SQ * sequences[NUM_TEST_SEQUENCES];
515 uint8_t **buf, *buf_data;
516 HMMD_SEARCH_STATS stats;
517 uint32_t n = 0;
518 uint32_t nalloc = 0;
519 int i, j, k;
520
521 buf_data = NULL;
522 buf = &(buf_data);
523
524 // Grab the HMM from the input file
525 if (p7_hmmfile_Open(hmmfile, NULL, &hfp, NULL) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
526 if (p7_hmmfile_Read(hfp, &abc, &hmm) != eslOK) p7_Fail("Failed to read HMM");
527 p7_hmmfile_Close(hfp);
528
529 P7_PROFILE *profile = p7_profile_Create(hmm->M, abc);
530 oprofile = p7_oprofile_Create(hmm->M, abc);
531
532 if(p7_ProfileConfig(hmm, bg, profile, 400, p7_LOCAL) != eslOK){
533 p7_Fail(msg);
534 }
535 if(p7_oprofile_Convert(profile, oprofile) != eslOK){
536 p7_Fail(msg);
537 }
538
539 // build a pipeline to search them with
540 P7_PIPELINE *pli=p7_pipeline_Create(NULL, hmm->M, 400, FALSE, p7_SEARCH_SEQS);
541 p7_pli_NewModel(pli, oprofile, bg);
542
543 for(j = 0; j < ntrials; j++){
544
545 // sample sequences from the HMM
546 for(i = 0; i < NUM_TEST_SEQUENCES; i++){
547 sequences[i] = esl_sq_CreateDigital(abc);
548 p7_ProfileEmit(rng, hmm, profile, bg, sequences[i], NULL);
549 }
550
551 hitlist = p7_tophits_Create();
552
553 // Search all of the sampled sequences against the HMM to generate a set of hits
554 for(i = 0; i < NUM_TEST_SEQUENCES; i++){
555 p7_pli_NewSeq(pli, sequences[i]);
556 p7_bg_SetLength(bg, sequences[i]->n);
557 p7_oprofile_ReconfigLength(oprofile, sequences[i]->n);
558
559 p7_Pipeline(pli, oprofile, bg, sequences[i], NULL, hitlist);
560 p7_pipeline_Reuse(pli);
561 }
562
563
564 // Replicate the process hmmpgmd2msa uses to create an MSA so we have something to compare to
565 p7_tophits_SortBySortkey(hitlist);
566 p7_tophits_Threshold(hitlist, pli);
567 if (p7_tophits_Alignment(hitlist, abc, NULL, NULL, 0, p7_ALL_CONSENSUS_COLS, &msa) != eslOK){
568 p7_Fail(msg);
569 }
570
571 esl_msa_SetName (msa, hmm->name, -1);
572 esl_msa_SetAccession(msa, hmm->acc, -1);
573 esl_msa_SetDesc (msa, hmm->desc, -1);
574 esl_msa_FormatAuthor(msa, "hmmpgmd (HMMER %s)", HMMER_VERSION);
575
576
577 // ok, we have an MSA generated directly from the hits. Now, fake up a blob of serialized data as hmmpgmd would have sent
578 stats.elapsed = esl_random(rng);
579 stats.user = esl_random(rng);
580 stats.sys = esl_random(rng);
581 stats.Z = pli->Z;
582 stats.domZ = pli->domZ;
583 stats.Z_setby = pli->Z_setby;
584 stats.domZ_setby = pli->domZ_setby;
585 stats.nmodels = pli->nmodels;
586 stats.nseqs = pli->nseqs;
587 stats.n_past_msv = pli->n_past_msv;
588 stats.n_past_bias = pli->n_past_bias;
589 stats.n_past_vit = pli->n_past_vit;
590 stats.n_past_fwd = pli->n_past_fwd;
591 stats.nhits = hitlist->N;
592 stats.nreported = hitlist->nreported;
593 stats.nincluded = hitlist->nreported;
594 stats.hit_offsets = NULL; // don't need this for hmmpgmd2msa
595
596 if(p7_hmmd_search_stats_Serialize(&stats, buf, &n, &nalloc) !=eslOK){
597 p7_Fail(msg);
598 }
599
600 for(k = 0; k < hitlist->N; k++){
601 if(p7_hit_Serialize(hitlist->hit[k], buf, &n, &nalloc) !=eslOK){
602 p7_Fail(msg);
603 }
604 }
605
606 if(hmmpgmd2msa(buf_data, hmm, NULL, NULL, 0, NULL, 0, 0, &deser_msa) != eslOK){
607 p7_Fail(msg);
608 }
609
610 // compare the MSAs
611 if(esl_msa_Compare (msa, deser_msa) != eslOK){
612 p7_Fail(msg);
613 }
614
615 // clean up after ourselves
616 p7_tophits_Destroy(hitlist);
617 for(k = 0; k < NUM_TEST_SEQUENCES; k++){
618 esl_sq_Destroy(sequences[k]);
619 sequences[k] = NULL;
620 }
621 esl_msa_Destroy(msa);
622 esl_msa_Destroy(deser_msa);
623 n = 0; // reset this to the start of the buffer for next time
624 }
625
626
627
628 // final cleanup
629 p7_pipeline_Destroy(pli);
630 p7_profile_Destroy(profile);
631 p7_oprofile_Destroy(oprofile);
632 p7_hmm_Destroy(hmm);
633 p7_bg_Destroy(bg);
634 esl_alphabet_Destroy(abc);
635 esl_randomness_Destroy(rng);
636 free(buf_data);
637 }
638
639
640 int
641 main(int argc, char **argv) {
642 if(argc != 2){
643 printf("Usage: hmmpgmd2msa_utest <hmmfile>\n");
644 return eslFAIL;
645 }
646 hmmpgmd2msa_utest(10, argv[1]);
647 return eslOK; // hmmpgmd2msa_utest fails if anything goes wrong, so getting here = pass
648 }
649 #endif
650
651
652