1 #include <asn.h>
2
3 #define NLM_GENERATED_CODE_PROTO
4
5 #include <blastpat.h>
6 #include <objblst3.h>
7
8 static Boolean loaded = FALSE;
9
10 #include <blstspc.h>
11
12 #ifndef NLM_EXTERN_LOADS
13 #define NLM_EXTERN_LOADS {}
14 #endif
15
16 NLM_EXTERN Boolean LIBCALL
objblst3AsnLoad(void)17 objblst3AsnLoad(void)
18 {
19
20 if ( ! loaded) {
21 NLM_EXTERN_LOADS
22
23 if ( ! AsnLoad ())
24 return FALSE;
25 loaded = TRUE;
26 }
27
28 return TRUE;
29 }
30
31
32
33 /**************************************************
34 * Generated object loaders for Module NCBI-Blast
35 * Generated using ASNCODE Revision: 6.14 at Apr 16, 2002 11:50 AM
36 *
37 **************************************************/
38
39
40 /**************************************************
41 *
42 * BlastSearchNew()
43 *
44 **************************************************/
45 NLM_EXTERN
46 BlastSearchPtr LIBCALL
BlastSearchNew(void)47 BlastSearchNew(void)
48 {
49 BlastSearchPtr ptr = MemNew((size_t) sizeof(BlastSearch));
50
51 return ptr;
52
53 }
54
55
56 /**************************************************
57 *
58 * BlastSearchFree()
59 *
60 **************************************************/
61 NLM_EXTERN
62 BlastSearchPtr LIBCALL
BlastSearchFree(BlastSearchPtr ptr)63 BlastSearchFree(BlastSearchPtr ptr)
64 {
65
66 if(ptr == NULL) {
67 return NULL;
68 }
69 BioseqFree(ptr -> query);
70 MemFree(ptr -> database);
71 BlastParametersFree(ptr -> parameters);
72 SeqLocFree(ptr -> mask);
73 BlastMatrixFree(ptr -> matrix);
74 BioseqSetFree(ptr -> query_set);
75 return MemFree(ptr);
76 }
77
78
79 /**************************************************
80 *
81 * BlastSearchAsnRead()
82 *
83 **************************************************/
84 NLM_EXTERN
85 BlastSearchPtr LIBCALL
BlastSearchAsnRead(AsnIoPtr aip,AsnTypePtr orig)86 BlastSearchAsnRead(AsnIoPtr aip, AsnTypePtr orig)
87 {
88 DataVal av;
89 AsnTypePtr atp;
90 Boolean isError = FALSE;
91 AsnReadFunc func;
92 BlastSearchPtr ptr;
93
94 if (! loaded)
95 {
96 if (! objblst3AsnLoad()) {
97 return NULL;
98 }
99 }
100
101 if (aip == NULL) {
102 return NULL;
103 }
104
105 if (orig == NULL) { /* BlastSearch ::= (self contained) */
106 atp = AsnReadId(aip, amp, BLAST_SEARCH);
107 } else {
108 atp = AsnLinkType(orig, BLAST_SEARCH);
109 }
110 /* link in local tree */
111 if (atp == NULL) {
112 return NULL;
113 }
114
115 ptr = BlastSearchNew();
116 if (ptr == NULL) {
117 goto erret;
118 }
119 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
120 goto erret;
121 }
122
123 atp = AsnReadId(aip,amp, atp);
124 func = NULL;
125
126 if (atp == BLAST_SEARCH_program) {
127 if ( AsnReadVal(aip, atp, &av) <= 0) {
128 goto erret;
129 }
130 ptr -> program = av.intvalue;
131 atp = AsnReadId(aip,amp, atp);
132 }
133 if (atp == BLAST_SEARCH_query) {
134 ptr -> query = BioseqAsnRead(aip, atp);
135 if (aip -> io_failure) {
136 goto erret;
137 }
138 atp = AsnReadId(aip,amp, atp);
139 }
140 if (atp == BLAST_SEARCH_database) {
141 if ( AsnReadVal(aip, atp, &av) <= 0) {
142 goto erret;
143 }
144 ptr -> database = av.ptrvalue;
145 atp = AsnReadId(aip,amp, atp);
146 }
147 if (atp == BLAST_SEARCH_parameters) {
148 ptr -> parameters = BlastParametersAsnRead(aip, atp);
149 if (aip -> io_failure) {
150 goto erret;
151 }
152 atp = AsnReadId(aip,amp, atp);
153 }
154 if (atp == BLAST_SEARCH_mask) {
155 ptr -> mask = SeqLocAsnRead(aip, atp);
156 if (aip -> io_failure) {
157 goto erret;
158 }
159 atp = AsnReadId(aip,amp, atp);
160 }
161 if (atp == BLAST_SEARCH_matrix) {
162 ptr -> matrix = BlastMatrixAsnRead(aip, atp);
163 if (aip -> io_failure) {
164 goto erret;
165 }
166 atp = AsnReadId(aip,amp, atp);
167 }
168 if (atp == BLAST_SEARCH_return_parts) {
169 if ( AsnReadVal(aip, atp, &av) <= 0) {
170 goto erret;
171 }
172 ptr -> return_parts = av.boolvalue;
173 atp = AsnReadId(aip,amp, atp);
174 }
175 if (atp == BLAST_SEARCH_query_set) {
176 ptr -> query_set = BioseqSetAsnRead(aip, atp);
177 if (aip -> io_failure) {
178 goto erret;
179 }
180 atp = AsnReadId(aip,amp, atp);
181 }
182
183 if (AsnReadVal(aip, atp, &av) <= 0) {
184 goto erret;
185 }
186 /* end struct */
187
188 ret:
189 AsnUnlinkType(orig); /* unlink local tree */
190 return ptr;
191
192 erret:
193 aip -> io_failure = TRUE;
194 ptr = BlastSearchFree(ptr);
195 goto ret;
196 }
197
198
199
200 /**************************************************
201 *
202 * BlastSearchAsnWrite()
203 *
204 **************************************************/
205 NLM_EXTERN Boolean LIBCALL
BlastSearchAsnWrite(BlastSearchPtr ptr,AsnIoPtr aip,AsnTypePtr orig)206 BlastSearchAsnWrite(BlastSearchPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
207 {
208 DataVal av;
209 AsnTypePtr atp;
210 Boolean retval = FALSE;
211
212 if (! loaded)
213 {
214 if (! objblst3AsnLoad()) {
215 return FALSE;
216 }
217 }
218
219 if (aip == NULL) {
220 return FALSE;
221 }
222
223 atp = AsnLinkType(orig, BLAST_SEARCH); /* link local tree */
224 if (atp == NULL) {
225 return FALSE;
226 }
227
228 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
229 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
230 goto erret;
231 }
232
233 av.intvalue = ptr -> program;
234 retval = AsnWrite(aip, BLAST_SEARCH_program, &av);
235 if (ptr -> query != NULL) {
236 if ( ! BioseqAsnWrite(ptr -> query, aip, BLAST_SEARCH_query)) {
237 goto erret;
238 }
239 }
240 if (ptr -> database != NULL) {
241 av.ptrvalue = ptr -> database;
242 retval = AsnWrite(aip, BLAST_SEARCH_database, &av);
243 }
244 if (ptr -> parameters != NULL) {
245 if ( ! BlastParametersAsnWrite(ptr -> parameters, aip, BLAST_SEARCH_parameters)) {
246 goto erret;
247 }
248 }
249 if (ptr -> mask != NULL) {
250 if ( ! SeqLocAsnWrite(ptr -> mask, aip, BLAST_SEARCH_mask)) {
251 goto erret;
252 }
253 }
254 if (ptr -> matrix != NULL) {
255 if ( ! BlastMatrixAsnWrite(ptr -> matrix, aip, BLAST_SEARCH_matrix)) {
256 goto erret;
257 }
258 }
259 av.boolvalue = ptr -> return_parts;
260 retval = AsnWrite(aip, BLAST_SEARCH_return_parts, &av);
261 if (ptr -> query_set != NULL) {
262 if ( ! BioseqSetAsnWrite(ptr -> query_set, aip, BLAST_SEARCH_query_set)) {
263 goto erret;
264 }
265 }
266 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
267 goto erret;
268 }
269 retval = TRUE;
270
271 erret:
272 AsnUnlinkType(orig); /* unlink local tree */
273 return retval;
274 }
275
276
277
278 /**************************************************
279 *
280 * BlastRequestFree()
281 *
282 **************************************************/
283 NLM_EXTERN
284 BlastRequestPtr LIBCALL
BlastRequestFree(ValNodePtr anp)285 BlastRequestFree(ValNodePtr anp)
286 {
287 Pointer pnt;
288
289 if (anp == NULL) {
290 return NULL;
291 }
292
293 pnt = anp->data.ptrvalue;
294 switch (anp->choice)
295 {
296 default:
297 break;
298 case BlastRequest_init:
299 MemFree(anp -> data.ptrvalue);
300 break;
301 case BlastRequest_db_info_specific:
302 BlastDbinfoGetFree(anp -> data.ptrvalue);
303 break;
304 case BlastRequest_matrix_get:
305 MemFree(anp -> data.ptrvalue);
306 break;
307 case BlastRequest_search:
308 BlastSearchFree(anp -> data.ptrvalue);
309 break;
310 case BlastRequest_db_seq_get:
311 BlastSeqIdFree(anp -> data.ptrvalue);
312 break;
313 case BlastRequest_db_redundant_ids_get:
314 BlastSeqIdFree(anp -> data.ptrvalue);
315 break;
316 case BlastRequest_db_redundant_descr_get:
317 BlastSeqIdFree(anp -> data.ptrvalue);
318 break;
319 }
320 return MemFree(anp);
321 }
322
323
324 /**************************************************
325 *
326 * BlastRequestAsnRead()
327 *
328 **************************************************/
329 NLM_EXTERN
330 BlastRequestPtr LIBCALL
BlastRequestAsnRead(AsnIoPtr aip,AsnTypePtr orig)331 BlastRequestAsnRead(AsnIoPtr aip, AsnTypePtr orig)
332 {
333 DataVal av;
334 AsnTypePtr atp;
335 ValNodePtr anp;
336 Uint1 choice;
337 Boolean isError = FALSE;
338 Boolean nullIsError = FALSE;
339 AsnReadFunc func;
340
341 if (! loaded)
342 {
343 if (! objblst3AsnLoad()) {
344 return NULL;
345 }
346 }
347
348 if (aip == NULL) {
349 return NULL;
350 }
351
352 if (orig == NULL) { /* BlastRequest ::= (self contained) */
353 atp = AsnReadId(aip, amp, BLAST_REQUEST);
354 } else {
355 atp = AsnLinkType(orig, BLAST_REQUEST); /* link in local tree */
356 }
357 if (atp == NULL) {
358 return NULL;
359 }
360
361 anp = ValNodeNew(NULL);
362 if (anp == NULL) {
363 goto erret;
364 }
365 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
366 goto erret;
367 }
368
369 func = NULL;
370
371 atp = AsnReadId(aip, amp, atp); /* find the choice */
372 if (atp == NULL) {
373 goto erret;
374 }
375 if (atp == BLAST_REQUEST_init) {
376 choice = BlastRequest_init;
377 if (AsnReadVal(aip, atp, &av) <= 0) {
378 goto erret;
379 }
380 anp->data.ptrvalue = av.ptrvalue;
381 }
382 else if (atp == BLAST_REQUEST_motd) {
383 choice = BlastRequest_motd;
384 if (AsnReadVal(aip, atp, &av) <= 0) {
385 goto erret;
386 }
387 anp->data.boolvalue = av.boolvalue;
388 }
389 else if (atp == BLAST_REQUEST_db_info) {
390 choice = BlastRequest_db_info;
391 if (AsnReadVal(aip, atp, &av) <= 0) {
392 goto erret;
393 }
394 anp->data.boolvalue = av.boolvalue;
395 }
396 else if (atp == BLAST_REQUEST_db_info_specific) {
397 choice = BlastRequest_db_info_specific;
398 func = (AsnReadFunc) BlastDbinfoGetAsnRead;
399 }
400 else if (atp == BLAST_REQUEST_matrix_get) {
401 choice = BlastRequest_matrix_get;
402 if (AsnReadVal(aip, atp, &av) <= 0) {
403 goto erret;
404 }
405 anp->data.ptrvalue = av.ptrvalue;
406 }
407 else if (atp == BLAST_REQUEST_search) {
408 choice = BlastRequest_search;
409 func = (AsnReadFunc) BlastSearchAsnRead;
410 }
411 else if (atp == BLAST_REQUEST_db_seq_get) {
412 choice = BlastRequest_db_seq_get;
413 func = (AsnReadFunc) BlastSeqIdAsnRead;
414 }
415 else if (atp == BLAST_REQUEST_db_redundant_ids_get) {
416 choice = BlastRequest_db_redundant_ids_get;
417 func = (AsnReadFunc) BlastSeqIdAsnRead;
418 }
419 else if (atp == BLAST_REQUEST_db_redundant_descr_get) {
420 choice = BlastRequest_db_redundant_descr_get;
421 func = (AsnReadFunc) BlastSeqIdAsnRead;
422 }
423 else if (atp == BLAST_REQUEST_fini) {
424 choice = BlastRequest_fini;
425 if (AsnReadVal(aip, atp, &av) <= 0) {
426 goto erret;
427 }
428 anp->data.boolvalue = av.boolvalue;
429 }
430 anp->choice = choice;
431 if (func != NULL)
432 {
433 anp->data.ptrvalue = (* func)(aip, atp);
434 if (aip -> io_failure) goto erret;
435
436 if (nullIsError && anp->data.ptrvalue == NULL) {
437 goto erret;
438 }
439 }
440
441 ret:
442 AsnUnlinkType(orig); /* unlink local tree */
443 return anp;
444
445 erret:
446 anp = MemFree(anp);
447 aip -> io_failure = TRUE;
448 goto ret;
449 }
450
451
452 /**************************************************
453 *
454 * BlastRequestAsnWrite()
455 *
456 **************************************************/
457 NLM_EXTERN Boolean LIBCALL
BlastRequestAsnWrite(BlastRequestPtr anp,AsnIoPtr aip,AsnTypePtr orig)458 BlastRequestAsnWrite(BlastRequestPtr anp, AsnIoPtr aip, AsnTypePtr orig)
459
460 {
461 DataVal av;
462 AsnTypePtr atp, writetype = NULL;
463 Pointer pnt;
464 AsnWriteFunc func = NULL;
465 Boolean retval = FALSE;
466
467 if (! loaded)
468 {
469 if (! objblst3AsnLoad())
470 return FALSE;
471 }
472
473 if (aip == NULL)
474 return FALSE;
475
476 atp = AsnLinkType(orig, BLAST_REQUEST); /* link local tree */
477 if (atp == NULL) {
478 return FALSE;
479 }
480
481 if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
482
483 av.ptrvalue = (Pointer)anp;
484 if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
485 goto erret;
486 }
487
488 pnt = anp->data.ptrvalue;
489 switch (anp->choice)
490 {
491 case BlastRequest_init:
492 av.ptrvalue = anp->data.ptrvalue;
493 retval = AsnWrite(aip, BLAST_REQUEST_init, &av);
494 break;
495 case BlastRequest_motd:
496 av.boolvalue = anp->data.boolvalue;
497 retval = AsnWrite(aip, BLAST_REQUEST_motd, &av);
498 break;
499 case BlastRequest_db_info:
500 av.boolvalue = anp->data.boolvalue;
501 retval = AsnWrite(aip, BLAST_REQUEST_db_info, &av);
502 break;
503 case BlastRequest_db_info_specific:
504 writetype = BLAST_REQUEST_db_info_specific;
505 func = (AsnWriteFunc) BlastDbinfoGetAsnWrite;
506 break;
507 case BlastRequest_matrix_get:
508 av.ptrvalue = anp->data.ptrvalue;
509 retval = AsnWrite(aip, BLAST_REQUEST_matrix_get, &av);
510 break;
511 case BlastRequest_search:
512 writetype = BLAST_REQUEST_search;
513 func = (AsnWriteFunc) BlastSearchAsnWrite;
514 break;
515 case BlastRequest_db_seq_get:
516 writetype = BLAST_REQUEST_db_seq_get;
517 func = (AsnWriteFunc) BlastSeqIdAsnWrite;
518 break;
519 case BlastRequest_db_redundant_ids_get:
520 writetype = BLAST_REQUEST_db_redundant_ids_get;
521 func = (AsnWriteFunc) BlastSeqIdAsnWrite;
522 break;
523 case BlastRequest_db_redundant_descr_get:
524 writetype = BLAST_REQUEST_db_redundant_descr_get;
525 func = (AsnWriteFunc) BlastSeqIdAsnWrite;
526 break;
527 case BlastRequest_fini:
528 av.boolvalue = anp->data.boolvalue;
529 retval = AsnWrite(aip, BLAST_REQUEST_fini, &av);
530 break;
531 }
532 if (writetype != NULL) {
533 retval = (* func)(pnt, aip, writetype); /* write it out */
534 }
535 if (!retval) {
536 goto erret;
537 }
538 retval = TRUE;
539
540 erret:
541 AsnUnlinkType(orig); /* unlink local tree */
542 return retval;
543 }
544
545
546 /**************************************************
547 *
548 * BlastResponseFree()
549 *
550 **************************************************/
551 NLM_EXTERN
552 BlastResponsePtr LIBCALL
BlastResponseFree(ValNodePtr anp)553 BlastResponseFree(ValNodePtr anp)
554 {
555 Pointer pnt;
556
557 if (anp == NULL) {
558 return NULL;
559 }
560
561 pnt = anp->data.ptrvalue;
562 switch (anp->choice)
563 {
564 default:
565 break;
566 case BlastResponse_init:
567 BlastVersionFree(anp -> data.ptrvalue);
568 break;
569 case BlastResponse_motd:
570 MemFree(anp -> data.ptrvalue);
571 break;
572 case BlastResponse_error:
573 BlastErrorFree(anp -> data.ptrvalue);
574 break;
575 case BlastResponse_db_seq_get:
576 BioseqFree(anp -> data.ptrvalue);
577 break;
578 case BlastResponse_db_redundant_ids_get:
579 AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqIdFree);
580 break;
581 case BlastResponse_db_redundant_descr_get:
582 AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) BlastDeflineFree);
583 break;
584 case BlastResponse_db_info:
585 AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) BlastDbinfoFree);
586 break;
587 case BlastResponse_db_info_specific:
588 BlastDbinfoFree(anp -> data.ptrvalue);
589 break;
590 case BlastResponse_matrix:
591 BlastMatrixFree(anp -> data.ptrvalue);
592 break;
593 case BlastResponse_alignment:
594 SeqAlignSetFree(anp -> data.ptrvalue);
595 break;
596 case BlastResponse_mask:
597 BlastMaskFree(anp -> data.ptrvalue);
598 break;
599 case BlastResponse_kablk:
600 BlastKABlkFree(anp -> data.ptrvalue);
601 break;
602 case BlastResponse_parameters:
603 MemFree(anp -> data.ptrvalue);
604 break;
605 case BlastResponse_queued:
606 BlastQueuedFree(anp -> data.ptrvalue);
607 break;
608 case BlastResponse_start:
609 BlastProgressFree(anp -> data.ptrvalue);
610 break;
611 case BlastResponse_progress:
612 BlastProgressFree(anp -> data.ptrvalue);
613 break;
614 case BlastResponse_done:
615 BlastProgressFree(anp -> data.ptrvalue);
616 break;
617 case BlastResponse_phialign:
618 BlastPhialignFree(anp -> data.ptrvalue);
619 break;
620 case BlastResponse_parts:
621 AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) BlastPartsFree);
622 break;
623 case BlastResponse_mbalign:
624 MegaBlastResultsFree(anp -> data.ptrvalue);
625 break;
626 }
627 return MemFree(anp);
628 }
629
630
631 /**************************************************
632 *
633 * BlastResponseAsnRead()
634 *
635 **************************************************/
636 NLM_EXTERN
637 BlastResponsePtr LIBCALL
BlastResponseAsnRead(AsnIoPtr aip,AsnTypePtr orig)638 BlastResponseAsnRead(AsnIoPtr aip, AsnTypePtr orig)
639 {
640 DataVal av;
641 AsnTypePtr atp;
642 ValNodePtr anp;
643 Uint1 choice;
644 Boolean isError = FALSE;
645 Boolean nullIsError = FALSE;
646 AsnReadFunc func;
647
648 if (! loaded)
649 {
650 if (! objblst3AsnLoad()) {
651 return NULL;
652 }
653 }
654
655 if (aip == NULL) {
656 return NULL;
657 }
658
659 if (orig == NULL) { /* BlastResponse ::= (self contained) */
660 atp = AsnReadId(aip, amp, BLAST_RESPONSE);
661 } else {
662 atp = AsnLinkType(orig, BLAST_RESPONSE); /* link in local tree */
663 }
664 if (atp == NULL) {
665 return NULL;
666 }
667
668 anp = ValNodeNew(NULL);
669 if (anp == NULL) {
670 goto erret;
671 }
672 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
673 goto erret;
674 }
675
676 func = NULL;
677
678 atp = AsnReadId(aip, amp, atp); /* find the choice */
679 if (atp == NULL) {
680 goto erret;
681 }
682 if (atp == BLAST_RESPONSE_init) {
683 choice = BlastResponse_init;
684 func = (AsnReadFunc) BlastVersionAsnRead;
685 }
686 else if (atp == BLAST_RESPONSE_motd) {
687 choice = BlastResponse_motd;
688 if (AsnReadVal(aip, atp, &av) <= 0) {
689 goto erret;
690 }
691 anp->data.ptrvalue = av.ptrvalue;
692 }
693 else if (atp == BLAST_RESPONSE_error) {
694 choice = BlastResponse_error;
695 func = (AsnReadFunc) BlastErrorAsnRead;
696 }
697 else if (atp == BLAST_RESPONSE_db_seq_get) {
698 choice = BlastResponse_db_seq_get;
699 func = (AsnReadFunc) BioseqAsnRead;
700 }
701 else if (atp == BLAST_RESPONSE_db_redundant_ids_get) {
702 choice = BlastResponse_db_redundant_ids_get;
703 anp -> data.ptrvalue =
704 AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqIdAsnRead, (AsnOptFreeFunc) SeqIdFree);
705 if (isError && anp -> data.ptrvalue == NULL) {
706 goto erret;
707 }
708 }
709 else if (atp == BLAST_RESPONSE_db_redundant_descr_get) {
710 choice = BlastResponse_db_redundant_descr_get;
711 anp -> data.ptrvalue =
712 AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BlastDeflineAsnRead, (AsnOptFreeFunc) BlastDeflineFree);
713 if (isError && anp -> data.ptrvalue == NULL) {
714 goto erret;
715 }
716 }
717 else if (atp == BLAST_RESPONSE_db_info) {
718 choice = BlastResponse_db_info;
719 anp -> data.ptrvalue =
720 AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BlastDbinfoAsnRead, (AsnOptFreeFunc) BlastDbinfoFree);
721 if (isError && anp -> data.ptrvalue == NULL) {
722 goto erret;
723 }
724 }
725 else if (atp == BLAST_RESPONSE_db_info_specific) {
726 choice = BlastResponse_db_info_specific;
727 func = (AsnReadFunc) BlastDbinfoAsnRead;
728 }
729 else if (atp == BLAST_RESPONSE_matrix) {
730 choice = BlastResponse_matrix;
731 func = (AsnReadFunc) BlastMatrixAsnRead;
732 }
733 else if (atp == BLAST_RESPONSE_alignment) {
734 choice = BlastResponse_alignment;
735 func = (AsnReadFunc) SeqAlignSetAsnRead;
736 }
737 else if (atp == BLAST_RESPONSE_mask) {
738 choice = BlastResponse_mask;
739 func = (AsnReadFunc) BlastMaskAsnRead;
740 }
741 else if (atp == BLAST_RESPONSE_kablk) {
742 choice = BlastResponse_kablk;
743 func = (AsnReadFunc) BlastKABlkAsnRead;
744 }
745 else if (atp == BLAST_RESPONSE_parameters) {
746 choice = BlastResponse_parameters;
747 if (AsnReadVal(aip, atp, &av) <= 0) {
748 goto erret;
749 }
750 anp->data.ptrvalue = av.ptrvalue;
751 }
752 else if (atp == BLAST_RESPONSE_queued) {
753 choice = BlastResponse_queued;
754 func = (AsnReadFunc) BlastQueuedAsnRead;
755 }
756 else if (atp == BLAST_RESPONSE_start) {
757 choice = BlastResponse_start;
758 func = (AsnReadFunc) BlastProgressAsnRead;
759 }
760 else if (atp == BLAST_RESPONSE_progress) {
761 choice = BlastResponse_progress;
762 func = (AsnReadFunc) BlastProgressAsnRead;
763 }
764 else if (atp == BLAST_RESPONSE_done) {
765 choice = BlastResponse_done;
766 func = (AsnReadFunc) BlastProgressAsnRead;
767 }
768 else if (atp == BLAST_RESPONSE_fini) {
769 choice = BlastResponse_fini;
770 if (AsnReadVal(aip, atp, &av) <= 0) {
771 goto erret;
772 }
773 anp->data.boolvalue = av.boolvalue;
774 }
775 else if (atp == BLAST_RESPONSE_phialign) {
776 choice = BlastResponse_phialign;
777 func = (AsnReadFunc) BlastPhialignAsnRead;
778 }
779 else if (atp == BLAST_RESPONSE_parts) {
780 choice = BlastResponse_parts;
781 anp -> data.ptrvalue =
782 AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BlastPartsAsnRead, (AsnOptFreeFunc) BlastPartsFree);
783 if (isError && anp -> data.ptrvalue == NULL) {
784 goto erret;
785 }
786 }
787 else if (atp == BLAST_RESPONSE_mbalign) {
788 choice = BlastResponse_mbalign;
789 func = (AsnReadFunc) MegaBlastResultsAsnRead;
790 }
791 anp->choice = choice;
792 if (func != NULL)
793 {
794 anp->data.ptrvalue = (* func)(aip, atp);
795 if (aip -> io_failure) goto erret;
796
797 if (nullIsError && anp->data.ptrvalue == NULL) {
798 goto erret;
799 }
800 }
801
802 ret:
803 AsnUnlinkType(orig); /* unlink local tree */
804 return anp;
805
806 erret:
807 anp = MemFree(anp);
808 aip -> io_failure = TRUE;
809 goto ret;
810 }
811
812
813 /**************************************************
814 *
815 * BlastResponseAsnWrite()
816 *
817 **************************************************/
818 NLM_EXTERN Boolean LIBCALL
BlastResponseAsnWrite(BlastResponsePtr anp,AsnIoPtr aip,AsnTypePtr orig)819 BlastResponseAsnWrite(BlastResponsePtr anp, AsnIoPtr aip, AsnTypePtr orig)
820
821 {
822 DataVal av;
823 AsnTypePtr atp, writetype = NULL;
824 Pointer pnt;
825 AsnWriteFunc func = NULL;
826 Boolean retval = FALSE;
827
828 if (! loaded)
829 {
830 if (! objblst3AsnLoad())
831 return FALSE;
832 }
833
834 if (aip == NULL)
835 return FALSE;
836
837 atp = AsnLinkType(orig, BLAST_RESPONSE); /* link local tree */
838 if (atp == NULL) {
839 return FALSE;
840 }
841
842 if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
843
844 av.ptrvalue = (Pointer)anp;
845 if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
846 goto erret;
847 }
848
849 pnt = anp->data.ptrvalue;
850 switch (anp->choice)
851 {
852 case BlastResponse_init:
853 writetype = BLAST_RESPONSE_init;
854 func = (AsnWriteFunc) BlastVersionAsnWrite;
855 break;
856 case BlastResponse_motd:
857 av.ptrvalue = anp->data.ptrvalue;
858 retval = AsnWrite(aip, BLAST_RESPONSE_motd, &av);
859 break;
860 case BlastResponse_error:
861 writetype = BLAST_RESPONSE_error;
862 func = (AsnWriteFunc) BlastErrorAsnWrite;
863 break;
864 case BlastResponse_db_seq_get:
865 writetype = BLAST_RESPONSE_db_seq_get;
866 func = (AsnWriteFunc) BioseqAsnWrite;
867 break;
868 case BlastResponse_db_redundant_ids_get:
869 retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqIdAsnWrite, aip, BLAST_RESPONSE_db_redundant_ids_get, BLAST_RESPONSE_db_redundant_ids_get_E);
870 break;
871 case BlastResponse_db_redundant_descr_get:
872 retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) BlastDeflineAsnWrite, aip, BLAST_RESPONSE_db_redundant_descr_get, BLAST_RESPONSE_db_redundant_descr_get_E);
873 break;
874 case BlastResponse_db_info:
875 retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) BlastDbinfoAsnWrite, aip, BLAST_RESPONSE_db_info, BLAST_RESPONSE_db_info_E);
876 break;
877 case BlastResponse_db_info_specific:
878 writetype = BLAST_RESPONSE_db_info_specific;
879 func = (AsnWriteFunc) BlastDbinfoAsnWrite;
880 break;
881 case BlastResponse_matrix:
882 writetype = BLAST_RESPONSE_matrix;
883 func = (AsnWriteFunc) BlastMatrixAsnWrite;
884 break;
885 case BlastResponse_alignment:
886 writetype = BLAST_RESPONSE_alignment;
887 func = (AsnWriteFunc) SeqAlignSetAsnWrite;
888 break;
889 case BlastResponse_mask:
890 writetype = BLAST_RESPONSE_mask;
891 func = (AsnWriteFunc) BlastMaskAsnWrite;
892 break;
893 case BlastResponse_kablk:
894 writetype = BLAST_RESPONSE_kablk;
895 func = (AsnWriteFunc) BlastKABlkAsnWrite;
896 break;
897 case BlastResponse_parameters:
898 av.ptrvalue = anp->data.ptrvalue;
899 retval = AsnWrite(aip, BLAST_RESPONSE_parameters, &av);
900 break;
901 case BlastResponse_queued:
902 writetype = BLAST_RESPONSE_queued;
903 func = (AsnWriteFunc) BlastQueuedAsnWrite;
904 break;
905 case BlastResponse_start:
906 writetype = BLAST_RESPONSE_start;
907 func = (AsnWriteFunc) BlastProgressAsnWrite;
908 break;
909 case BlastResponse_progress:
910 writetype = BLAST_RESPONSE_progress;
911 func = (AsnWriteFunc) BlastProgressAsnWrite;
912 break;
913 case BlastResponse_done:
914 writetype = BLAST_RESPONSE_done;
915 func = (AsnWriteFunc) BlastProgressAsnWrite;
916 break;
917 case BlastResponse_fini:
918 av.boolvalue = anp->data.boolvalue;
919 retval = AsnWrite(aip, BLAST_RESPONSE_fini, &av);
920 break;
921 case BlastResponse_phialign:
922 writetype = BLAST_RESPONSE_phialign;
923 func = (AsnWriteFunc) BlastPhialignAsnWrite;
924 break;
925 case BlastResponse_parts:
926 retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) BlastPartsAsnWrite, aip, BLAST_RESPONSE_parts, BLAST_RESPONSE_parts_E);
927 break;
928 case BlastResponse_mbalign:
929 writetype = BLAST_RESPONSE_mbalign;
930 func = (AsnWriteFunc) MegaBlastResultsAsnWrite;
931 break;
932 }
933 if (writetype != NULL) {
934 retval = (* func)(pnt, aip, writetype); /* write it out */
935 }
936 if (!retval) {
937 goto erret;
938 }
939 retval = TRUE;
940
941 erret:
942 AsnUnlinkType(orig); /* unlink local tree */
943 return retval;
944 }
945
946
947 /**************************************************
948 *
949 * BlastParametersNew()
950 *
951 **************************************************/
952 NLM_EXTERN
953 BlastParametersPtr LIBCALL
BlastParametersNew(void)954 BlastParametersNew(void)
955 {
956 BlastParametersPtr ptr = MemNew((size_t) sizeof(BlastParameters));
957
958 return ptr;
959
960 }
961
962
963 /**************************************************
964 *
965 * BlastParametersFree()
966 *
967 **************************************************/
968 NLM_EXTERN
969 BlastParametersPtr LIBCALL
BlastParametersFree(BlastParametersPtr ptr)970 BlastParametersFree(BlastParametersPtr ptr)
971 {
972
973 if(ptr == NULL) {
974 return NULL;
975 }
976 Cutoff_cutoffFree(ptr -> Cutoff_cutoff);
977 Cutoff2_cutoff2Free(ptr -> Cutoff2_cutoff2);
978 MemFree(ptr -> other_options);
979 AsnGenericBaseSeqOfFree(ptr -> gilist ,ASNCODE_INTVAL_SLOT);
980 MemFree(ptr -> gifile);
981 MemFree(ptr -> matrix);
982 MemFree(ptr -> filter_string);
983 MemFree(ptr -> entrez_query);
984 MemFree(ptr -> phi_pattern);
985 AsnGenericChoiceSeqOfFree(ptr -> query_lcase_mask, (AsnOptFreeFunc) SeqLocFree);
986 return MemFree(ptr);
987 }
988
989
990 /**************************************************
991 *
992 * Cutoff2_cutoff2Free()
993 *
994 **************************************************/
995 static
996 Cutoff2_cutoff2Ptr LIBCALL
Cutoff2_cutoff2Free(ValNodePtr anp)997 Cutoff2_cutoff2Free(ValNodePtr anp)
998 {
999 Pointer pnt;
1000
1001 if (anp == NULL) {
1002 return NULL;
1003 }
1004
1005 pnt = anp->data.ptrvalue;
1006 switch (anp->choice)
1007 {
1008 default:
1009 break;
1010 }
1011 return MemFree(anp);
1012 }
1013
1014
1015 /**************************************************
1016 *
1017 * BlastParametersAsnRead()
1018 *
1019 **************************************************/
1020 NLM_EXTERN
1021 BlastParametersPtr LIBCALL
BlastParametersAsnRead(AsnIoPtr aip,AsnTypePtr orig)1022 BlastParametersAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1023 {
1024 DataVal av;
1025 AsnTypePtr atp;
1026 Boolean isError = FALSE;
1027 AsnReadFunc func;
1028 BlastParametersPtr ptr;
1029
1030 if (! loaded)
1031 {
1032 if (! objblst3AsnLoad()) {
1033 return NULL;
1034 }
1035 }
1036
1037 if (aip == NULL) {
1038 return NULL;
1039 }
1040
1041 if (orig == NULL) { /* BlastParameters ::= (self contained) */
1042 atp = AsnReadId(aip, amp, BLAST_PARAMETERS);
1043 } else {
1044 atp = AsnLinkType(orig, BLAST_PARAMETERS);
1045 }
1046 /* link in local tree */
1047 if (atp == NULL) {
1048 return NULL;
1049 }
1050
1051 ptr = BlastParametersNew();
1052 if (ptr == NULL) {
1053 goto erret;
1054 }
1055 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1056 goto erret;
1057 }
1058
1059 atp = AsnReadId(aip,amp, atp);
1060 func = NULL;
1061
1062 if (atp == BLAST_PARAMETERS_first_threshold) {
1063 if ( AsnReadVal(aip, atp, &av) <= 0) {
1064 goto erret;
1065 }
1066 ptr -> first_threshold = av.intvalue;
1067 atp = AsnReadId(aip,amp, atp);
1068 }
1069 if (atp == BLAST_PARAMETERS_second_threshold) {
1070 if ( AsnReadVal(aip, atp, &av) <= 0) {
1071 goto erret;
1072 }
1073 ptr -> second_threshold = av.intvalue;
1074 atp = AsnReadId(aip,amp, atp);
1075 }
1076 if (atp == BLAST_PARAMETERS_cutoff) {
1077 ptr -> Cutoff_cutoff = Cutoff_cutoffAsnRead(aip, atp);
1078 if (aip -> io_failure) {
1079 goto erret;
1080 }
1081 atp = AsnReadId(aip,amp, atp);
1082 }
1083 if (atp == BLAST_PARAMETERS_cutoff2) {
1084 ptr -> Cutoff2_cutoff2 = Cutoff2_cutoff2AsnRead(aip, atp);
1085 if (aip -> io_failure) {
1086 goto erret;
1087 }
1088 atp = AsnReadId(aip,amp, atp);
1089 }
1090 if (atp == BLAST_PARAMETERS_hitlist_size) {
1091 if ( AsnReadVal(aip, atp, &av) <= 0) {
1092 goto erret;
1093 }
1094 ptr -> hitlist_size = av.intvalue;
1095 atp = AsnReadId(aip,amp, atp);
1096 }
1097 if (atp == BLAST_PARAMETERS_nucl_penalty) {
1098 if ( AsnReadVal(aip, atp, &av) <= 0) {
1099 goto erret;
1100 }
1101 ptr -> nucl_penalty = av.intvalue;
1102 atp = AsnReadId(aip,amp, atp);
1103 }
1104 if (atp == BLAST_PARAMETERS_nucl_reward) {
1105 if ( AsnReadVal(aip, atp, &av) <= 0) {
1106 goto erret;
1107 }
1108 ptr -> nucl_reward = av.intvalue;
1109 atp = AsnReadId(aip,amp, atp);
1110 }
1111 if (atp == BLAST_PARAMETERS_genetic_code) {
1112 if ( AsnReadVal(aip, atp, &av) <= 0) {
1113 goto erret;
1114 }
1115 ptr -> genetic_code = av.intvalue;
1116 atp = AsnReadId(aip,amp, atp);
1117 }
1118 if (atp == BLAST_PARAMETERS_db_genetic_code) {
1119 if ( AsnReadVal(aip, atp, &av) <= 0) {
1120 goto erret;
1121 }
1122 ptr -> db_genetic_code = av.intvalue;
1123 atp = AsnReadId(aip,amp, atp);
1124 }
1125 if (atp == BLAST_PARAMETERS_low_complexity_filtering) {
1126 if ( AsnReadVal(aip, atp, &av) <= 0) {
1127 goto erret;
1128 }
1129 ptr -> low_complexity_filtering = av.intvalue;
1130 atp = AsnReadId(aip,amp, atp);
1131 }
1132 if (atp == BLAST_PARAMETERS_gapped_alignment) {
1133 if ( AsnReadVal(aip, atp, &av) <= 0) {
1134 goto erret;
1135 }
1136 ptr -> gapped_alignment = av.boolvalue;
1137 atp = AsnReadId(aip,amp, atp);
1138 }
1139 if (atp == BLAST_PARAMETERS_gap_open) {
1140 if ( AsnReadVal(aip, atp, &av) <= 0) {
1141 goto erret;
1142 }
1143 ptr -> gap_open = av.intvalue;
1144 atp = AsnReadId(aip,amp, atp);
1145 }
1146 if (atp == BLAST_PARAMETERS_gap_extend) {
1147 if ( AsnReadVal(aip, atp, &av) <= 0) {
1148 goto erret;
1149 }
1150 ptr -> gap_extend = av.intvalue;
1151 atp = AsnReadId(aip,amp, atp);
1152 }
1153 if (atp == BLAST_PARAMETERS_required_start) {
1154 if ( AsnReadVal(aip, atp, &av) <= 0) {
1155 goto erret;
1156 }
1157 ptr -> required_start = av.intvalue;
1158 atp = AsnReadId(aip,amp, atp);
1159 }
1160 if (atp == BLAST_PARAMETERS_required_end) {
1161 if ( AsnReadVal(aip, atp, &av) <= 0) {
1162 goto erret;
1163 }
1164 ptr -> required_end = av.intvalue;
1165 atp = AsnReadId(aip,amp, atp);
1166 }
1167 if (atp == BLAST_PARAMETERS_ethresh) {
1168 if ( AsnReadVal(aip, atp, &av) <= 0) {
1169 goto erret;
1170 }
1171 ptr -> ethresh = av.realvalue;
1172 atp = AsnReadId(aip,amp, atp);
1173 }
1174 if (atp == BLAST_PARAMETERS_max_num_passes) {
1175 if ( AsnReadVal(aip, atp, &av) <= 0) {
1176 goto erret;
1177 }
1178 ptr -> max_num_passes = av.intvalue;
1179 atp = AsnReadId(aip,amp, atp);
1180 }
1181 if (atp == BLAST_PARAMETERS_pseudo_count_const) {
1182 if ( AsnReadVal(aip, atp, &av) <= 0) {
1183 goto erret;
1184 }
1185 ptr -> pseudo_count_const = av.intvalue;
1186 atp = AsnReadId(aip,amp, atp);
1187 }
1188 if (atp == BLAST_PARAMETERS_other_options) {
1189 if ( AsnReadVal(aip, atp, &av) <= 0) {
1190 goto erret;
1191 }
1192 ptr -> other_options = av.ptrvalue;
1193 atp = AsnReadId(aip,amp, atp);
1194 }
1195 if (atp == BLAST_PARAMETERS_gilist) {
1196 ptr -> gilist = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
1197 if (isError && ptr -> gilist == NULL) {
1198 goto erret;
1199 }
1200 atp = AsnReadId(aip,amp, atp);
1201 }
1202 if (atp == BLAST_PARAMETERS_gifile) {
1203 if ( AsnReadVal(aip, atp, &av) <= 0) {
1204 goto erret;
1205 }
1206 ptr -> gifile = av.ptrvalue;
1207 atp = AsnReadId(aip,amp, atp);
1208 }
1209 if (atp == BLAST_PARAMETERS_matrix) {
1210 if ( AsnReadVal(aip, atp, &av) <= 0) {
1211 goto erret;
1212 }
1213 ptr -> matrix = av.ptrvalue;
1214 atp = AsnReadId(aip,amp, atp);
1215 }
1216 if (atp == BLAST_PARAMETERS_filter_string) {
1217 if ( AsnReadVal(aip, atp, &av) <= 0) {
1218 goto erret;
1219 }
1220 ptr -> filter_string = av.ptrvalue;
1221 atp = AsnReadId(aip,amp, atp);
1222 }
1223 if (atp == BLAST_PARAMETERS_entrez_query) {
1224 if ( AsnReadVal(aip, atp, &av) <= 0) {
1225 goto erret;
1226 }
1227 ptr -> entrez_query = av.ptrvalue;
1228 atp = AsnReadId(aip,amp, atp);
1229 }
1230 if (atp == BLAST_PARAMETERS_word_size) {
1231 if ( AsnReadVal(aip, atp, &av) <= 0) {
1232 goto erret;
1233 }
1234 ptr -> word_size = av.intvalue;
1235 atp = AsnReadId(aip,amp, atp);
1236 }
1237 if (atp == BLAST_PARAMETERS_db_length) {
1238 if ( AsnReadVal(aip, atp, &av) <= 0) {
1239 goto erret;
1240 }
1241 ptr -> db_length = av.intvalue;
1242 atp = AsnReadId(aip,amp, atp);
1243 }
1244 if (atp == BLAST_PARAMETERS_searchsp_eff) {
1245 if ( AsnReadVal(aip, atp, &av) <= 0) {
1246 goto erret;
1247 }
1248 ptr -> searchsp_eff = av.realvalue;
1249 atp = AsnReadId(aip,amp, atp);
1250 }
1251 if (atp == BLAST_PARAMETERS_hsp_range_max) {
1252 if ( AsnReadVal(aip, atp, &av) <= 0) {
1253 goto erret;
1254 }
1255 ptr -> hsp_range_max = av.intvalue;
1256 atp = AsnReadId(aip,amp, atp);
1257 }
1258 if (atp == BLAST_PARAMETERS_block_width) {
1259 if ( AsnReadVal(aip, atp, &av) <= 0) {
1260 goto erret;
1261 }
1262 ptr -> block_width = av.intvalue;
1263 atp = AsnReadId(aip,amp, atp);
1264 }
1265 if (atp == BLAST_PARAMETERS_perform_culling) {
1266 if ( AsnReadVal(aip, atp, &av) <= 0) {
1267 goto erret;
1268 }
1269 ptr -> perform_culling = av.boolvalue;
1270 atp = AsnReadId(aip,amp, atp);
1271 }
1272 if (atp == BLAST_PARAMETERS_strand_option) {
1273 if ( AsnReadVal(aip, atp, &av) <= 0) {
1274 goto erret;
1275 }
1276 ptr -> strand_option = av.intvalue;
1277 atp = AsnReadId(aip,amp, atp);
1278 }
1279 if (atp == BLAST_PARAMETERS_phi_pattern) {
1280 if ( AsnReadVal(aip, atp, &av) <= 0) {
1281 goto erret;
1282 }
1283 ptr -> phi_pattern = av.ptrvalue;
1284 atp = AsnReadId(aip,amp, atp);
1285 }
1286 if (atp == BLAST_PARAMETERS_use_real_db_size) {
1287 if ( AsnReadVal(aip, atp, &av) <= 0) {
1288 goto erret;
1289 }
1290 ptr -> use_real_db_size = av.boolvalue;
1291 atp = AsnReadId(aip,amp, atp);
1292 }
1293 if (atp == BLAST_PARAMETERS_use_best_align) {
1294 if ( AsnReadVal(aip, atp, &av) <= 0) {
1295 goto erret;
1296 }
1297 ptr -> use_best_align = av.boolvalue;
1298 atp = AsnReadId(aip,amp, atp);
1299 }
1300 if (atp == BLAST_PARAMETERS_is_rps_blast) {
1301 if ( AsnReadVal(aip, atp, &av) <= 0) {
1302 goto erret;
1303 }
1304 ptr -> is_rps_blast = av.boolvalue;
1305 atp = AsnReadId(aip,amp, atp);
1306 }
1307 if (atp == BLAST_PARAMETERS_tweak_parameters) {
1308 if ( AsnReadVal(aip, atp, &av) <= 0) {
1309 goto erret;
1310 }
1311 ptr -> tweak_parameters = av.boolvalue;
1312 atp = AsnReadId(aip,amp, atp);
1313 }
1314 if (atp == BLAST_PARAMETERS_smith_waterman) {
1315 if ( AsnReadVal(aip, atp, &av) <= 0) {
1316 goto erret;
1317 }
1318 ptr -> smith_waterman = av.boolvalue;
1319 atp = AsnReadId(aip,amp, atp);
1320 }
1321 if (atp == BLAST_PARAMETERS_is_megablast) {
1322 if ( AsnReadVal(aip, atp, &av) <= 0) {
1323 goto erret;
1324 }
1325 ptr -> is_megablast = av.boolvalue;
1326 atp = AsnReadId(aip,amp, atp);
1327 }
1328 if (atp == BLAST_PARAMETERS_query_lcase_mask) {
1329 ptr -> query_lcase_mask = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqLocAsnRead, (AsnOptFreeFunc) SeqLocFree);
1330 if (isError && ptr -> query_lcase_mask == NULL) {
1331 goto erret;
1332 }
1333 atp = AsnReadId(aip,amp, atp);
1334 }
1335 if (atp == BLAST_PARAMETERS_is_ooframe) {
1336 if ( AsnReadVal(aip, atp, &av) <= 0) {
1337 goto erret;
1338 }
1339 ptr -> is_ooframe = av.intvalue;
1340 atp = AsnReadId(aip,amp, atp);
1341 }
1342 if (atp == BLAST_PARAMETERS_endpoint_results) {
1343 if ( AsnReadVal(aip, atp, &av) <= 0) {
1344 goto erret;
1345 }
1346 ptr -> endpoint_results = av.boolvalue;
1347 atp = AsnReadId(aip,amp, atp);
1348 }
1349 if (atp == BLAST_PARAMETERS_percent_identity) {
1350 if ( AsnReadVal(aip, atp, &av) <= 0) {
1351 goto erret;
1352 }
1353 ptr -> percent_identity = av.realvalue;
1354 atp = AsnReadId(aip,amp, atp);
1355 }
1356 if (atp == BLAST_PARAMETERS_first_db_seq) {
1357 if ( AsnReadVal(aip, atp, &av) <= 0) {
1358 goto erret;
1359 }
1360 ptr -> first_db_seq = av.intvalue;
1361 atp = AsnReadId(aip,amp, atp);
1362 }
1363 if (atp == BLAST_PARAMETERS_final_db_seq) {
1364 if ( AsnReadVal(aip, atp, &av) <= 0) {
1365 goto erret;
1366 }
1367 ptr -> final_db_seq = av.intvalue;
1368 atp = AsnReadId(aip,amp, atp);
1369 }
1370 if (atp == BLAST_PARAMETERS_window_size) {
1371 if ( AsnReadVal(aip, atp, &av) <= 0) {
1372 goto erret;
1373 }
1374 ptr -> window_size = av.intvalue;
1375 atp = AsnReadId(aip,amp, atp);
1376 }
1377 if (atp == BLAST_PARAMETERS_mb_template_length) {
1378 if ( AsnReadVal(aip, atp, &av) <= 0) {
1379 goto erret;
1380 }
1381 ptr -> mb_template_length = av.intvalue;
1382 atp = AsnReadId(aip,amp, atp);
1383 }
1384 if (atp == BLAST_PARAMETERS_mb_disc_type) {
1385 if ( AsnReadVal(aip, atp, &av) <= 0) {
1386 goto erret;
1387 }
1388 ptr -> mb_disc_type = av.intvalue;
1389 atp = AsnReadId(aip,amp, atp);
1390 }
1391
1392 if (AsnReadVal(aip, atp, &av) <= 0) {
1393 goto erret;
1394 }
1395 /* end struct */
1396
1397 ret:
1398 AsnUnlinkType(orig); /* unlink local tree */
1399 return ptr;
1400
1401 erret:
1402 aip -> io_failure = TRUE;
1403 ptr = BlastParametersFree(ptr);
1404 goto ret;
1405 }
1406
1407
1408
1409 /**************************************************
1410 *
1411 * Cutoff2_cutoff2AsnRead()
1412 *
1413 **************************************************/
1414 static
1415 Cutoff2_cutoff2Ptr LIBCALL
Cutoff2_cutoff2AsnRead(AsnIoPtr aip,AsnTypePtr orig)1416 Cutoff2_cutoff2AsnRead(AsnIoPtr aip, AsnTypePtr orig)
1417 {
1418 DataVal av;
1419 AsnTypePtr atp;
1420 ValNodePtr anp;
1421 Uint1 choice;
1422 Boolean isError = FALSE;
1423 Boolean nullIsError = FALSE;
1424 AsnReadFunc func;
1425
1426 if (! loaded)
1427 {
1428 if (! objblst3AsnLoad()) {
1429 return NULL;
1430 }
1431 }
1432
1433 if (aip == NULL) {
1434 return NULL;
1435 }
1436
1437 if (orig == NULL) { /* Cutoff2_cutoff2 ::= (self contained) */
1438 atp = AsnReadId(aip, amp, BLAST_PARAMETERS_cutoff2);
1439 } else {
1440 atp = AsnLinkType(orig, BLAST_PARAMETERS_cutoff2); /* link in local tree */
1441 }
1442 if (atp == NULL) {
1443 return NULL;
1444 }
1445
1446 anp = ValNodeNew(NULL);
1447 if (anp == NULL) {
1448 goto erret;
1449 }
1450 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1451 goto erret;
1452 }
1453
1454 func = NULL;
1455
1456 atp = AsnReadId(aip, amp, atp); /* find the choice */
1457 if (atp == NULL) {
1458 goto erret;
1459 }
1460 if (atp == BLAST_PARAMETERS_cutoff2_evalue) {
1461 choice = Cutoff2_cutoff2_evalue;
1462 if (AsnReadVal(aip, atp, &av) <= 0) {
1463 goto erret;
1464 }
1465 anp->data.realvalue = av.realvalue;
1466 }
1467 else if (atp == BLAST_PARAMETERS_cutoff2_score) {
1468 choice = Cutoff2_cutoff2_score;
1469 if (AsnReadVal(aip, atp, &av) <= 0) {
1470 goto erret;
1471 }
1472 anp->data.intvalue = av.intvalue;
1473 }
1474 anp->choice = choice;
1475 if (func != NULL)
1476 {
1477 anp->data.ptrvalue = (* func)(aip, atp);
1478 if (aip -> io_failure) goto erret;
1479
1480 if (nullIsError && anp->data.ptrvalue == NULL) {
1481 goto erret;
1482 }
1483 }
1484
1485 ret:
1486 AsnUnlinkType(orig); /* unlink local tree */
1487 return anp;
1488
1489 erret:
1490 anp = MemFree(anp);
1491 aip -> io_failure = TRUE;
1492 goto ret;
1493 }
1494
1495
1496 /**************************************************
1497 *
1498 * BlastParametersAsnWrite()
1499 *
1500 **************************************************/
1501 NLM_EXTERN Boolean LIBCALL
BlastParametersAsnWrite(BlastParametersPtr ptr,AsnIoPtr aip,AsnTypePtr orig)1502 BlastParametersAsnWrite(BlastParametersPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1503 {
1504 DataVal av;
1505 AsnTypePtr atp;
1506 Boolean retval = FALSE;
1507
1508 if (! loaded)
1509 {
1510 if (! objblst3AsnLoad()) {
1511 return FALSE;
1512 }
1513 }
1514
1515 if (aip == NULL) {
1516 return FALSE;
1517 }
1518
1519 atp = AsnLinkType(orig, BLAST_PARAMETERS); /* link local tree */
1520 if (atp == NULL) {
1521 return FALSE;
1522 }
1523
1524 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1525 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1526 goto erret;
1527 }
1528
1529 av.intvalue = ptr -> first_threshold;
1530 retval = AsnWrite(aip, BLAST_PARAMETERS_first_threshold, &av);
1531 av.intvalue = ptr -> second_threshold;
1532 retval = AsnWrite(aip, BLAST_PARAMETERS_second_threshold, &av);
1533 if (ptr -> Cutoff_cutoff != NULL) {
1534 if ( ! Cutoff_cutoffAsnWrite(ptr -> Cutoff_cutoff, aip, BLAST_PARAMETERS_cutoff)) {
1535 goto erret;
1536 }
1537 }
1538 if (ptr -> Cutoff2_cutoff2 != NULL) {
1539 if ( ! Cutoff2_cutoff2AsnWrite(ptr -> Cutoff2_cutoff2, aip, BLAST_PARAMETERS_cutoff2)) {
1540 goto erret;
1541 }
1542 }
1543 av.intvalue = ptr -> hitlist_size;
1544 retval = AsnWrite(aip, BLAST_PARAMETERS_hitlist_size, &av);
1545 av.intvalue = ptr -> nucl_penalty;
1546 retval = AsnWrite(aip, BLAST_PARAMETERS_nucl_penalty, &av);
1547 av.intvalue = ptr -> nucl_reward;
1548 retval = AsnWrite(aip, BLAST_PARAMETERS_nucl_reward, &av);
1549 av.intvalue = ptr -> genetic_code;
1550 retval = AsnWrite(aip, BLAST_PARAMETERS_genetic_code, &av);
1551 av.intvalue = ptr -> db_genetic_code;
1552 retval = AsnWrite(aip, BLAST_PARAMETERS_db_genetic_code, &av);
1553 av.intvalue = ptr -> low_complexity_filtering;
1554 retval = AsnWrite(aip, BLAST_PARAMETERS_low_complexity_filtering, &av);
1555 av.boolvalue = ptr -> gapped_alignment;
1556 retval = AsnWrite(aip, BLAST_PARAMETERS_gapped_alignment, &av);
1557 av.intvalue = ptr -> gap_open;
1558 retval = AsnWrite(aip, BLAST_PARAMETERS_gap_open, &av);
1559 av.intvalue = ptr -> gap_extend;
1560 retval = AsnWrite(aip, BLAST_PARAMETERS_gap_extend, &av);
1561 av.intvalue = ptr -> required_start;
1562 retval = AsnWrite(aip, BLAST_PARAMETERS_required_start, &av);
1563 av.intvalue = ptr -> required_end;
1564 retval = AsnWrite(aip, BLAST_PARAMETERS_required_end, &av);
1565 av.realvalue = ptr -> ethresh;
1566 retval = AsnWrite(aip, BLAST_PARAMETERS_ethresh, &av);
1567 av.intvalue = ptr -> max_num_passes;
1568 retval = AsnWrite(aip, BLAST_PARAMETERS_max_num_passes, &av);
1569 av.intvalue = ptr -> pseudo_count_const;
1570 retval = AsnWrite(aip, BLAST_PARAMETERS_pseudo_count_const, &av);
1571 if (ptr -> other_options != NULL) {
1572 av.ptrvalue = ptr -> other_options;
1573 retval = AsnWrite(aip, BLAST_PARAMETERS_other_options, &av);
1574 }
1575 retval = AsnGenericBaseSeqOfAsnWrite(ptr -> gilist ,ASNCODE_INTVAL_SLOT, aip, BLAST_PARAMETERS_gilist, BLAST_PARAMETERS_gilist_E);
1576 if (ptr -> gifile != NULL) {
1577 av.ptrvalue = ptr -> gifile;
1578 retval = AsnWrite(aip, BLAST_PARAMETERS_gifile, &av);
1579 }
1580 if (ptr -> matrix != NULL) {
1581 av.ptrvalue = ptr -> matrix;
1582 retval = AsnWrite(aip, BLAST_PARAMETERS_matrix, &av);
1583 }
1584 if (ptr -> filter_string != NULL) {
1585 av.ptrvalue = ptr -> filter_string;
1586 retval = AsnWrite(aip, BLAST_PARAMETERS_filter_string, &av);
1587 }
1588 if (ptr -> entrez_query != NULL) {
1589 av.ptrvalue = ptr -> entrez_query;
1590 retval = AsnWrite(aip, BLAST_PARAMETERS_entrez_query, &av);
1591 }
1592 av.intvalue = ptr -> word_size;
1593 retval = AsnWrite(aip, BLAST_PARAMETERS_word_size, &av);
1594 av.intvalue = ptr -> db_length;
1595 retval = AsnWrite(aip, BLAST_PARAMETERS_db_length, &av);
1596 av.realvalue = ptr -> searchsp_eff;
1597 retval = AsnWrite(aip, BLAST_PARAMETERS_searchsp_eff, &av);
1598 av.intvalue = ptr -> hsp_range_max;
1599 retval = AsnWrite(aip, BLAST_PARAMETERS_hsp_range_max, &av);
1600 av.intvalue = ptr -> block_width;
1601 retval = AsnWrite(aip, BLAST_PARAMETERS_block_width, &av);
1602 av.boolvalue = ptr -> perform_culling;
1603 retval = AsnWrite(aip, BLAST_PARAMETERS_perform_culling, &av);
1604 av.intvalue = ptr -> strand_option;
1605 retval = AsnWrite(aip, BLAST_PARAMETERS_strand_option, &av);
1606 if (ptr -> phi_pattern != NULL) {
1607 av.ptrvalue = ptr -> phi_pattern;
1608 retval = AsnWrite(aip, BLAST_PARAMETERS_phi_pattern, &av);
1609 }
1610 av.boolvalue = ptr -> use_real_db_size;
1611 retval = AsnWrite(aip, BLAST_PARAMETERS_use_real_db_size, &av);
1612 av.boolvalue = ptr -> use_best_align;
1613 retval = AsnWrite(aip, BLAST_PARAMETERS_use_best_align, &av);
1614 av.boolvalue = ptr -> is_rps_blast;
1615 retval = AsnWrite(aip, BLAST_PARAMETERS_is_rps_blast, &av);
1616 av.boolvalue = ptr -> tweak_parameters;
1617 retval = AsnWrite(aip, BLAST_PARAMETERS_tweak_parameters, &av);
1618 av.boolvalue = ptr -> smith_waterman;
1619 retval = AsnWrite(aip, BLAST_PARAMETERS_smith_waterman, &av);
1620 av.boolvalue = ptr -> is_megablast;
1621 retval = AsnWrite(aip, BLAST_PARAMETERS_is_megablast, &av);
1622 AsnGenericChoiceSeqOfAsnWrite(ptr -> query_lcase_mask, (AsnWriteFunc) SeqLocAsnWrite, aip, BLAST_PARAMETERS_query_lcase_mask, BLAST_PARAMETERS_query_lcase_mask_E);
1623 av.intvalue = ptr -> is_ooframe;
1624 retval = AsnWrite(aip, BLAST_PARAMETERS_is_ooframe, &av);
1625 av.boolvalue = ptr -> endpoint_results;
1626 retval = AsnWrite(aip, BLAST_PARAMETERS_endpoint_results, &av);
1627 av.realvalue = ptr -> percent_identity;
1628 retval = AsnWrite(aip, BLAST_PARAMETERS_percent_identity, &av);
1629 av.intvalue = ptr -> first_db_seq;
1630 retval = AsnWrite(aip, BLAST_PARAMETERS_first_db_seq, &av);
1631 av.intvalue = ptr -> final_db_seq;
1632 retval = AsnWrite(aip, BLAST_PARAMETERS_final_db_seq, &av);
1633 av.intvalue = ptr -> window_size;
1634 retval = AsnWrite(aip, BLAST_PARAMETERS_window_size, &av);
1635 av.intvalue = ptr -> mb_template_length;
1636 retval = AsnWrite(aip, BLAST_PARAMETERS_mb_template_length, &av);
1637 av.intvalue = ptr -> mb_disc_type;
1638 retval = AsnWrite(aip, BLAST_PARAMETERS_mb_disc_type, &av);
1639 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1640 goto erret;
1641 }
1642 retval = TRUE;
1643
1644 erret:
1645 AsnUnlinkType(orig); /* unlink local tree */
1646 return retval;
1647 }
1648
1649
1650
1651 /**************************************************
1652 *
1653 * Cutoff2_cutoff2AsnWrite()
1654 *
1655 **************************************************/
1656 static Boolean LIBCALL
Cutoff2_cutoff2AsnWrite(Cutoff2_cutoff2Ptr anp,AsnIoPtr aip,AsnTypePtr orig)1657 Cutoff2_cutoff2AsnWrite(Cutoff2_cutoff2Ptr anp, AsnIoPtr aip, AsnTypePtr orig)
1658
1659 {
1660 DataVal av;
1661 AsnTypePtr atp, writetype = NULL;
1662 Pointer pnt;
1663 AsnWriteFunc func = NULL;
1664 Boolean retval = FALSE;
1665
1666 if (! loaded)
1667 {
1668 if (! objblst3AsnLoad())
1669 return FALSE;
1670 }
1671
1672 if (aip == NULL)
1673 return FALSE;
1674
1675 atp = AsnLinkType(orig, BLAST_PARAMETERS_cutoff2); /* link local tree */
1676 if (atp == NULL) {
1677 return FALSE;
1678 }
1679
1680 if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1681
1682 av.ptrvalue = (Pointer)anp;
1683 if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1684 goto erret;
1685 }
1686
1687 pnt = anp->data.ptrvalue;
1688 switch (anp->choice)
1689 {
1690 case Cutoff2_cutoff2_evalue:
1691 av.realvalue = anp->data.realvalue;
1692 retval = AsnWrite(aip, BLAST_PARAMETERS_cutoff2_evalue, &av);
1693 break;
1694 case Cutoff2_cutoff2_score:
1695 av.intvalue = anp->data.intvalue;
1696 retval = AsnWrite(aip, BLAST_PARAMETERS_cutoff2_score, &av);
1697 break;
1698 }
1699 if (writetype != NULL) {
1700 retval = (* func)(pnt, aip, writetype); /* write it out */
1701 }
1702 if (!retval) {
1703 goto erret;
1704 }
1705 retval = TRUE;
1706
1707 erret:
1708 AsnUnlinkType(orig); /* unlink local tree */
1709 return retval;
1710 }
1711
1712
1713 /**************************************************
1714 *
1715 * Cutoff_cutoffAsnWrite()
1716 *
1717 **************************************************/
1718 static Boolean LIBCALL
Cutoff_cutoffAsnWrite(Cutoff_cutoffPtr anp,AsnIoPtr aip,AsnTypePtr orig)1719 Cutoff_cutoffAsnWrite(Cutoff_cutoffPtr anp, AsnIoPtr aip, AsnTypePtr orig)
1720
1721 {
1722 DataVal av;
1723 AsnTypePtr atp, writetype = NULL;
1724 Pointer pnt;
1725 AsnWriteFunc func = NULL;
1726 Boolean retval = FALSE;
1727
1728 if (! loaded)
1729 {
1730 if (! objblst3AsnLoad())
1731 return FALSE;
1732 }
1733
1734 if (aip == NULL)
1735 return FALSE;
1736
1737 atp = AsnLinkType(orig, BLAST_PARAMETERS_cutoff); /* link local tree */
1738 if (atp == NULL) {
1739 return FALSE;
1740 }
1741
1742 if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1743
1744 av.ptrvalue = (Pointer)anp;
1745 if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1746 goto erret;
1747 }
1748
1749 pnt = anp->data.ptrvalue;
1750 switch (anp->choice)
1751 {
1752 case Cutoff_cutoff_evalue:
1753 av.realvalue = anp->data.realvalue;
1754 retval = AsnWrite(aip, BLAST_PARAMETERS_cutoff_evalue, &av);
1755 break;
1756 case Cutoff_cutoff_score:
1757 av.intvalue = anp->data.intvalue;
1758 retval = AsnWrite(aip, BLAST_PARAMETERS_cutoff_score, &av);
1759 break;
1760 }
1761 if (writetype != NULL) {
1762 retval = (* func)(pnt, aip, writetype); /* write it out */
1763 }
1764 if (!retval) {
1765 goto erret;
1766 }
1767 retval = TRUE;
1768
1769 erret:
1770 AsnUnlinkType(orig); /* unlink local tree */
1771 return retval;
1772 }
1773
1774
1775 /**************************************************
1776 *
1777 * Cutoff_cutoffAsnRead()
1778 *
1779 **************************************************/
1780 static
1781 Cutoff_cutoffPtr LIBCALL
Cutoff_cutoffAsnRead(AsnIoPtr aip,AsnTypePtr orig)1782 Cutoff_cutoffAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1783 {
1784 DataVal av;
1785 AsnTypePtr atp;
1786 ValNodePtr anp;
1787 Uint1 choice;
1788 Boolean isError = FALSE;
1789 Boolean nullIsError = FALSE;
1790 AsnReadFunc func;
1791
1792 if (! loaded)
1793 {
1794 if (! objblst3AsnLoad()) {
1795 return NULL;
1796 }
1797 }
1798
1799 if (aip == NULL) {
1800 return NULL;
1801 }
1802
1803 if (orig == NULL) { /* Cutoff_cutoff ::= (self contained) */
1804 atp = AsnReadId(aip, amp, BLAST_PARAMETERS_cutoff);
1805 } else {
1806 atp = AsnLinkType(orig, BLAST_PARAMETERS_cutoff); /* link in local tree */
1807 }
1808 if (atp == NULL) {
1809 return NULL;
1810 }
1811
1812 anp = ValNodeNew(NULL);
1813 if (anp == NULL) {
1814 goto erret;
1815 }
1816 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
1817 goto erret;
1818 }
1819
1820 func = NULL;
1821
1822 atp = AsnReadId(aip, amp, atp); /* find the choice */
1823 if (atp == NULL) {
1824 goto erret;
1825 }
1826 if (atp == BLAST_PARAMETERS_cutoff_evalue) {
1827 choice = Cutoff_cutoff_evalue;
1828 if (AsnReadVal(aip, atp, &av) <= 0) {
1829 goto erret;
1830 }
1831 anp->data.realvalue = av.realvalue;
1832 }
1833 else if (atp == BLAST_PARAMETERS_cutoff_score) {
1834 choice = Cutoff_cutoff_score;
1835 if (AsnReadVal(aip, atp, &av) <= 0) {
1836 goto erret;
1837 }
1838 anp->data.intvalue = av.intvalue;
1839 }
1840 anp->choice = choice;
1841 if (func != NULL)
1842 {
1843 anp->data.ptrvalue = (* func)(aip, atp);
1844 if (aip -> io_failure) goto erret;
1845
1846 if (nullIsError && anp->data.ptrvalue == NULL) {
1847 goto erret;
1848 }
1849 }
1850
1851 ret:
1852 AsnUnlinkType(orig); /* unlink local tree */
1853 return anp;
1854
1855 erret:
1856 anp = MemFree(anp);
1857 aip -> io_failure = TRUE;
1858 goto ret;
1859 }
1860
1861
1862 /**************************************************
1863 *
1864 * Cutoff_cutoffFree()
1865 *
1866 **************************************************/
1867 static
1868 Cutoff_cutoffPtr LIBCALL
Cutoff_cutoffFree(ValNodePtr anp)1869 Cutoff_cutoffFree(ValNodePtr anp)
1870 {
1871 Pointer pnt;
1872
1873 if (anp == NULL) {
1874 return NULL;
1875 }
1876
1877 pnt = anp->data.ptrvalue;
1878 switch (anp->choice)
1879 {
1880 default:
1881 break;
1882 }
1883 return MemFree(anp);
1884 }
1885
1886
1887 /**************************************************
1888 *
1889 * BlastMatrixNew()
1890 *
1891 **************************************************/
1892 NLM_EXTERN
1893 BlastMatrixPtr LIBCALL
BlastMatrixNew(void)1894 BlastMatrixNew(void)
1895 {
1896 BlastMatrixPtr ptr = MemNew((size_t) sizeof(BlastMatrix));
1897
1898 return ptr;
1899
1900 }
1901
1902
1903 /**************************************************
1904 *
1905 * BlastMatrixFree()
1906 *
1907 **************************************************/
1908 NLM_EXTERN
1909 BlastMatrixPtr LIBCALL
BlastMatrixFree(BlastMatrixPtr ptr)1910 BlastMatrixFree(BlastMatrixPtr ptr)
1911 {
1912
1913 if(ptr == NULL) {
1914 return NULL;
1915 }
1916 MemFree(ptr -> name);
1917 AsnGenericBaseSeqOfFree(ptr -> comments ,ASNCODE_PTRVAL_SLOT);
1918 AsnGenericBaseSeqOfFree(ptr -> scores ,ASNCODE_INTVAL_SLOT);
1919 AsnGenericBaseSeqOfFree(ptr -> posFreqs ,ASNCODE_REALVAL_SLOT);
1920 return MemFree(ptr);
1921 }
1922
1923
1924 /**************************************************
1925 *
1926 * BlastMatrixAsnRead()
1927 *
1928 **************************************************/
1929 NLM_EXTERN
1930 BlastMatrixPtr LIBCALL
BlastMatrixAsnRead(AsnIoPtr aip,AsnTypePtr orig)1931 BlastMatrixAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1932 {
1933 DataVal av;
1934 AsnTypePtr atp;
1935 Boolean isError = FALSE;
1936 AsnReadFunc func;
1937 BlastMatrixPtr ptr;
1938
1939 if (! loaded)
1940 {
1941 if (! objblst3AsnLoad()) {
1942 return NULL;
1943 }
1944 }
1945
1946 if (aip == NULL) {
1947 return NULL;
1948 }
1949
1950 if (orig == NULL) { /* BlastMatrix ::= (self contained) */
1951 atp = AsnReadId(aip, amp, BLAST_MATRIX);
1952 } else {
1953 atp = AsnLinkType(orig, BLAST_MATRIX);
1954 }
1955 /* link in local tree */
1956 if (atp == NULL) {
1957 return NULL;
1958 }
1959
1960 ptr = BlastMatrixNew();
1961 if (ptr == NULL) {
1962 goto erret;
1963 }
1964 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1965 goto erret;
1966 }
1967
1968 atp = AsnReadId(aip,amp, atp);
1969 func = NULL;
1970
1971 if (atp == BLAST_MATRIX_is_protein) {
1972 if ( AsnReadVal(aip, atp, &av) <= 0) {
1973 goto erret;
1974 }
1975 ptr -> is_protein = av.boolvalue;
1976 atp = AsnReadId(aip,amp, atp);
1977 }
1978 if (atp == BLAST_MATRIX_name) {
1979 if ( AsnReadVal(aip, atp, &av) <= 0) {
1980 goto erret;
1981 }
1982 ptr -> name = av.ptrvalue;
1983 atp = AsnReadId(aip,amp, atp);
1984 }
1985 if (atp == BLAST_MATRIX_comments) {
1986 ptr -> comments = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
1987 if (isError && ptr -> comments == NULL) {
1988 goto erret;
1989 }
1990 atp = AsnReadId(aip,amp, atp);
1991 }
1992 if (atp == BLAST_MATRIX_row_length) {
1993 if ( AsnReadVal(aip, atp, &av) <= 0) {
1994 goto erret;
1995 }
1996 ptr -> row_length = av.intvalue;
1997 atp = AsnReadId(aip,amp, atp);
1998 }
1999 if (atp == BLAST_MATRIX_column_length) {
2000 if ( AsnReadVal(aip, atp, &av) <= 0) {
2001 goto erret;
2002 }
2003 ptr -> column_length = av.intvalue;
2004 atp = AsnReadId(aip,amp, atp);
2005 }
2006 if (atp == BLAST_MATRIX_scores) {
2007 ptr -> scores = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
2008 if (isError && ptr -> scores == NULL) {
2009 goto erret;
2010 }
2011 atp = AsnReadId(aip,amp, atp);
2012 }
2013 if (atp == BLAST_MATRIX_karlinK) {
2014 if ( AsnReadVal(aip, atp, &av) <= 0) {
2015 goto erret;
2016 }
2017 ptr -> karlinK = av.realvalue;
2018 atp = AsnReadId(aip,amp, atp);
2019 }
2020 if (atp == BLAST_MATRIX_posFreqs) {
2021 ptr -> posFreqs = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_REALVAL_SLOT, &isError);
2022 if (isError && ptr -> posFreqs == NULL) {
2023 goto erret;
2024 }
2025 atp = AsnReadId(aip,amp, atp);
2026 }
2027
2028 if (AsnReadVal(aip, atp, &av) <= 0) {
2029 goto erret;
2030 }
2031 /* end struct */
2032
2033 ret:
2034 AsnUnlinkType(orig); /* unlink local tree */
2035 return ptr;
2036
2037 erret:
2038 aip -> io_failure = TRUE;
2039 ptr = BlastMatrixFree(ptr);
2040 goto ret;
2041 }
2042
2043
2044
2045 /**************************************************
2046 *
2047 * BlastMatrixAsnWrite()
2048 *
2049 **************************************************/
2050 NLM_EXTERN Boolean LIBCALL
BlastMatrixAsnWrite(BlastMatrixPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2051 BlastMatrixAsnWrite(BlastMatrixPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2052 {
2053 DataVal av;
2054 AsnTypePtr atp;
2055 Boolean retval = FALSE;
2056
2057 if (! loaded)
2058 {
2059 if (! objblst3AsnLoad()) {
2060 return FALSE;
2061 }
2062 }
2063
2064 if (aip == NULL) {
2065 return FALSE;
2066 }
2067
2068 atp = AsnLinkType(orig, BLAST_MATRIX); /* link local tree */
2069 if (atp == NULL) {
2070 return FALSE;
2071 }
2072
2073 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2074 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2075 goto erret;
2076 }
2077
2078 av.boolvalue = ptr -> is_protein;
2079 retval = AsnWrite(aip, BLAST_MATRIX_is_protein, &av);
2080 if (ptr -> name != NULL) {
2081 av.ptrvalue = ptr -> name;
2082 retval = AsnWrite(aip, BLAST_MATRIX_name, &av);
2083 }
2084 retval = AsnGenericBaseSeqOfAsnWrite(ptr -> comments ,ASNCODE_PTRVAL_SLOT, aip, BLAST_MATRIX_comments, BLAST_MATRIX_comments_E);
2085 av.intvalue = ptr -> row_length;
2086 retval = AsnWrite(aip, BLAST_MATRIX_row_length, &av);
2087 av.intvalue = ptr -> column_length;
2088 retval = AsnWrite(aip, BLAST_MATRIX_column_length, &av);
2089 retval = AsnGenericBaseSeqOfAsnWrite(ptr -> scores ,ASNCODE_INTVAL_SLOT, aip, BLAST_MATRIX_scores, BLAST_MATRIX_scores_E);
2090 av.realvalue = ptr -> karlinK;
2091 retval = AsnWrite(aip, BLAST_MATRIX_karlinK, &av);
2092 retval = AsnGenericBaseSeqOfAsnWrite(ptr -> posFreqs ,ASNCODE_REALVAL_SLOT, aip, BLAST_MATRIX_posFreqs, BLAST_MATRIX_posFreqs_E);
2093 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2094 goto erret;
2095 }
2096 retval = TRUE;
2097
2098 erret:
2099 AsnUnlinkType(orig); /* unlink local tree */
2100 return retval;
2101 }
2102
2103
2104
2105 /**************************************************
2106 *
2107 * BlastDbinfoNew()
2108 *
2109 **************************************************/
2110 NLM_EXTERN
2111 BlastDbinfoPtr LIBCALL
BlastDbinfoNew(void)2112 BlastDbinfoNew(void)
2113 {
2114 BlastDbinfoPtr ptr = MemNew((size_t) sizeof(BlastDbinfo));
2115
2116 return ptr;
2117
2118 }
2119
2120
2121 /**************************************************
2122 *
2123 * BlastDbinfoFree()
2124 *
2125 **************************************************/
2126 NLM_EXTERN
2127 BlastDbinfoPtr LIBCALL
BlastDbinfoFree(BlastDbinfoPtr ptr)2128 BlastDbinfoFree(BlastDbinfoPtr ptr)
2129 {
2130
2131 if(ptr == NULL) {
2132 return NULL;
2133 }
2134 MemFree(ptr -> name);
2135 MemFree(ptr -> definition);
2136 MemFree(ptr -> date);
2137 return MemFree(ptr);
2138 }
2139
2140
2141 /**************************************************
2142 *
2143 * BlastDbinfoAsnRead()
2144 *
2145 **************************************************/
2146 NLM_EXTERN
2147 BlastDbinfoPtr LIBCALL
BlastDbinfoAsnRead(AsnIoPtr aip,AsnTypePtr orig)2148 BlastDbinfoAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2149 {
2150 DataVal av;
2151 AsnTypePtr atp;
2152 Boolean isError = FALSE;
2153 AsnReadFunc func;
2154 BlastDbinfoPtr ptr;
2155
2156 if (! loaded)
2157 {
2158 if (! objblst3AsnLoad()) {
2159 return NULL;
2160 }
2161 }
2162
2163 if (aip == NULL) {
2164 return NULL;
2165 }
2166
2167 if (orig == NULL) { /* BlastDbinfo ::= (self contained) */
2168 atp = AsnReadId(aip, amp, BLAST_DBINFO);
2169 } else {
2170 atp = AsnLinkType(orig, BLAST_DBINFO);
2171 }
2172 /* link in local tree */
2173 if (atp == NULL) {
2174 return NULL;
2175 }
2176
2177 ptr = BlastDbinfoNew();
2178 if (ptr == NULL) {
2179 goto erret;
2180 }
2181 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2182 goto erret;
2183 }
2184
2185 atp = AsnReadId(aip,amp, atp);
2186 func = NULL;
2187
2188 if (atp == BLAST_DBINFO_is_protein) {
2189 if ( AsnReadVal(aip, atp, &av) <= 0) {
2190 goto erret;
2191 }
2192 ptr -> is_protein = av.boolvalue;
2193 atp = AsnReadId(aip,amp, atp);
2194 }
2195 if (atp == BLAST_DBINFO_name) {
2196 if ( AsnReadVal(aip, atp, &av) <= 0) {
2197 goto erret;
2198 }
2199 ptr -> name = av.ptrvalue;
2200 atp = AsnReadId(aip,amp, atp);
2201 }
2202 if (atp == BLAST_DBINFO_definition) {
2203 if ( AsnReadVal(aip, atp, &av) <= 0) {
2204 goto erret;
2205 }
2206 ptr -> definition = av.ptrvalue;
2207 atp = AsnReadId(aip,amp, atp);
2208 }
2209 if (atp == BLAST_DBINFO_date) {
2210 if ( AsnReadVal(aip, atp, &av) <= 0) {
2211 goto erret;
2212 }
2213 ptr -> date = av.ptrvalue;
2214 atp = AsnReadId(aip,amp, atp);
2215 }
2216 if (atp == BLAST_DBINFO_total_length) {
2217 if ( AsnReadVal(aip, atp, &av) <= 0) {
2218 goto erret;
2219 }
2220 ptr -> total_length = av.intvalue;
2221 atp = AsnReadId(aip,amp, atp);
2222 }
2223 if (atp == BLAST_DBINFO_number_seqs) {
2224 if ( AsnReadVal(aip, atp, &av) <= 0) {
2225 goto erret;
2226 }
2227 ptr -> number_seqs = av.intvalue;
2228 atp = AsnReadId(aip,amp, atp);
2229 }
2230
2231 if (AsnReadVal(aip, atp, &av) <= 0) {
2232 goto erret;
2233 }
2234 /* end struct */
2235
2236 ret:
2237 AsnUnlinkType(orig); /* unlink local tree */
2238 return ptr;
2239
2240 erret:
2241 aip -> io_failure = TRUE;
2242 ptr = BlastDbinfoFree(ptr);
2243 goto ret;
2244 }
2245
2246
2247
2248 /**************************************************
2249 *
2250 * BlastDbinfoAsnWrite()
2251 *
2252 **************************************************/
2253 NLM_EXTERN Boolean LIBCALL
BlastDbinfoAsnWrite(BlastDbinfoPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2254 BlastDbinfoAsnWrite(BlastDbinfoPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2255 {
2256 DataVal av;
2257 AsnTypePtr atp;
2258 Boolean retval = FALSE;
2259
2260 if (! loaded)
2261 {
2262 if (! objblst3AsnLoad()) {
2263 return FALSE;
2264 }
2265 }
2266
2267 if (aip == NULL) {
2268 return FALSE;
2269 }
2270
2271 atp = AsnLinkType(orig, BLAST_DBINFO); /* link local tree */
2272 if (atp == NULL) {
2273 return FALSE;
2274 }
2275
2276 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2277 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2278 goto erret;
2279 }
2280
2281 av.boolvalue = ptr -> is_protein;
2282 retval = AsnWrite(aip, BLAST_DBINFO_is_protein, &av);
2283 if (ptr -> name != NULL) {
2284 av.ptrvalue = ptr -> name;
2285 retval = AsnWrite(aip, BLAST_DBINFO_name, &av);
2286 }
2287 if (ptr -> definition != NULL) {
2288 av.ptrvalue = ptr -> definition;
2289 retval = AsnWrite(aip, BLAST_DBINFO_definition, &av);
2290 }
2291 if (ptr -> date != NULL) {
2292 av.ptrvalue = ptr -> date;
2293 retval = AsnWrite(aip, BLAST_DBINFO_date, &av);
2294 }
2295 av.intvalue = ptr -> total_length;
2296 retval = AsnWrite(aip, BLAST_DBINFO_total_length, &av);
2297 av.intvalue = ptr -> number_seqs;
2298 retval = AsnWrite(aip, BLAST_DBINFO_number_seqs, &av);
2299 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2300 goto erret;
2301 }
2302 retval = TRUE;
2303
2304 erret:
2305 AsnUnlinkType(orig); /* unlink local tree */
2306 return retval;
2307 }
2308
2309
2310
2311 /**************************************************
2312 *
2313 * BlastMaskNew()
2314 *
2315 **************************************************/
2316 NLM_EXTERN
2317 BlastMaskPtr LIBCALL
BlastMaskNew(void)2318 BlastMaskNew(void)
2319 {
2320 BlastMaskPtr ptr = MemNew((size_t) sizeof(BlastMask));
2321
2322 return ptr;
2323
2324 }
2325
2326
2327 /**************************************************
2328 *
2329 * BlastMaskFree()
2330 *
2331 **************************************************/
2332 NLM_EXTERN
2333 BlastMaskPtr LIBCALL
BlastMaskFree(BlastMaskPtr ptr)2334 BlastMaskFree(BlastMaskPtr ptr)
2335 {
2336
2337 if(ptr == NULL) {
2338 return NULL;
2339 }
2340 AsnGenericChoiceSeqOfFree(ptr -> location, (AsnOptFreeFunc) SeqLocFree);
2341 return MemFree(ptr);
2342 }
2343
2344
2345 /**************************************************
2346 *
2347 * BlastMaskAsnRead()
2348 *
2349 **************************************************/
2350 NLM_EXTERN
2351 BlastMaskPtr LIBCALL
BlastMaskAsnRead(AsnIoPtr aip,AsnTypePtr orig)2352 BlastMaskAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2353 {
2354 DataVal av;
2355 AsnTypePtr atp;
2356 Boolean isError = FALSE;
2357 AsnReadFunc func;
2358 BlastMaskPtr ptr;
2359
2360 if (! loaded)
2361 {
2362 if (! objblst3AsnLoad()) {
2363 return NULL;
2364 }
2365 }
2366
2367 if (aip == NULL) {
2368 return NULL;
2369 }
2370
2371 if (orig == NULL) { /* BlastMask ::= (self contained) */
2372 atp = AsnReadId(aip, amp, BLAST_MASK);
2373 } else {
2374 atp = AsnLinkType(orig, BLAST_MASK);
2375 }
2376 /* link in local tree */
2377 if (atp == NULL) {
2378 return NULL;
2379 }
2380
2381 ptr = BlastMaskNew();
2382 if (ptr == NULL) {
2383 goto erret;
2384 }
2385 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2386 goto erret;
2387 }
2388
2389 atp = AsnReadId(aip,amp, atp);
2390 func = NULL;
2391
2392 if (atp == BLAST_MASK_location) {
2393 ptr -> location = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqLocAsnRead, (AsnOptFreeFunc) SeqLocFree);
2394 if (isError && ptr -> location == NULL) {
2395 goto erret;
2396 }
2397 atp = AsnReadId(aip,amp, atp);
2398 }
2399 if (atp == BLAST_MASK_frame) {
2400 if ( AsnReadVal(aip, atp, &av) <= 0) {
2401 goto erret;
2402 }
2403 ptr -> frame = av.intvalue;
2404 atp = AsnReadId(aip,amp, atp);
2405 }
2406
2407 if (AsnReadVal(aip, atp, &av) <= 0) {
2408 goto erret;
2409 }
2410 /* end struct */
2411
2412 ret:
2413 AsnUnlinkType(orig); /* unlink local tree */
2414 return ptr;
2415
2416 erret:
2417 aip -> io_failure = TRUE;
2418 ptr = BlastMaskFree(ptr);
2419 goto ret;
2420 }
2421
2422
2423
2424 /**************************************************
2425 *
2426 * BlastMaskAsnWrite()
2427 *
2428 **************************************************/
2429 NLM_EXTERN Boolean LIBCALL
BlastMaskAsnWrite(BlastMaskPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2430 BlastMaskAsnWrite(BlastMaskPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2431 {
2432 DataVal av;
2433 AsnTypePtr atp;
2434 Boolean retval = FALSE;
2435
2436 if (! loaded)
2437 {
2438 if (! objblst3AsnLoad()) {
2439 return FALSE;
2440 }
2441 }
2442
2443 if (aip == NULL) {
2444 return FALSE;
2445 }
2446
2447 atp = AsnLinkType(orig, BLAST_MASK); /* link local tree */
2448 if (atp == NULL) {
2449 return FALSE;
2450 }
2451
2452 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2453 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2454 goto erret;
2455 }
2456
2457 AsnGenericChoiceSeqOfAsnWrite(ptr -> location, (AsnWriteFunc) SeqLocAsnWrite, aip, BLAST_MASK_location, BLAST_MASK_location_E);
2458 av.intvalue = ptr -> frame;
2459 retval = AsnWrite(aip, BLAST_MASK_frame, &av);
2460 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2461 goto erret;
2462 }
2463 retval = TRUE;
2464
2465 erret:
2466 AsnUnlinkType(orig); /* unlink local tree */
2467 return retval;
2468 }
2469
2470
2471
2472 /**************************************************
2473 *
2474 * BlastKABlkNew()
2475 *
2476 **************************************************/
2477 NLM_EXTERN
2478 BlastKABlkPtr LIBCALL
BlastKABlkNew(void)2479 BlastKABlkNew(void)
2480 {
2481 BlastKABlkPtr ptr = MemNew((size_t) sizeof(BlastKABlk));
2482
2483 return ptr;
2484
2485 }
2486
2487
2488 /**************************************************
2489 *
2490 * BlastKABlkFree()
2491 *
2492 **************************************************/
2493 NLM_EXTERN
2494 BlastKABlkPtr LIBCALL
BlastKABlkFree(BlastKABlkPtr ptr)2495 BlastKABlkFree(BlastKABlkPtr ptr)
2496 {
2497
2498 if(ptr == NULL) {
2499 return NULL;
2500 }
2501 return MemFree(ptr);
2502 }
2503
2504
2505 /**************************************************
2506 *
2507 * BlastKABlkAsnRead()
2508 *
2509 **************************************************/
2510 NLM_EXTERN
2511 BlastKABlkPtr LIBCALL
BlastKABlkAsnRead(AsnIoPtr aip,AsnTypePtr orig)2512 BlastKABlkAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2513 {
2514 DataVal av;
2515 AsnTypePtr atp;
2516 Boolean isError = FALSE;
2517 AsnReadFunc func;
2518 BlastKABlkPtr ptr;
2519
2520 if (! loaded)
2521 {
2522 if (! objblst3AsnLoad()) {
2523 return NULL;
2524 }
2525 }
2526
2527 if (aip == NULL) {
2528 return NULL;
2529 }
2530
2531 if (orig == NULL) { /* BlastKABlk ::= (self contained) */
2532 atp = AsnReadId(aip, amp, BLAST_KABLK);
2533 } else {
2534 atp = AsnLinkType(orig, BLAST_KABLK);
2535 }
2536 /* link in local tree */
2537 if (atp == NULL) {
2538 return NULL;
2539 }
2540
2541 ptr = BlastKABlkNew();
2542 if (ptr == NULL) {
2543 goto erret;
2544 }
2545 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2546 goto erret;
2547 }
2548
2549 atp = AsnReadId(aip,amp, atp);
2550 func = NULL;
2551
2552 if (atp == BLAST_KABLK_lambda) {
2553 if ( AsnReadVal(aip, atp, &av) <= 0) {
2554 goto erret;
2555 }
2556 ptr -> lambda = av.realvalue;
2557 atp = AsnReadId(aip,amp, atp);
2558 }
2559 if (atp == BLAST_KABLK_k) {
2560 if ( AsnReadVal(aip, atp, &av) <= 0) {
2561 goto erret;
2562 }
2563 ptr -> k = av.realvalue;
2564 atp = AsnReadId(aip,amp, atp);
2565 }
2566 if (atp == BLAST_KABLK_h) {
2567 if ( AsnReadVal(aip, atp, &av) <= 0) {
2568 goto erret;
2569 }
2570 ptr -> h = av.realvalue;
2571 atp = AsnReadId(aip,amp, atp);
2572 }
2573 if (atp == BLAST_KABLK_gapped) {
2574 if ( AsnReadVal(aip, atp, &av) <= 0) {
2575 goto erret;
2576 }
2577 ptr -> gapped = av.boolvalue;
2578 atp = AsnReadId(aip,amp, atp);
2579 }
2580
2581 if (AsnReadVal(aip, atp, &av) <= 0) {
2582 goto erret;
2583 }
2584 /* end struct */
2585
2586 ret:
2587 AsnUnlinkType(orig); /* unlink local tree */
2588 return ptr;
2589
2590 erret:
2591 aip -> io_failure = TRUE;
2592 ptr = BlastKABlkFree(ptr);
2593 goto ret;
2594 }
2595
2596
2597
2598 /**************************************************
2599 *
2600 * BlastKABlkAsnWrite()
2601 *
2602 **************************************************/
2603 NLM_EXTERN Boolean LIBCALL
BlastKABlkAsnWrite(BlastKABlkPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2604 BlastKABlkAsnWrite(BlastKABlkPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2605 {
2606 DataVal av;
2607 AsnTypePtr atp;
2608 Boolean retval = FALSE;
2609
2610 if (! loaded)
2611 {
2612 if (! objblst3AsnLoad()) {
2613 return FALSE;
2614 }
2615 }
2616
2617 if (aip == NULL) {
2618 return FALSE;
2619 }
2620
2621 atp = AsnLinkType(orig, BLAST_KABLK); /* link local tree */
2622 if (atp == NULL) {
2623 return FALSE;
2624 }
2625
2626 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2627 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2628 goto erret;
2629 }
2630
2631 av.realvalue = ptr -> lambda;
2632 retval = AsnWrite(aip, BLAST_KABLK_lambda, &av);
2633 av.realvalue = ptr -> k;
2634 retval = AsnWrite(aip, BLAST_KABLK_k, &av);
2635 av.realvalue = ptr -> h;
2636 retval = AsnWrite(aip, BLAST_KABLK_h, &av);
2637 av.boolvalue = ptr -> gapped;
2638 retval = AsnWrite(aip, BLAST_KABLK_gapped, &av);
2639 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2640 goto erret;
2641 }
2642 retval = TRUE;
2643
2644 erret:
2645 AsnUnlinkType(orig); /* unlink local tree */
2646 return retval;
2647 }
2648
2649
2650
2651 /**************************************************
2652 *
2653 * BlastErrorNew()
2654 *
2655 **************************************************/
2656 NLM_EXTERN
2657 BlastErrorPtr LIBCALL
BlastErrorNew(void)2658 BlastErrorNew(void)
2659 {
2660 BlastErrorPtr ptr = MemNew((size_t) sizeof(BlastError));
2661
2662 return ptr;
2663
2664 }
2665
2666
2667 /**************************************************
2668 *
2669 * BlastErrorFree()
2670 *
2671 **************************************************/
2672 NLM_EXTERN
2673 BlastErrorPtr LIBCALL
BlastErrorFree(BlastErrorPtr ptr)2674 BlastErrorFree(BlastErrorPtr ptr)
2675 {
2676
2677 if(ptr == NULL) {
2678 return NULL;
2679 }
2680 MemFree(ptr -> msg);
2681 return MemFree(ptr);
2682 }
2683
2684
2685 /**************************************************
2686 *
2687 * BlastErrorAsnRead()
2688 *
2689 **************************************************/
2690 NLM_EXTERN
2691 BlastErrorPtr LIBCALL
BlastErrorAsnRead(AsnIoPtr aip,AsnTypePtr orig)2692 BlastErrorAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2693 {
2694 DataVal av;
2695 AsnTypePtr atp;
2696 Boolean isError = FALSE;
2697 AsnReadFunc func;
2698 BlastErrorPtr ptr;
2699
2700 if (! loaded)
2701 {
2702 if (! objblst3AsnLoad()) {
2703 return NULL;
2704 }
2705 }
2706
2707 if (aip == NULL) {
2708 return NULL;
2709 }
2710
2711 if (orig == NULL) { /* BlastError ::= (self contained) */
2712 atp = AsnReadId(aip, amp, BLAST_ERROR);
2713 } else {
2714 atp = AsnLinkType(orig, BLAST_ERROR);
2715 }
2716 /* link in local tree */
2717 if (atp == NULL) {
2718 return NULL;
2719 }
2720
2721 ptr = BlastErrorNew();
2722 if (ptr == NULL) {
2723 goto erret;
2724 }
2725 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2726 goto erret;
2727 }
2728
2729 atp = AsnReadId(aip,amp, atp);
2730 func = NULL;
2731
2732 if (atp == BLAST_ERROR_level) {
2733 if ( AsnReadVal(aip, atp, &av) <= 0) {
2734 goto erret;
2735 }
2736 ptr -> level = av.intvalue;
2737 atp = AsnReadId(aip,amp, atp);
2738 }
2739 if (atp == BLAST_ERROR_msg) {
2740 if ( AsnReadVal(aip, atp, &av) <= 0) {
2741 goto erret;
2742 }
2743 ptr -> msg = av.ptrvalue;
2744 atp = AsnReadId(aip,amp, atp);
2745 }
2746
2747 if (AsnReadVal(aip, atp, &av) <= 0) {
2748 goto erret;
2749 }
2750 /* end struct */
2751
2752 ret:
2753 AsnUnlinkType(orig); /* unlink local tree */
2754 return ptr;
2755
2756 erret:
2757 aip -> io_failure = TRUE;
2758 ptr = BlastErrorFree(ptr);
2759 goto ret;
2760 }
2761
2762
2763
2764 /**************************************************
2765 *
2766 * BlastErrorAsnWrite()
2767 *
2768 **************************************************/
2769 NLM_EXTERN Boolean LIBCALL
BlastErrorAsnWrite(BlastErrorPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2770 BlastErrorAsnWrite(BlastErrorPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2771 {
2772 DataVal av;
2773 AsnTypePtr atp;
2774 Boolean retval = FALSE;
2775
2776 if (! loaded)
2777 {
2778 if (! objblst3AsnLoad()) {
2779 return FALSE;
2780 }
2781 }
2782
2783 if (aip == NULL) {
2784 return FALSE;
2785 }
2786
2787 atp = AsnLinkType(orig, BLAST_ERROR); /* link local tree */
2788 if (atp == NULL) {
2789 return FALSE;
2790 }
2791
2792 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2793 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2794 goto erret;
2795 }
2796
2797 av.intvalue = ptr -> level;
2798 retval = AsnWrite(aip, BLAST_ERROR_level, &av);
2799 if (ptr -> msg != NULL) {
2800 av.ptrvalue = ptr -> msg;
2801 retval = AsnWrite(aip, BLAST_ERROR_msg, &av);
2802 }
2803 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2804 goto erret;
2805 }
2806 retval = TRUE;
2807
2808 erret:
2809 AsnUnlinkType(orig); /* unlink local tree */
2810 return retval;
2811 }
2812
2813
2814
2815 /**************************************************
2816 *
2817 * BlastPhialignNew()
2818 *
2819 **************************************************/
2820 NLM_EXTERN
2821 BlastPhialignPtr LIBCALL
BlastPhialignNew(void)2822 BlastPhialignNew(void)
2823 {
2824 BlastPhialignPtr ptr = MemNew((size_t) sizeof(BlastPhialign));
2825
2826 return ptr;
2827
2828 }
2829
2830
2831 /**************************************************
2832 *
2833 * BlastPhialignFree()
2834 *
2835 **************************************************/
2836 NLM_EXTERN
2837 BlastPhialignPtr LIBCALL
BlastPhialignFree(BlastPhialignPtr ptr)2838 BlastPhialignFree(BlastPhialignPtr ptr)
2839 {
2840
2841 if(ptr == NULL) {
2842 return NULL;
2843 }
2844 AsnGenericChoiceSeqOfFree(ptr -> seqloc, (AsnOptFreeFunc) SeqLocFree);
2845 return MemFree(ptr);
2846 }
2847
2848
2849 /**************************************************
2850 *
2851 * BlastPhialignAsnRead()
2852 *
2853 **************************************************/
2854 NLM_EXTERN
2855 BlastPhialignPtr LIBCALL
BlastPhialignAsnRead(AsnIoPtr aip,AsnTypePtr orig)2856 BlastPhialignAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2857 {
2858 DataVal av;
2859 AsnTypePtr atp;
2860 Boolean isError = FALSE;
2861 AsnReadFunc func;
2862 BlastPhialignPtr ptr;
2863
2864 if (! loaded)
2865 {
2866 if (! objblst3AsnLoad()) {
2867 return NULL;
2868 }
2869 }
2870
2871 if (aip == NULL) {
2872 return NULL;
2873 }
2874
2875 if (orig == NULL) { /* BlastPhialign ::= (self contained) */
2876 atp = AsnReadId(aip, amp, BLAST_PHIALIGN);
2877 } else {
2878 atp = AsnLinkType(orig, BLAST_PHIALIGN);
2879 }
2880 /* link in local tree */
2881 if (atp == NULL) {
2882 return NULL;
2883 }
2884
2885 ptr = BlastPhialignNew();
2886 if (ptr == NULL) {
2887 goto erret;
2888 }
2889 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2890 goto erret;
2891 }
2892
2893 atp = AsnReadId(aip,amp, atp);
2894 func = NULL;
2895
2896 if (atp == BLAST_PHIALIGN_numaligns) {
2897 if ( AsnReadVal(aip, atp, &av) <= 0) {
2898 goto erret;
2899 }
2900 ptr -> numaligns = av.intvalue;
2901 atp = AsnReadId(aip,amp, atp);
2902 }
2903 if (atp == BLAST_PHIALIGN_seqloc) {
2904 ptr -> seqloc = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqLocAsnRead, (AsnOptFreeFunc) SeqLocFree);
2905 if (isError && ptr -> seqloc == NULL) {
2906 goto erret;
2907 }
2908 atp = AsnReadId(aip,amp, atp);
2909 }
2910
2911 if (AsnReadVal(aip, atp, &av) <= 0) {
2912 goto erret;
2913 }
2914 /* end struct */
2915
2916 ret:
2917 AsnUnlinkType(orig); /* unlink local tree */
2918 return ptr;
2919
2920 erret:
2921 aip -> io_failure = TRUE;
2922 ptr = BlastPhialignFree(ptr);
2923 goto ret;
2924 }
2925
2926
2927
2928 /**************************************************
2929 *
2930 * BlastPhialignAsnWrite()
2931 *
2932 **************************************************/
2933 NLM_EXTERN Boolean LIBCALL
BlastPhialignAsnWrite(BlastPhialignPtr ptr,AsnIoPtr aip,AsnTypePtr orig)2934 BlastPhialignAsnWrite(BlastPhialignPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2935 {
2936 DataVal av;
2937 AsnTypePtr atp;
2938 Boolean retval = FALSE;
2939
2940 if (! loaded)
2941 {
2942 if (! objblst3AsnLoad()) {
2943 return FALSE;
2944 }
2945 }
2946
2947 if (aip == NULL) {
2948 return FALSE;
2949 }
2950
2951 atp = AsnLinkType(orig, BLAST_PHIALIGN); /* link local tree */
2952 if (atp == NULL) {
2953 return FALSE;
2954 }
2955
2956 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2957 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2958 goto erret;
2959 }
2960
2961 av.intvalue = ptr -> numaligns;
2962 retval = AsnWrite(aip, BLAST_PHIALIGN_numaligns, &av);
2963 AsnGenericChoiceSeqOfAsnWrite(ptr -> seqloc, (AsnWriteFunc) SeqLocAsnWrite, aip, BLAST_PHIALIGN_seqloc, BLAST_PHIALIGN_seqloc_E);
2964 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2965 goto erret;
2966 }
2967 retval = TRUE;
2968
2969 erret:
2970 AsnUnlinkType(orig); /* unlink local tree */
2971 return retval;
2972 }
2973
2974
2975
2976 /**************************************************
2977 *
2978 * BlastDbinfoGetNew()
2979 *
2980 **************************************************/
2981 NLM_EXTERN
2982 BlastDbinfoGetPtr LIBCALL
BlastDbinfoGetNew(void)2983 BlastDbinfoGetNew(void)
2984 {
2985 BlastDbinfoGetPtr ptr = MemNew((size_t) sizeof(BlastDbinfoGet));
2986
2987 return ptr;
2988
2989 }
2990
2991
2992 /**************************************************
2993 *
2994 * BlastDbinfoGetFree()
2995 *
2996 **************************************************/
2997 NLM_EXTERN
2998 BlastDbinfoGetPtr LIBCALL
BlastDbinfoGetFree(BlastDbinfoGetPtr ptr)2999 BlastDbinfoGetFree(BlastDbinfoGetPtr ptr)
3000 {
3001
3002 if(ptr == NULL) {
3003 return NULL;
3004 }
3005 MemFree(ptr -> name);
3006 return MemFree(ptr);
3007 }
3008
3009
3010 /**************************************************
3011 *
3012 * BlastDbinfoGetAsnRead()
3013 *
3014 **************************************************/
3015 NLM_EXTERN
3016 BlastDbinfoGetPtr LIBCALL
BlastDbinfoGetAsnRead(AsnIoPtr aip,AsnTypePtr orig)3017 BlastDbinfoGetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3018 {
3019 DataVal av;
3020 AsnTypePtr atp;
3021 Boolean isError = FALSE;
3022 AsnReadFunc func;
3023 BlastDbinfoGetPtr ptr;
3024
3025 if (! loaded)
3026 {
3027 if (! objblst3AsnLoad()) {
3028 return NULL;
3029 }
3030 }
3031
3032 if (aip == NULL) {
3033 return NULL;
3034 }
3035
3036 if (orig == NULL) { /* BlastDbinfoGet ::= (self contained) */
3037 atp = AsnReadId(aip, amp, BLAST_DBINFO_GET);
3038 } else {
3039 atp = AsnLinkType(orig, BLAST_DBINFO_GET);
3040 }
3041 /* link in local tree */
3042 if (atp == NULL) {
3043 return NULL;
3044 }
3045
3046 ptr = BlastDbinfoGetNew();
3047 if (ptr == NULL) {
3048 goto erret;
3049 }
3050 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3051 goto erret;
3052 }
3053
3054 atp = AsnReadId(aip,amp, atp);
3055 func = NULL;
3056
3057 if (atp == BLAST_DBINFO_GET_name) {
3058 if ( AsnReadVal(aip, atp, &av) <= 0) {
3059 goto erret;
3060 }
3061 ptr -> name = av.ptrvalue;
3062 atp = AsnReadId(aip,amp, atp);
3063 }
3064 if (atp == BLAST_DBINFO_GET_type) {
3065 if ( AsnReadVal(aip, atp, &av) <= 0) {
3066 goto erret;
3067 }
3068 ptr -> type = av.intvalue;
3069 atp = AsnReadId(aip,amp, atp);
3070 }
3071
3072 if (AsnReadVal(aip, atp, &av) <= 0) {
3073 goto erret;
3074 }
3075 /* end struct */
3076
3077 ret:
3078 AsnUnlinkType(orig); /* unlink local tree */
3079 return ptr;
3080
3081 erret:
3082 aip -> io_failure = TRUE;
3083 ptr = BlastDbinfoGetFree(ptr);
3084 goto ret;
3085 }
3086
3087
3088
3089 /**************************************************
3090 *
3091 * BlastDbinfoGetAsnWrite()
3092 *
3093 **************************************************/
3094 NLM_EXTERN Boolean LIBCALL
BlastDbinfoGetAsnWrite(BlastDbinfoGetPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3095 BlastDbinfoGetAsnWrite(BlastDbinfoGetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3096 {
3097 DataVal av;
3098 AsnTypePtr atp;
3099 Boolean retval = FALSE;
3100
3101 if (! loaded)
3102 {
3103 if (! objblst3AsnLoad()) {
3104 return FALSE;
3105 }
3106 }
3107
3108 if (aip == NULL) {
3109 return FALSE;
3110 }
3111
3112 atp = AsnLinkType(orig, BLAST_DBINFO_GET); /* link local tree */
3113 if (atp == NULL) {
3114 return FALSE;
3115 }
3116
3117 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3118 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3119 goto erret;
3120 }
3121
3122 if (ptr -> name != NULL) {
3123 av.ptrvalue = ptr -> name;
3124 retval = AsnWrite(aip, BLAST_DBINFO_GET_name, &av);
3125 }
3126 av.intvalue = ptr -> type;
3127 retval = AsnWrite(aip, BLAST_DBINFO_GET_type, &av);
3128 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3129 goto erret;
3130 }
3131 retval = TRUE;
3132
3133 erret:
3134 AsnUnlinkType(orig); /* unlink local tree */
3135 return retval;
3136 }
3137
3138
3139
3140 /**************************************************
3141 *
3142 * BlastSeqIdNew()
3143 *
3144 **************************************************/
3145 NLM_EXTERN
3146 BlastSeqIdPtr LIBCALL
BlastSeqIdNew(void)3147 BlastSeqIdNew(void)
3148 {
3149 BlastSeqIdPtr ptr = MemNew((size_t) sizeof(BlastSeqId));
3150
3151 return ptr;
3152
3153 }
3154
3155
3156 /**************************************************
3157 *
3158 * BlastSeqIdFree()
3159 *
3160 **************************************************/
3161 NLM_EXTERN
3162 BlastSeqIdPtr LIBCALL
BlastSeqIdFree(BlastSeqIdPtr ptr)3163 BlastSeqIdFree(BlastSeqIdPtr ptr)
3164 {
3165
3166 if(ptr == NULL) {
3167 return NULL;
3168 }
3169 MemFree(ptr -> database);
3170 SeqIdFree(ptr -> id);
3171 return MemFree(ptr);
3172 }
3173
3174
3175 /**************************************************
3176 *
3177 * BlastSeqIdAsnRead()
3178 *
3179 **************************************************/
3180 NLM_EXTERN
3181 BlastSeqIdPtr LIBCALL
BlastSeqIdAsnRead(AsnIoPtr aip,AsnTypePtr orig)3182 BlastSeqIdAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3183 {
3184 DataVal av;
3185 AsnTypePtr atp;
3186 Boolean isError = FALSE;
3187 AsnReadFunc func;
3188 BlastSeqIdPtr ptr;
3189
3190 if (! loaded)
3191 {
3192 if (! objblst3AsnLoad()) {
3193 return NULL;
3194 }
3195 }
3196
3197 if (aip == NULL) {
3198 return NULL;
3199 }
3200
3201 if (orig == NULL) { /* BlastSeqId ::= (self contained) */
3202 atp = AsnReadId(aip, amp, BLAST_SEQ_ID);
3203 } else {
3204 atp = AsnLinkType(orig, BLAST_SEQ_ID);
3205 }
3206 /* link in local tree */
3207 if (atp == NULL) {
3208 return NULL;
3209 }
3210
3211 ptr = BlastSeqIdNew();
3212 if (ptr == NULL) {
3213 goto erret;
3214 }
3215 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3216 goto erret;
3217 }
3218
3219 atp = AsnReadId(aip,amp, atp);
3220 func = NULL;
3221
3222 if (atp == BLAST_SEQ_ID_is_protein) {
3223 if ( AsnReadVal(aip, atp, &av) <= 0) {
3224 goto erret;
3225 }
3226 ptr -> is_protein = av.boolvalue;
3227 atp = AsnReadId(aip,amp, atp);
3228 }
3229 if (atp == BLAST_SEQ_ID_database) {
3230 if ( AsnReadVal(aip, atp, &av) <= 0) {
3231 goto erret;
3232 }
3233 ptr -> database = av.ptrvalue;
3234 atp = AsnReadId(aip,amp, atp);
3235 }
3236 if (atp == BLAST_SEQ_ID_id) {
3237 ptr -> id = SeqIdAsnRead(aip, atp);
3238 if (aip -> io_failure) {
3239 goto erret;
3240 }
3241 atp = AsnReadId(aip,amp, atp);
3242 }
3243
3244 if (AsnReadVal(aip, atp, &av) <= 0) {
3245 goto erret;
3246 }
3247 /* end struct */
3248
3249 ret:
3250 AsnUnlinkType(orig); /* unlink local tree */
3251 return ptr;
3252
3253 erret:
3254 aip -> io_failure = TRUE;
3255 ptr = BlastSeqIdFree(ptr);
3256 goto ret;
3257 }
3258
3259
3260
3261 /**************************************************
3262 *
3263 * BlastSeqIdAsnWrite()
3264 *
3265 **************************************************/
3266 NLM_EXTERN Boolean LIBCALL
BlastSeqIdAsnWrite(BlastSeqIdPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3267 BlastSeqIdAsnWrite(BlastSeqIdPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3268 {
3269 DataVal av;
3270 AsnTypePtr atp;
3271 Boolean retval = FALSE;
3272
3273 if (! loaded)
3274 {
3275 if (! objblst3AsnLoad()) {
3276 return FALSE;
3277 }
3278 }
3279
3280 if (aip == NULL) {
3281 return FALSE;
3282 }
3283
3284 atp = AsnLinkType(orig, BLAST_SEQ_ID); /* link local tree */
3285 if (atp == NULL) {
3286 return FALSE;
3287 }
3288
3289 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3290 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3291 goto erret;
3292 }
3293
3294 av.boolvalue = ptr -> is_protein;
3295 retval = AsnWrite(aip, BLAST_SEQ_ID_is_protein, &av);
3296 if (ptr -> database != NULL) {
3297 av.ptrvalue = ptr -> database;
3298 retval = AsnWrite(aip, BLAST_SEQ_ID_database, &av);
3299 }
3300 if (ptr -> id != NULL) {
3301 if ( ! SeqIdAsnWrite(ptr -> id, aip, BLAST_SEQ_ID_id)) {
3302 goto erret;
3303 }
3304 }
3305 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3306 goto erret;
3307 }
3308 retval = TRUE;
3309
3310 erret:
3311 AsnUnlinkType(orig); /* unlink local tree */
3312 return retval;
3313 }
3314
3315
3316
3317 /**************************************************
3318 *
3319 * BlastSequenceNew()
3320 *
3321 **************************************************/
3322 NLM_EXTERN
3323 BlastSequencePtr LIBCALL
BlastSequenceNew(void)3324 BlastSequenceNew(void)
3325 {
3326 BlastSequencePtr ptr = MemNew((size_t) sizeof(BlastSequence));
3327
3328 return ptr;
3329
3330 }
3331
3332
3333 /**************************************************
3334 *
3335 * BlastSequenceFree()
3336 *
3337 **************************************************/
3338 NLM_EXTERN
3339 BlastSequencePtr LIBCALL
BlastSequenceFree(BlastSequencePtr ptr)3340 BlastSequenceFree(BlastSequencePtr ptr)
3341 {
3342
3343 if(ptr == NULL) {
3344 return NULL;
3345 }
3346 SeqAlignFree(ptr -> align);
3347 BSFree(ptr -> db_seq);
3348 return MemFree(ptr);
3349 }
3350
3351
3352 /**************************************************
3353 *
3354 * BlastSequenceAsnRead()
3355 *
3356 **************************************************/
3357 NLM_EXTERN
3358 BlastSequencePtr LIBCALL
BlastSequenceAsnRead(AsnIoPtr aip,AsnTypePtr orig)3359 BlastSequenceAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3360 {
3361 DataVal av;
3362 AsnTypePtr atp;
3363 Boolean isError = FALSE;
3364 AsnReadFunc func;
3365 BlastSequencePtr ptr;
3366
3367 if (! loaded)
3368 {
3369 if (! objblst3AsnLoad()) {
3370 return NULL;
3371 }
3372 }
3373
3374 if (aip == NULL) {
3375 return NULL;
3376 }
3377
3378 if (orig == NULL) { /* BlastSequence ::= (self contained) */
3379 atp = AsnReadId(aip, amp, BLAST_SEQUENCE);
3380 } else {
3381 atp = AsnLinkType(orig, BLAST_SEQUENCE);
3382 }
3383 /* link in local tree */
3384 if (atp == NULL) {
3385 return NULL;
3386 }
3387
3388 ptr = BlastSequenceNew();
3389 if (ptr == NULL) {
3390 goto erret;
3391 }
3392 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3393 goto erret;
3394 }
3395
3396 atp = AsnReadId(aip,amp, atp);
3397 func = NULL;
3398
3399 if (atp == BLAST_SEQUENCE_align) {
3400 ptr -> align = SeqAlignAsnRead(aip, atp);
3401 if (aip -> io_failure) {
3402 goto erret;
3403 }
3404 atp = AsnReadId(aip,amp, atp);
3405 }
3406 if (atp == BLAST_SEQUENCE_db_seq) {
3407 if ( AsnReadVal(aip, atp, &av) <= 0) {
3408 goto erret;
3409 }
3410 ptr -> db_seq = av.ptrvalue;
3411 atp = AsnReadId(aip,amp, atp);
3412 }
3413
3414 if (AsnReadVal(aip, atp, &av) <= 0) {
3415 goto erret;
3416 }
3417 /* end struct */
3418
3419 ret:
3420 AsnUnlinkType(orig); /* unlink local tree */
3421 return ptr;
3422
3423 erret:
3424 aip -> io_failure = TRUE;
3425 ptr = BlastSequenceFree(ptr);
3426 goto ret;
3427 }
3428
3429
3430
3431 /**************************************************
3432 *
3433 * BlastSequenceAsnWrite()
3434 *
3435 **************************************************/
3436 NLM_EXTERN Boolean LIBCALL
BlastSequenceAsnWrite(BlastSequencePtr ptr,AsnIoPtr aip,AsnTypePtr orig)3437 BlastSequenceAsnWrite(BlastSequencePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3438 {
3439 DataVal av;
3440 AsnTypePtr atp;
3441 Boolean retval = FALSE;
3442
3443 if (! loaded)
3444 {
3445 if (! objblst3AsnLoad()) {
3446 return FALSE;
3447 }
3448 }
3449
3450 if (aip == NULL) {
3451 return FALSE;
3452 }
3453
3454 atp = AsnLinkType(orig, BLAST_SEQUENCE); /* link local tree */
3455 if (atp == NULL) {
3456 return FALSE;
3457 }
3458
3459 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3460 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3461 goto erret;
3462 }
3463
3464 if (ptr -> align != NULL) {
3465 if ( ! SeqAlignAsnWrite(ptr -> align, aip, BLAST_SEQUENCE_align)) {
3466 goto erret;
3467 }
3468 }
3469 if (ptr -> db_seq != NULL) {
3470 av.ptrvalue = ptr -> db_seq;
3471 retval = AsnWrite(aip, BLAST_SEQUENCE_db_seq, &av);
3472 }
3473 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3474 goto erret;
3475 }
3476 retval = TRUE;
3477
3478 erret:
3479 AsnUnlinkType(orig); /* unlink local tree */
3480 return retval;
3481 }
3482
3483
3484
3485 /**************************************************
3486 *
3487 * BlastPartsNew()
3488 *
3489 **************************************************/
3490 NLM_EXTERN
3491 BlastPartsPtr LIBCALL
BlastPartsNew(void)3492 BlastPartsNew(void)
3493 {
3494 BlastPartsPtr ptr = MemNew((size_t) sizeof(BlastParts));
3495
3496 return ptr;
3497
3498 }
3499
3500
3501 /**************************************************
3502 *
3503 * BlastPartsFree()
3504 *
3505 **************************************************/
3506 NLM_EXTERN
3507 BlastPartsPtr LIBCALL
BlastPartsFree(BlastPartsPtr ptr)3508 BlastPartsFree(BlastPartsPtr ptr)
3509 {
3510
3511 if(ptr == NULL) {
3512 return NULL;
3513 }
3514 MemFree(ptr -> defline);
3515 AsnGenericUserSeqOfFree(ptr -> sequence, (AsnOptFreeFunc) BlastSequenceFree);
3516 return MemFree(ptr);
3517 }
3518
3519
3520 /**************************************************
3521 *
3522 * BlastPartsAsnRead()
3523 *
3524 **************************************************/
3525 NLM_EXTERN
3526 BlastPartsPtr LIBCALL
BlastPartsAsnRead(AsnIoPtr aip,AsnTypePtr orig)3527 BlastPartsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3528 {
3529 DataVal av;
3530 AsnTypePtr atp;
3531 Boolean isError = FALSE;
3532 AsnReadFunc func;
3533 BlastPartsPtr ptr;
3534
3535 if (! loaded)
3536 {
3537 if (! objblst3AsnLoad()) {
3538 return NULL;
3539 }
3540 }
3541
3542 if (aip == NULL) {
3543 return NULL;
3544 }
3545
3546 if (orig == NULL) { /* BlastParts ::= (self contained) */
3547 atp = AsnReadId(aip, amp, BLAST_PARTS);
3548 } else {
3549 atp = AsnLinkType(orig, BLAST_PARTS);
3550 }
3551 /* link in local tree */
3552 if (atp == NULL) {
3553 return NULL;
3554 }
3555
3556 ptr = BlastPartsNew();
3557 if (ptr == NULL) {
3558 goto erret;
3559 }
3560 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3561 goto erret;
3562 }
3563
3564 atp = AsnReadId(aip,amp, atp);
3565 func = NULL;
3566
3567 if (atp == BLAST_PARTS_defline) {
3568 if ( AsnReadVal(aip, atp, &av) <= 0) {
3569 goto erret;
3570 }
3571 ptr -> defline = av.ptrvalue;
3572 atp = AsnReadId(aip,amp, atp);
3573 }
3574 if (atp == BLAST_PARTS_sequence) {
3575 ptr -> sequence = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) BlastSequenceAsnRead, (AsnOptFreeFunc) BlastSequenceFree);
3576 if (isError && ptr -> sequence == NULL) {
3577 goto erret;
3578 }
3579 atp = AsnReadId(aip,amp, atp);
3580 }
3581
3582 if (AsnReadVal(aip, atp, &av) <= 0) {
3583 goto erret;
3584 }
3585 /* end struct */
3586
3587 ret:
3588 AsnUnlinkType(orig); /* unlink local tree */
3589 return ptr;
3590
3591 erret:
3592 aip -> io_failure = TRUE;
3593 ptr = BlastPartsFree(ptr);
3594 goto ret;
3595 }
3596
3597
3598
3599 /**************************************************
3600 *
3601 * BlastPartsAsnWrite()
3602 *
3603 **************************************************/
3604 NLM_EXTERN Boolean LIBCALL
BlastPartsAsnWrite(BlastPartsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3605 BlastPartsAsnWrite(BlastPartsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3606 {
3607 DataVal av;
3608 AsnTypePtr atp;
3609 Boolean retval = FALSE;
3610
3611 if (! loaded)
3612 {
3613 if (! objblst3AsnLoad()) {
3614 return FALSE;
3615 }
3616 }
3617
3618 if (aip == NULL) {
3619 return FALSE;
3620 }
3621
3622 atp = AsnLinkType(orig, BLAST_PARTS); /* link local tree */
3623 if (atp == NULL) {
3624 return FALSE;
3625 }
3626
3627 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3628 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3629 goto erret;
3630 }
3631
3632 if (ptr -> defline != NULL) {
3633 av.ptrvalue = ptr -> defline;
3634 retval = AsnWrite(aip, BLAST_PARTS_defline, &av);
3635 }
3636 AsnGenericUserSeqOfAsnWrite(ptr -> sequence, (AsnWriteFunc) BlastSequenceAsnWrite, aip, BLAST_PARTS_sequence, BLAST_PARTS_sequence_E);
3637 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3638 goto erret;
3639 }
3640 retval = TRUE;
3641
3642 erret:
3643 AsnUnlinkType(orig); /* unlink local tree */
3644 return retval;
3645 }
3646
3647
3648
3649 /**************************************************
3650 *
3651 * BlastQueuedNew()
3652 *
3653 **************************************************/
3654 NLM_EXTERN
3655 BlastQueuedPtr LIBCALL
BlastQueuedNew(void)3656 BlastQueuedNew(void)
3657 {
3658 BlastQueuedPtr ptr = MemNew((size_t) sizeof(BlastQueued));
3659
3660 return ptr;
3661
3662 }
3663
3664
3665 /**************************************************
3666 *
3667 * BlastQueuedFree()
3668 *
3669 **************************************************/
3670 NLM_EXTERN
3671 BlastQueuedPtr LIBCALL
BlastQueuedFree(BlastQueuedPtr ptr)3672 BlastQueuedFree(BlastQueuedPtr ptr)
3673 {
3674
3675 if(ptr == NULL) {
3676 return NULL;
3677 }
3678 return MemFree(ptr);
3679 }
3680
3681
3682 /**************************************************
3683 *
3684 * BlastQueuedAsnRead()
3685 *
3686 **************************************************/
3687 NLM_EXTERN
3688 BlastQueuedPtr LIBCALL
BlastQueuedAsnRead(AsnIoPtr aip,AsnTypePtr orig)3689 BlastQueuedAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3690 {
3691 DataVal av;
3692 AsnTypePtr atp;
3693 Boolean isError = FALSE;
3694 AsnReadFunc func;
3695 BlastQueuedPtr ptr;
3696
3697 if (! loaded)
3698 {
3699 if (! objblst3AsnLoad()) {
3700 return NULL;
3701 }
3702 }
3703
3704 if (aip == NULL) {
3705 return NULL;
3706 }
3707
3708 if (orig == NULL) { /* BlastQueued ::= (self contained) */
3709 atp = AsnReadId(aip, amp, BLAST_QUEUED);
3710 } else {
3711 atp = AsnLinkType(orig, BLAST_QUEUED);
3712 }
3713 /* link in local tree */
3714 if (atp == NULL) {
3715 return NULL;
3716 }
3717
3718 ptr = BlastQueuedNew();
3719 if (ptr == NULL) {
3720 goto erret;
3721 }
3722 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3723 goto erret;
3724 }
3725
3726 atp = AsnReadId(aip,amp, atp);
3727 func = NULL;
3728
3729 if (atp == BLAST_QUEUED_length) {
3730 if ( AsnReadVal(aip, atp, &av) <= 0) {
3731 goto erret;
3732 }
3733 ptr -> length = av.intvalue;
3734 atp = AsnReadId(aip,amp, atp);
3735 }
3736
3737 if (AsnReadVal(aip, atp, &av) <= 0) {
3738 goto erret;
3739 }
3740 /* end struct */
3741
3742 ret:
3743 AsnUnlinkType(orig); /* unlink local tree */
3744 return ptr;
3745
3746 erret:
3747 aip -> io_failure = TRUE;
3748 ptr = BlastQueuedFree(ptr);
3749 goto ret;
3750 }
3751
3752
3753
3754 /**************************************************
3755 *
3756 * BlastQueuedAsnWrite()
3757 *
3758 **************************************************/
3759 NLM_EXTERN Boolean LIBCALL
BlastQueuedAsnWrite(BlastQueuedPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3760 BlastQueuedAsnWrite(BlastQueuedPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3761 {
3762 DataVal av;
3763 AsnTypePtr atp;
3764 Boolean retval = FALSE;
3765
3766 if (! loaded)
3767 {
3768 if (! objblst3AsnLoad()) {
3769 return FALSE;
3770 }
3771 }
3772
3773 if (aip == NULL) {
3774 return FALSE;
3775 }
3776
3777 atp = AsnLinkType(orig, BLAST_QUEUED); /* link local tree */
3778 if (atp == NULL) {
3779 return FALSE;
3780 }
3781
3782 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3783 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3784 goto erret;
3785 }
3786
3787 av.intvalue = ptr -> length;
3788 retval = AsnWrite(aip, BLAST_QUEUED_length, &av);
3789 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3790 goto erret;
3791 }
3792 retval = TRUE;
3793
3794 erret:
3795 AsnUnlinkType(orig); /* unlink local tree */
3796 return retval;
3797 }
3798
3799
3800
3801 /**************************************************
3802 *
3803 * BlastProgressNew()
3804 *
3805 **************************************************/
3806 NLM_EXTERN
3807 BlastProgressPtr LIBCALL
BlastProgressNew(void)3808 BlastProgressNew(void)
3809 {
3810 BlastProgressPtr ptr = MemNew((size_t) sizeof(BlastProgress));
3811
3812 return ptr;
3813
3814 }
3815
3816
3817 /**************************************************
3818 *
3819 * BlastProgressFree()
3820 *
3821 **************************************************/
3822 NLM_EXTERN
3823 BlastProgressPtr LIBCALL
BlastProgressFree(BlastProgressPtr ptr)3824 BlastProgressFree(BlastProgressPtr ptr)
3825 {
3826
3827 if(ptr == NULL) {
3828 return NULL;
3829 }
3830 return MemFree(ptr);
3831 }
3832
3833
3834 /**************************************************
3835 *
3836 * BlastProgressAsnRead()
3837 *
3838 **************************************************/
3839 NLM_EXTERN
3840 BlastProgressPtr LIBCALL
BlastProgressAsnRead(AsnIoPtr aip,AsnTypePtr orig)3841 BlastProgressAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3842 {
3843 DataVal av;
3844 AsnTypePtr atp;
3845 Boolean isError = FALSE;
3846 AsnReadFunc func;
3847 BlastProgressPtr ptr;
3848
3849 if (! loaded)
3850 {
3851 if (! objblst3AsnLoad()) {
3852 return NULL;
3853 }
3854 }
3855
3856 if (aip == NULL) {
3857 return NULL;
3858 }
3859
3860 if (orig == NULL) { /* BlastProgress ::= (self contained) */
3861 atp = AsnReadId(aip, amp, BLAST_PROGRESS);
3862 } else {
3863 atp = AsnLinkType(orig, BLAST_PROGRESS);
3864 }
3865 /* link in local tree */
3866 if (atp == NULL) {
3867 return NULL;
3868 }
3869
3870 ptr = BlastProgressNew();
3871 if (ptr == NULL) {
3872 goto erret;
3873 }
3874 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3875 goto erret;
3876 }
3877
3878 atp = AsnReadId(aip,amp, atp);
3879 func = NULL;
3880
3881 if (atp == BLAST_PROGRESS_completed) {
3882 if ( AsnReadVal(aip, atp, &av) <= 0) {
3883 goto erret;
3884 }
3885 ptr -> completed = av.intvalue;
3886 atp = AsnReadId(aip,amp, atp);
3887 }
3888
3889 if (AsnReadVal(aip, atp, &av) <= 0) {
3890 goto erret;
3891 }
3892 /* end struct */
3893
3894 ret:
3895 AsnUnlinkType(orig); /* unlink local tree */
3896 return ptr;
3897
3898 erret:
3899 aip -> io_failure = TRUE;
3900 ptr = BlastProgressFree(ptr);
3901 goto ret;
3902 }
3903
3904
3905
3906 /**************************************************
3907 *
3908 * BlastProgressAsnWrite()
3909 *
3910 **************************************************/
3911 NLM_EXTERN Boolean LIBCALL
BlastProgressAsnWrite(BlastProgressPtr ptr,AsnIoPtr aip,AsnTypePtr orig)3912 BlastProgressAsnWrite(BlastProgressPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3913 {
3914 DataVal av;
3915 AsnTypePtr atp;
3916 Boolean retval = FALSE;
3917
3918 if (! loaded)
3919 {
3920 if (! objblst3AsnLoad()) {
3921 return FALSE;
3922 }
3923 }
3924
3925 if (aip == NULL) {
3926 return FALSE;
3927 }
3928
3929 atp = AsnLinkType(orig, BLAST_PROGRESS); /* link local tree */
3930 if (atp == NULL) {
3931 return FALSE;
3932 }
3933
3934 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3935 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3936 goto erret;
3937 }
3938
3939 av.intvalue = ptr -> completed;
3940 retval = AsnWrite(aip, BLAST_PROGRESS_completed, &av);
3941 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3942 goto erret;
3943 }
3944 retval = TRUE;
3945
3946 erret:
3947 AsnUnlinkType(orig); /* unlink local tree */
3948 return retval;
3949 }
3950
3951
3952
3953 /**************************************************
3954 *
3955 * BlastDeflineNew()
3956 *
3957 **************************************************/
3958 NLM_EXTERN
3959 BlastDeflinePtr LIBCALL
BlastDeflineNew(void)3960 BlastDeflineNew(void)
3961 {
3962 BlastDeflinePtr ptr = MemNew((size_t) sizeof(BlastDefline));
3963
3964 return ptr;
3965
3966 }
3967
3968
3969 /**************************************************
3970 *
3971 * BlastDeflineFree()
3972 *
3973 **************************************************/
3974 NLM_EXTERN
3975 BlastDeflinePtr LIBCALL
BlastDeflineFree(BlastDeflinePtr ptr)3976 BlastDeflineFree(BlastDeflinePtr ptr)
3977 {
3978
3979 if(ptr == NULL) {
3980 return NULL;
3981 }
3982 SeqIdFree(ptr -> id);
3983 MemFree(ptr -> defline);
3984 return MemFree(ptr);
3985 }
3986
3987
3988 /**************************************************
3989 *
3990 * BlastDeflineAsnRead()
3991 *
3992 **************************************************/
3993 NLM_EXTERN
3994 BlastDeflinePtr LIBCALL
BlastDeflineAsnRead(AsnIoPtr aip,AsnTypePtr orig)3995 BlastDeflineAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3996 {
3997 DataVal av;
3998 AsnTypePtr atp;
3999 Boolean isError = FALSE;
4000 AsnReadFunc func;
4001 BlastDeflinePtr ptr;
4002
4003 if (! loaded)
4004 {
4005 if (! objblst3AsnLoad()) {
4006 return NULL;
4007 }
4008 }
4009
4010 if (aip == NULL) {
4011 return NULL;
4012 }
4013
4014 if (orig == NULL) { /* BlastDefline ::= (self contained) */
4015 atp = AsnReadId(aip, amp, BLAST_DEFLINE);
4016 } else {
4017 atp = AsnLinkType(orig, BLAST_DEFLINE);
4018 }
4019 /* link in local tree */
4020 if (atp == NULL) {
4021 return NULL;
4022 }
4023
4024 ptr = BlastDeflineNew();
4025 if (ptr == NULL) {
4026 goto erret;
4027 }
4028 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4029 goto erret;
4030 }
4031
4032 atp = AsnReadId(aip,amp, atp);
4033 func = NULL;
4034
4035 if (atp == BLAST_DEFLINE_id) {
4036 ptr -> id = SeqIdAsnRead(aip, atp);
4037 if (aip -> io_failure) {
4038 goto erret;
4039 }
4040 atp = AsnReadId(aip,amp, atp);
4041 }
4042 if (atp == BLAST_DEFLINE_defline) {
4043 if ( AsnReadVal(aip, atp, &av) <= 0) {
4044 goto erret;
4045 }
4046 ptr -> defline = av.ptrvalue;
4047 atp = AsnReadId(aip,amp, atp);
4048 }
4049
4050 if (AsnReadVal(aip, atp, &av) <= 0) {
4051 goto erret;
4052 }
4053 /* end struct */
4054
4055 ret:
4056 AsnUnlinkType(orig); /* unlink local tree */
4057 return ptr;
4058
4059 erret:
4060 aip -> io_failure = TRUE;
4061 ptr = BlastDeflineFree(ptr);
4062 goto ret;
4063 }
4064
4065
4066
4067 /**************************************************
4068 *
4069 * BlastDeflineAsnWrite()
4070 *
4071 **************************************************/
4072 NLM_EXTERN Boolean LIBCALL
BlastDeflineAsnWrite(BlastDeflinePtr ptr,AsnIoPtr aip,AsnTypePtr orig)4073 BlastDeflineAsnWrite(BlastDeflinePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4074 {
4075 DataVal av;
4076 AsnTypePtr atp;
4077 Boolean retval = FALSE;
4078
4079 if (! loaded)
4080 {
4081 if (! objblst3AsnLoad()) {
4082 return FALSE;
4083 }
4084 }
4085
4086 if (aip == NULL) {
4087 return FALSE;
4088 }
4089
4090 atp = AsnLinkType(orig, BLAST_DEFLINE); /* link local tree */
4091 if (atp == NULL) {
4092 return FALSE;
4093 }
4094
4095 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4096 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4097 goto erret;
4098 }
4099
4100 if (ptr -> id != NULL) {
4101 if ( ! SeqIdAsnWrite(ptr -> id, aip, BLAST_DEFLINE_id)) {
4102 goto erret;
4103 }
4104 }
4105 if (ptr -> defline != NULL) {
4106 av.ptrvalue = ptr -> defline;
4107 retval = AsnWrite(aip, BLAST_DEFLINE_defline, &av);
4108 }
4109 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4110 goto erret;
4111 }
4112 retval = TRUE;
4113
4114 erret:
4115 AsnUnlinkType(orig); /* unlink local tree */
4116 return retval;
4117 }
4118
4119
4120
4121 /**************************************************
4122 *
4123 * BlastVersionNew()
4124 *
4125 **************************************************/
4126 NLM_EXTERN
4127 BlastVersionPtr LIBCALL
BlastVersionNew(void)4128 BlastVersionNew(void)
4129 {
4130 BlastVersionPtr ptr = MemNew((size_t) sizeof(BlastVersion));
4131
4132 return ptr;
4133
4134 }
4135
4136
4137 /**************************************************
4138 *
4139 * BlastVersionFree()
4140 *
4141 **************************************************/
4142 NLM_EXTERN
4143 BlastVersionPtr LIBCALL
BlastVersionFree(BlastVersionPtr ptr)4144 BlastVersionFree(BlastVersionPtr ptr)
4145 {
4146
4147 if(ptr == NULL) {
4148 return NULL;
4149 }
4150 MemFree(ptr -> version);
4151 MemFree(ptr -> date);
4152 return MemFree(ptr);
4153 }
4154
4155
4156 /**************************************************
4157 *
4158 * BlastVersionAsnRead()
4159 *
4160 **************************************************/
4161 NLM_EXTERN
4162 BlastVersionPtr LIBCALL
BlastVersionAsnRead(AsnIoPtr aip,AsnTypePtr orig)4163 BlastVersionAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4164 {
4165 DataVal av;
4166 AsnTypePtr atp;
4167 Boolean isError = FALSE;
4168 AsnReadFunc func;
4169 BlastVersionPtr ptr;
4170
4171 if (! loaded)
4172 {
4173 if (! objblst3AsnLoad()) {
4174 return NULL;
4175 }
4176 }
4177
4178 if (aip == NULL) {
4179 return NULL;
4180 }
4181
4182 if (orig == NULL) { /* BlastVersion ::= (self contained) */
4183 atp = AsnReadId(aip, amp, BLAST_VERSION);
4184 } else {
4185 atp = AsnLinkType(orig, BLAST_VERSION);
4186 }
4187 /* link in local tree */
4188 if (atp == NULL) {
4189 return NULL;
4190 }
4191
4192 ptr = BlastVersionNew();
4193 if (ptr == NULL) {
4194 goto erret;
4195 }
4196 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4197 goto erret;
4198 }
4199
4200 atp = AsnReadId(aip,amp, atp);
4201 func = NULL;
4202
4203 if (atp == BLAST_VERSION_version) {
4204 if ( AsnReadVal(aip, atp, &av) <= 0) {
4205 goto erret;
4206 }
4207 ptr -> version = av.ptrvalue;
4208 atp = AsnReadId(aip,amp, atp);
4209 }
4210 if (atp == BLAST_VERSION_date) {
4211 if ( AsnReadVal(aip, atp, &av) <= 0) {
4212 goto erret;
4213 }
4214 ptr -> date = av.ptrvalue;
4215 atp = AsnReadId(aip,amp, atp);
4216 }
4217
4218 if (AsnReadVal(aip, atp, &av) <= 0) {
4219 goto erret;
4220 }
4221 /* end struct */
4222
4223 ret:
4224 AsnUnlinkType(orig); /* unlink local tree */
4225 return ptr;
4226
4227 erret:
4228 aip -> io_failure = TRUE;
4229 ptr = BlastVersionFree(ptr);
4230 goto ret;
4231 }
4232
4233
4234
4235 /**************************************************
4236 *
4237 * BlastVersionAsnWrite()
4238 *
4239 **************************************************/
4240 NLM_EXTERN Boolean LIBCALL
BlastVersionAsnWrite(BlastVersionPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4241 BlastVersionAsnWrite(BlastVersionPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4242 {
4243 DataVal av;
4244 AsnTypePtr atp;
4245 Boolean retval = FALSE;
4246
4247 if (! loaded)
4248 {
4249 if (! objblst3AsnLoad()) {
4250 return FALSE;
4251 }
4252 }
4253
4254 if (aip == NULL) {
4255 return FALSE;
4256 }
4257
4258 atp = AsnLinkType(orig, BLAST_VERSION); /* link local tree */
4259 if (atp == NULL) {
4260 return FALSE;
4261 }
4262
4263 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4264 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4265 goto erret;
4266 }
4267
4268 if (ptr -> version != NULL) {
4269 av.ptrvalue = ptr -> version;
4270 retval = AsnWrite(aip, BLAST_VERSION_version, &av);
4271 }
4272 if (ptr -> date != NULL) {
4273 av.ptrvalue = ptr -> date;
4274 retval = AsnWrite(aip, BLAST_VERSION_date, &av);
4275 }
4276 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4277 goto erret;
4278 }
4279 retval = TRUE;
4280
4281 erret:
4282 AsnUnlinkType(orig); /* unlink local tree */
4283 return retval;
4284 }
4285
4286
4287
4288 /**************************************************
4289 *
4290 * MegaBlastHitNew()
4291 *
4292 **************************************************/
4293 NLM_EXTERN
4294 MegaBlastHitPtr LIBCALL
MegaBlastHitNew(void)4295 MegaBlastHitNew(void)
4296 {
4297 MegaBlastHitPtr ptr = MemNew((size_t) sizeof(MegaBlastHit));
4298
4299 return ptr;
4300
4301 }
4302
4303
4304 /**************************************************
4305 *
4306 * MegaBlastHitFree()
4307 *
4308 **************************************************/
4309 NLM_EXTERN
4310 MegaBlastHitPtr LIBCALL
MegaBlastHitFree(MegaBlastHitPtr ptr)4311 MegaBlastHitFree(MegaBlastHitPtr ptr)
4312 {
4313
4314 if(ptr == NULL) {
4315 return NULL;
4316 }
4317 MemFree(ptr -> id1);
4318 MemFree(ptr -> id2);
4319 return MemFree(ptr);
4320 }
4321
4322
4323 /**************************************************
4324 *
4325 * MegaBlastHitAsnRead()
4326 *
4327 **************************************************/
4328 NLM_EXTERN
4329 MegaBlastHitPtr LIBCALL
MegaBlastHitAsnRead(AsnIoPtr aip,AsnTypePtr orig)4330 MegaBlastHitAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4331 {
4332 DataVal av;
4333 AsnTypePtr atp;
4334 Boolean isError = FALSE;
4335 AsnReadFunc func;
4336 MegaBlastHitPtr ptr;
4337
4338 if (! loaded)
4339 {
4340 if (! objblst3AsnLoad()) {
4341 return NULL;
4342 }
4343 }
4344
4345 if (aip == NULL) {
4346 return NULL;
4347 }
4348
4349 if (orig == NULL) { /* MegaBlastHit ::= (self contained) */
4350 atp = AsnReadId(aip, amp, MEGABLAST_HIT);
4351 } else {
4352 atp = AsnLinkType(orig, MEGABLAST_HIT);
4353 }
4354 /* link in local tree */
4355 if (atp == NULL) {
4356 return NULL;
4357 }
4358
4359 ptr = MegaBlastHitNew();
4360 if (ptr == NULL) {
4361 goto erret;
4362 }
4363 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4364 goto erret;
4365 }
4366
4367 atp = AsnReadId(aip,amp, atp);
4368 func = NULL;
4369
4370 if (atp == MEGABLAST_HIT_id1) {
4371 if ( AsnReadVal(aip, atp, &av) <= 0) {
4372 goto erret;
4373 }
4374 ptr -> id1 = av.ptrvalue;
4375 atp = AsnReadId(aip,amp, atp);
4376 }
4377 if (atp == MEGABLAST_HIT_id2) {
4378 if ( AsnReadVal(aip, atp, &av) <= 0) {
4379 goto erret;
4380 }
4381 ptr -> id2 = av.ptrvalue;
4382 atp = AsnReadId(aip,amp, atp);
4383 }
4384 if (atp == MEGABLAST_HIT_query_offset) {
4385 if ( AsnReadVal(aip, atp, &av) <= 0) {
4386 goto erret;
4387 }
4388 ptr -> query_offset = av.intvalue;
4389 atp = AsnReadId(aip,amp, atp);
4390 }
4391 if (atp == MEGABLAST_HIT_subject_offset) {
4392 if ( AsnReadVal(aip, atp, &av) <= 0) {
4393 goto erret;
4394 }
4395 ptr -> subject_offset = av.intvalue;
4396 atp = AsnReadId(aip,amp, atp);
4397 }
4398 if (atp == MEGABLAST_HIT_query_end) {
4399 if ( AsnReadVal(aip, atp, &av) <= 0) {
4400 goto erret;
4401 }
4402 ptr -> query_end = av.intvalue;
4403 atp = AsnReadId(aip,amp, atp);
4404 }
4405 if (atp == MEGABLAST_HIT_subject_end) {
4406 if ( AsnReadVal(aip, atp, &av) <= 0) {
4407 goto erret;
4408 }
4409 ptr -> subject_end = av.intvalue;
4410 atp = AsnReadId(aip,amp, atp);
4411 }
4412 if (atp == MEGABLAST_HIT_score) {
4413 if ( AsnReadVal(aip, atp, &av) <= 0) {
4414 goto erret;
4415 }
4416 ptr -> score = av.intvalue;
4417 atp = AsnReadId(aip,amp, atp);
4418 }
4419
4420 if (AsnReadVal(aip, atp, &av) <= 0) {
4421 goto erret;
4422 }
4423 /* end struct */
4424
4425 ret:
4426 AsnUnlinkType(orig); /* unlink local tree */
4427 return ptr;
4428
4429 erret:
4430 aip -> io_failure = TRUE;
4431 ptr = MegaBlastHitFree(ptr);
4432 goto ret;
4433 }
4434
4435
4436
4437 /**************************************************
4438 *
4439 * MegaBlastHitAsnWrite()
4440 *
4441 **************************************************/
4442 NLM_EXTERN Boolean LIBCALL
MegaBlastHitAsnWrite(MegaBlastHitPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4443 MegaBlastHitAsnWrite(MegaBlastHitPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4444 {
4445 DataVal av;
4446 AsnTypePtr atp;
4447 Boolean retval = FALSE;
4448
4449 if (! loaded)
4450 {
4451 if (! objblst3AsnLoad()) {
4452 return FALSE;
4453 }
4454 }
4455
4456 if (aip == NULL) {
4457 return FALSE;
4458 }
4459
4460 atp = AsnLinkType(orig, MEGABLAST_HIT); /* link local tree */
4461 if (atp == NULL) {
4462 return FALSE;
4463 }
4464
4465 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4466 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4467 goto erret;
4468 }
4469
4470 if (ptr -> id1 != NULL) {
4471 av.ptrvalue = ptr -> id1;
4472 retval = AsnWrite(aip, MEGABLAST_HIT_id1, &av);
4473 }
4474 if (ptr -> id2 != NULL) {
4475 av.ptrvalue = ptr -> id2;
4476 retval = AsnWrite(aip, MEGABLAST_HIT_id2, &av);
4477 }
4478 av.intvalue = ptr -> query_offset;
4479 retval = AsnWrite(aip, MEGABLAST_HIT_query_offset, &av);
4480 av.intvalue = ptr -> subject_offset;
4481 retval = AsnWrite(aip, MEGABLAST_HIT_subject_offset, &av);
4482 av.intvalue = ptr -> query_end;
4483 retval = AsnWrite(aip, MEGABLAST_HIT_query_end, &av);
4484 av.intvalue = ptr -> subject_end;
4485 retval = AsnWrite(aip, MEGABLAST_HIT_subject_end, &av);
4486 av.intvalue = ptr -> score;
4487 retval = AsnWrite(aip, MEGABLAST_HIT_score, &av);
4488 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4489 goto erret;
4490 }
4491 retval = TRUE;
4492
4493 erret:
4494 AsnUnlinkType(orig); /* unlink local tree */
4495 return retval;
4496 }
4497
4498
4499
4500 /**************************************************
4501 *
4502 * MegaBlastResultsNew()
4503 *
4504 **************************************************/
4505 NLM_EXTERN
4506 MegaBlastResultsPtr LIBCALL
MegaBlastResultsNew(void)4507 MegaBlastResultsNew(void)
4508 {
4509 MegaBlastResultsPtr ptr = MemNew((size_t) sizeof(MegaBlastResults));
4510
4511 return ptr;
4512
4513 }
4514
4515
4516 /**************************************************
4517 *
4518 * MegaBlastResultsFree()
4519 *
4520 **************************************************/
4521 NLM_EXTERN
4522 MegaBlastResultsPtr LIBCALL
MegaBlastResultsFree(MegaBlastResultsPtr ptr)4523 MegaBlastResultsFree(MegaBlastResultsPtr ptr)
4524 {
4525
4526 if(ptr == NULL) {
4527 return NULL;
4528 }
4529 AsnGenericUserSeqOfFree(ptr -> mbhits, (AsnOptFreeFunc) MegaBlastHitFree);
4530 return MemFree(ptr);
4531 }
4532
4533
4534 /**************************************************
4535 *
4536 * MegaBlastResultsAsnRead()
4537 *
4538 **************************************************/
4539 NLM_EXTERN
4540 MegaBlastResultsPtr LIBCALL
MegaBlastResultsAsnRead(AsnIoPtr aip,AsnTypePtr orig)4541 MegaBlastResultsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
4542 {
4543 DataVal av;
4544 AsnTypePtr atp;
4545 Boolean isError = FALSE;
4546 AsnReadFunc func;
4547 MegaBlastResultsPtr ptr;
4548
4549 if (! loaded)
4550 {
4551 if (! objblst3AsnLoad()) {
4552 return NULL;
4553 }
4554 }
4555
4556 if (aip == NULL) {
4557 return NULL;
4558 }
4559
4560 if (orig == NULL) { /* MegaBlastResults ::= (self contained) */
4561 atp = AsnReadId(aip, amp, MEGABLAST_RESULTS);
4562 } else {
4563 atp = AsnLinkType(orig, MEGABLAST_RESULTS);
4564 }
4565 /* link in local tree */
4566 if (atp == NULL) {
4567 return NULL;
4568 }
4569
4570 ptr = MegaBlastResultsNew();
4571 if (ptr == NULL) {
4572 goto erret;
4573 }
4574 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
4575 goto erret;
4576 }
4577
4578 atp = AsnReadId(aip,amp, atp);
4579 func = NULL;
4580
4581 if (atp == MEGABLAST_RESULTS_mbhits) {
4582 ptr -> mbhits = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) MegaBlastHitAsnRead, (AsnOptFreeFunc) MegaBlastHitFree);
4583 if (isError && ptr -> mbhits == NULL) {
4584 goto erret;
4585 }
4586 atp = AsnReadId(aip,amp, atp);
4587 }
4588
4589 if (AsnReadVal(aip, atp, &av) <= 0) {
4590 goto erret;
4591 }
4592 /* end struct */
4593
4594 ret:
4595 AsnUnlinkType(orig); /* unlink local tree */
4596 return ptr;
4597
4598 erret:
4599 aip -> io_failure = TRUE;
4600 ptr = MegaBlastResultsFree(ptr);
4601 goto ret;
4602 }
4603
4604
4605
4606 /**************************************************
4607 *
4608 * MegaBlastResultsAsnWrite()
4609 *
4610 **************************************************/
4611 NLM_EXTERN Boolean LIBCALL
MegaBlastResultsAsnWrite(MegaBlastResultsPtr ptr,AsnIoPtr aip,AsnTypePtr orig)4612 MegaBlastResultsAsnWrite(MegaBlastResultsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
4613 {
4614 AsnTypePtr atp;
4615 Boolean retval = FALSE;
4616
4617 if (! loaded)
4618 {
4619 if (! objblst3AsnLoad()) {
4620 return FALSE;
4621 }
4622 }
4623
4624 if (aip == NULL) {
4625 return FALSE;
4626 }
4627
4628 atp = AsnLinkType(orig, MEGABLAST_RESULTS); /* link local tree */
4629 if (atp == NULL) {
4630 return FALSE;
4631 }
4632
4633 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
4634 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
4635 goto erret;
4636 }
4637
4638 AsnGenericUserSeqOfAsnWrite(ptr -> mbhits, (AsnWriteFunc) MegaBlastHitAsnWrite, aip, MEGABLAST_RESULTS_mbhits, MEGABLAST_RESULTS_mbhits_E);
4639 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
4640 goto erret;
4641 }
4642 retval = TRUE;
4643
4644 erret:
4645 AsnUnlinkType(orig); /* unlink local tree */
4646 return retval;
4647 }
4648
4649