|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/demo/asn2all.c |
source navigation diff markup identifier search freetext search file search |
1 /* asn2all.c
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information (NCBI)
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government do not place any restriction on its use or reproduction.
13 * We would, however, appreciate having the NCBI and the author cited in
14 * any work or product based on this material
15 *
16 * Although all reasonable efforts have been taken to ensure the accuracy
17 * and reliability of the software and data, the NLM and the U.S.
18 * Government do not and cannot warrant the performance or results that
19 * may be obtained by using this software or data. The NLM and the U.S.
20 * Government disclaim all warranties, express or implied, including
21 * warranties of performance, merchantability or fitness for any particular
22 * purpose.
23 *
24 * ===========================================================================
25 *
26 * File Name: asn2all.c
27 *
28 * Author: Jonathan Kans
29 *
30 * Version Creation Date: 7/26/04
31 *
32 * $Revision: 1.68 $
33 *
34 * File Description:
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * ==========================================================================
39 */
40
41 #include <ncbi.h>
42 #include <objall.h>
43 #include <objsset.h>
44 #include <objsub.h>
45 #include <objfdef.h>
46 #include <objgbseq.h>
47 #include <objtseq.h>
48 #include <sequtil.h>
49 #include <sqnutils.h>
50 #include <explore.h>
51 #include <asn2gnbi.h>
52 #include <tofasta.h>
53 #include <pmfapi.h>
54 #include <lsqfetch.h>
55
56 #define ASN2ALL_APP_VER "5.5"
57
58 CharPtr ASN2ALL_APPLICATION = ASN2ALL_APP_VER;
59
60 static ValNodePtr DoLockFarComponents (
61 SeqEntryPtr sep,
62 Boolean useThreads
63 )
64
65 {
66 ValNodePtr rsult;
67 time_t start_time, stop_time;
68
69 start_time = GetSecs ();
70
71 if (NlmThreadsAvailable () && useThreads) {
72 rsult = AdvcLockFarComponents (sep, TRUE, FALSE, FALSE, NULL, TRUE);
73 } else if (useThreads) {
74 Message (MSG_POST, "Threads not available in this executable");
75 rsult = AdvcLockFarComponents (sep, TRUE, FALSE, FALSE, NULL, FALSE);
76 } else {
77 rsult = AdvcLockFarComponents (sep, TRUE, FALSE, FALSE, NULL, FALSE);
78 }
79
80 stop_time = GetSecs ();
81
82 return rsult;
83 }
84
85 typedef enum {
86 FLATFILE_FORMAT = 1,
87 FASTA_FORMAT,
88 CDS_FORMAT,
89 TABLE_FORMAT,
90 TINY_FORMAT,
91 INSDSEQ_FORMAT,
92 ASN_FORMAT,
93 XML_FORMAT,
94 CACHE_COMPONENTS
95 } AppFormat;
96
97 typedef struct appflags {
98 AppFormat format;
99 Boolean automatic;
100 Boolean catenated;
101 Boolean batch;
102 Boolean binary;
103 Boolean compressed;
104 Boolean lock;
105 Boolean useThreads;
106 Int2 type;
107 Int2 linelen;
108 Int2 nearpolicy;
109 ModType mode;
110 Boolean extended;
111 Boolean failed;
112 FILE *nt;
113 FILE *aa;
114 AsnIoPtr an;
115 AsnIoPtr ap;
116 AsnModulePtr amp;
117 AsnTypePtr atp_bss;
118 AsnTypePtr atp_bsss;
119 AsnTypePtr atp_se;
120 AsnTypePtr atp_bsc;
121 AsnTypePtr bssp_atp;
122 AsnTypePtr atp_inst;
123 AsnTypePtr atp_insd;
124 AsnTypePtr atp_insde;
125 AsnTypePtr atp_tss;
126 AsnTypePtr atp_tsse;
127 BioseqSet bss;
128 GBSeq gbsq;
129 GBSet gbst;
130 XtraBlock xtran;
131 XtraBlock xtrap;
132 TSeqSet tss;
133 } AppFlagData, PNTR AppFlagPtr;
134
135 NLM_EXTERN void AsnPrintNewLine PROTO((AsnIoPtr aip));
136
137 static void DoProtFtables (
138 BioseqPtr bsp,
139 Pointer userdata
140 )
141
142 {
143 AppFlagPtr afp;
144
145 if (bsp == NULL) return;
146 if (! ISA_aa (bsp->mol)) return;
147 afp = (AppFlagPtr) userdata;
148 BioseqToGnbk (bsp, NULL, FTABLE_FMT, afp->mode, NORMAL_STYLE, 0, 0, SHOW_PROT_FTABLE, NULL, afp->aa);
149 }
150
151 static void SaveTinyNucStreams (
152 BioseqPtr bsp,
153 Pointer userdata
154 )
155
156 {
157 AppFlagPtr afp;
158
159 if (bsp == NULL) return;
160 if (! ISA_na (bsp->mol)) return;
161 afp = (AppFlagPtr) userdata;
162
163 BioseqAsnWriteAsTSeq (bsp, afp->an, afp->atp_tsse);
164 /*
165 AsnPrintNewLine (afp->an);
166 AsnIoFlush (afp->an);
167 */
168 }
169
170 static void SaveTinyPrtStreams (
171 BioseqPtr bsp,
172 Pointer userdata
173 )
174
175 {
176 AppFlagPtr afp;
177
178 if (bsp == NULL) return;
179 if (! ISA_aa (bsp->mol)) return;
180 afp = (AppFlagPtr) userdata;
181
182 BioseqAsnWriteAsTSeq (bsp, afp->ap, afp->atp_tsse);
183 /*
184 AsnPrintNewLine (afp->ap);
185 AsnIoFlush (afp->ap);
186 */
187 }
188
189 static Boolean A2ADeltaLitOnly (
190 BioseqPtr bsp
191 )
192
193 {
194 ValNodePtr vnp;
195
196 if (bsp == NULL || bsp->repr != Seq_repr_delta) return FALSE;
197 for (vnp = (ValNodePtr)(bsp->seq_ext); vnp != NULL; vnp = vnp->next) {
198 if (vnp->choice == 1) return FALSE;
199 }
200 return TRUE;
201 }
202
203 static Boolean A2ASegHasParts (
204 BioseqPtr bsp
205 )
206
207 {
208 BioseqSetPtr bssp;
209 SeqEntryPtr sep;
210
211 if (bsp == NULL || bsp->repr != Seq_repr_seg) return FALSE;
212 sep = bsp->seqentry;
213 if (sep == NULL) return FALSE;
214 sep = sep->next;
215 if (sep == NULL || (! IS_Bioseq_set (sep))) return FALSE;
216 bssp = (BioseqSetPtr) sep->data.ptrvalue;
217 if (bssp != NULL && bssp->_class == BioseqseqSet_class_parts) return TRUE;
218 return FALSE;
219 }
220
221 static void IsItFar (
222 BioseqPtr bsp,
223 Pointer userdata
224 )
225
226 {
227 BoolPtr bp;
228
229 if (bsp == NULL || userdata == NULL) return;
230 bp = (BoolPtr) userdata;
231
232 if (bsp->repr == Seq_repr_seg && (! A2ASegHasParts (bsp))) {
233 *bp = TRUE;
234 } else if (bsp->repr == Seq_repr_delta && (! A2ADeltaLitOnly (bsp))) {
235 *bp = TRUE;
236 }
237 }
238
239 static void DoCDSFasta (
240 SeqFeatPtr sfp,
241 Pointer userdata
242 )
243
244 {
245 AppFlagPtr afp;
246
247 if (sfp == NULL || sfp->data.choice != SEQFEAT_CDREGION) return;
248 afp = (AppFlagPtr) userdata;
249 if (afp == NULL) return;
250
251 CdRegionFastaStream (sfp, afp->nt,
252 STREAM_EXPAND_GAPS | STREAM_CORRECT_INVAL,
253 afp->linelen, 0, 0, TRUE);
254 }
255
256 static void DoTransFasta (
257 SeqFeatPtr sfp,
258 Pointer userdata
259 )
260
261 {
262 AppFlagPtr afp;
263
264 if (sfp == NULL || sfp->data.choice != SEQFEAT_CDREGION) return;
265 afp = (AppFlagPtr) userdata;
266 if (afp == NULL) return;
267
268 TranslationFastaStream (sfp, afp->aa,
269 STREAM_EXPAND_GAPS | STREAM_CORRECT_INVAL,
270 afp->linelen, 0, 0, TRUE);
271 }
272
273 static void FormatRecord (
274 SeqEntryPtr sep,
275 AppFlagPtr afp,
276 ValNodePtr bsplist
277 )
278
279 {
280 BioseqPtr bsp;
281 CstType custom = 0;
282 Uint2 entityID;
283 FlgType flags = 0;
284 Boolean is_far = FALSE;
285 LckType locks = 0;
286 SeqEntryPtr top;
287 ValNodePtr vnp;
288
289 if (sep == NULL || afp == NULL) return;
290
291 VisitBioseqsInSep (sep, (Pointer) &is_far, IsItFar);
292
293 if (afp->nearpolicy == 2 && is_far) {
294 flags = SHOW_CONTIG_FEATURES | ONLY_NEAR_FEATURES;
295 } else {
296 flags = SHOW_CONTIG_FEATURES;
297 }
298 if (is_far && (! afp->lock)) {
299 locks = LOOKUP_FAR_COMPONENTS;
300 }
301 if (afp->extended) {
302 flags |= REFSEQ_CONVENTIONS | SHOW_TRANCRIPTION | SHOW_PEPTIDE;
303 }
304
305 switch (afp->format) {
306 case FLATFILE_FORMAT :
307 if (afp->nt != NULL) {
308 SeqEntryToGnbk (sep, NULL, GENBANK_FMT, afp->mode, NORMAL_STYLE,
309 flags, locks, custom, NULL, afp->nt);
310 }
311 if (afp->aa != NULL) {
312 SeqEntryToGnbk (sep, NULL, GENPEPT_FMT, afp->mode, NORMAL_STYLE,
313 flags, 0, custom, NULL, afp->aa);
314 }
315 break;
316 case FASTA_FORMAT :
317 if (afp->nt != NULL) {
318 if (afp->nearpolicy == 1 ||
319 (afp->nearpolicy == 2 && (! is_far)) ||
320 (afp->nearpolicy == 3 && is_far)) {
321 SeqEntryFastaStream (sep, afp->nt, STREAM_EXPAND_GAPS, afp->linelen,
322 0, 0, TRUE, FALSE, FALSE);
323 }
324 }
325 if (afp->aa != NULL) {
326 SeqEntryFastaStream (sep, afp->aa, STREAM_EXPAND_GAPS, afp->linelen,
327 0, 0, FALSE, TRUE, FALSE);
328 }
329 break;
330 case CDS_FORMAT :
331 if (afp->nt != NULL) {
332 entityID = ObjMgrGetEntityIDForChoice (sep);
333 top = GetTopSeqEntryForEntityID (entityID);
334 if (top != NULL) {
335 SeqMgrIndexFeatures (0, top->data.ptrvalue);
336 VisitFeaturesInSep (top, (Pointer) afp, DoCDSFasta);
337 }
338 }
339 if (afp->aa != NULL) {
340 entityID = ObjMgrGetEntityIDForChoice (sep);
341 top = GetTopSeqEntryForEntityID (entityID);
342 if (top != NULL) {
343 SeqMgrIndexFeatures (0, top->data.ptrvalue);
344 VisitFeaturesInSep (top, (Pointer) afp, DoTransFasta);
345 }
346 }
347 break;
348 case TABLE_FORMAT :
349 if (afp->nt != NULL) {
350 SeqEntryToGnbk (sep, NULL, FTABLE_FMT, afp->mode, NORMAL_STYLE,
351 flags, locks, 0, NULL, afp->nt);
352 }
353 if (afp->aa != NULL) {
354 VisitBioseqsInSep (sep, (Pointer) afp, DoProtFtables);
355 }
356 break;
357 case TINY_FORMAT :
358 if (afp->an != NULL) {
359 VisitBioseqsInSep (sep, (Pointer) afp, SaveTinyNucStreams);
360 }
361 if (afp->ap != NULL) {
362 VisitBioseqsInSep (sep, (Pointer) afp, SaveTinyPrtStreams);
363 }
364 break;
365 case INSDSEQ_FORMAT :
366 if (afp->an != NULL) {
367 SeqEntryToGnbk (sep, NULL, GENBANK_FMT, afp->mode, NORMAL_STYLE,
368 flags, locks, custom, &(afp->xtran), NULL);
369 }
370 if (afp->ap != NULL) {
371 SeqEntryToGnbk (sep, NULL, GENPEPT_FMT, afp->mode, NORMAL_STYLE,
372 flags, 0, custom, &(afp->xtrap), NULL);
373 }
374 break;
375 case ASN_FORMAT :
376 case XML_FORMAT :
377 SeqEntryAsnWrite (sep, afp->an, NULL);
378 break;
379 case CACHE_COMPONENTS :
380 if (afp->an != NULL) {
381 for (vnp = bsplist; vnp != NULL; vnp = vnp->next) {
382 bsp = (BioseqPtr) vnp->data.ptrvalue;
383 if (bsp == NULL) continue;
384 entityID = ObjMgrGetEntityIDForPointer (bsp);
385 if (entityID < 1) continue;
386 top = GetTopSeqEntryForEntityID (entityID);
387 if (top == NULL) continue;
388 SeqEntryAsnWrite (top, afp->an, afp->atp_se);
389 }
390 }
391 break;
392 default :
393 break;
394 }
395 }
396
397 static void ProcessSingleRecord (
398 CharPtr filename,
399 AppFlagPtr afp
400 )
401
402 {
403 AsnIoPtr aip;
404 BioseqPtr bsp;
405 ValNodePtr bsplist;
406 BioseqSetPtr bssp;
407 Pointer dataptr = NULL;
408 Uint2 datatype = 0, entityID = 0;
409 FILE *fp;
410 ObjMgrPtr omp;
411 SeqEntryPtr sep;
412
413 if (afp == NULL) return;
414
415 if (StringHasNoText (filename)) return;
416
417 if (afp->type == 1) {
418 fp = FileOpen (filename, "r");
419 if (fp == NULL) {
420 Message (MSG_POSTERR, "Failed to open '%s'", filename);
421 return;
422 }
423
424 dataptr = ReadAsnFastaOrFlatFile (fp, &datatype, NULL, FALSE, FALSE, TRUE, FALSE);
425
426 FileClose (fp);
427
428 entityID = ObjMgrRegister (datatype, dataptr);
429
430 } else if (afp->type >= 2 && afp->type <= 5) {
431 aip = AsnIoOpen (filename, afp->binary? "rb" : "r");
432 if (aip == NULL) {
433 Message (MSG_POSTERR, "AsnIoOpen failed for input file '%s'", filename);
434 return;
435 }
436
437 SeqMgrHoldIndexing (TRUE);
438 switch (afp->type) {
439 case 2 :
440 dataptr = (Pointer) SeqEntryAsnRead (aip, NULL);
441 datatype = OBJ_SEQENTRY;
442 break;
443 case 3 :
444 dataptr = (Pointer) BioseqAsnRead (aip, NULL);
445 datatype = OBJ_BIOSEQ;
446 break;
447 case 4 :
448 dataptr = (Pointer) BioseqSetAsnRead (aip, NULL);
449 datatype = OBJ_BIOSEQSET;
450 break;
451 case 5 :
452 dataptr = (Pointer) SeqSubmitAsnRead (aip, NULL);
453 datatype = OBJ_SEQSUB;
454 break;
455 default :
456 break;
457 }
458 SeqMgrHoldIndexing (FALSE);
459
460 AsnIoClose (aip);
461
462 entityID = ObjMgrRegister (datatype, dataptr);
463
464 } else {
465 Message (MSG_POSTERR, "Input format type '%d' unrecognized", (int) afp->type);
466 return;
467 }
468
469 if (entityID < 1 || dataptr == NULL) {
470 Message (MSG_POSTERR, "Data read failed for input file '%s'", filename);
471 return;
472 }
473
474 if (datatype == OBJ_SEQSUB || datatype == OBJ_SEQENTRY ||
475 datatype == OBJ_BIOSEQ || datatype == OBJ_BIOSEQSET) {
476
477 sep = GetTopSeqEntryForEntityID (entityID);
478
479 if (sep == NULL) {
480 sep = SeqEntryNew ();
481 if (sep != NULL) {
482 if (datatype == OBJ_BIOSEQ) {
483 bsp = (BioseqPtr) dataptr;
484 sep->choice = 1;
485 sep->data.ptrvalue = bsp;
486 SeqMgrSeqEntry (SM_BIOSEQ, (Pointer) bsp, sep);
487 } else if (datatype == OBJ_BIOSEQSET) {
488 bssp = (BioseqSetPtr) dataptr;
489 sep->choice = 2;
490 sep->data.ptrvalue = bssp;
491 SeqMgrSeqEntry (SM_BIOSEQSET, (Pointer) bssp, sep);
492 } else {
493 sep = SeqEntryFree (sep);
494 }
495 }
496 sep = GetTopSeqEntryForEntityID (entityID);
497 }
498
499 if (sep != NULL) {
500 bsplist = NULL;
501 if (afp->lock) {
502 bsplist = DoLockFarComponents (sep, afp->useThreads);
503 }
504
505 FormatRecord (sep, afp, bsplist);
506
507 bsplist = UnlockFarComponents (bsplist);
508 }
509
510 } else {
511
512 Message (MSG_POSTERR, "Datatype %d not recognized", (int) datatype);
513 }
514
515 ObjMgrFree (datatype, dataptr);
516
517 omp = ObjMgrGet ();
518 ObjMgrReapOne (omp);
519 SeqMgrClearBioseqIndex ();
520 ObjMgrFreeCache (0);
521 FreeSeqIdGiCache ();
522
523 SeqEntrySetScope (NULL);
524 }
525
526 static void ProcessMultipleRecord (
527 CharPtr filename,
528 AppFlagPtr afp
529 )
530
531 {
532 AsnIoPtr aip, aop = NULL;
533 AsnTypePtr atp;
534 BioseqPtr bsp;
535 ValNodePtr bsplist;
536 DataVal dv;
537 FILE *fp;
538 Boolean io_failure = FALSE;
539 ObjMgrPtr omp;
540 SeqEntryPtr sep;
541 #ifdef OS_UNIX
542 Char cmmd [256];
543 CharPtr gzcatprog;
544 int ret;
545 Boolean usedPopen = FALSE;
546 #endif
547
548 if (afp == NULL) return;
549
550 if (StringHasNoText (filename)) return;
551
552 #ifndef OS_UNIX
553 if (afp->compressed) {
554 Message (MSG_POSTERR, "Can only decompress on-the-fly on UNIX machines");
555 return;
556 }
557 #endif
558
559 #ifdef OS_UNIX
560 if (afp->compressed) {
561 gzcatprog = getenv ("NCBI_UNCOMPRESS_BINARY");
562 if (gzcatprog != NULL) {
563 sprintf (cmmd, "%s %s", gzcatprog, filename);
564 } else {
565 ret = system ("gzcat -h >/dev/null 2>&1");
566 if (ret == 0) {
567 sprintf (cmmd, "gzcat %s", filename);
568 } else if (ret == -1) {
569 Message (MSG_POSTERR, "Unable to fork or exec gzcat in ScanBioseqSetRelease");
570 return;
571 } else {
572 ret = system ("zcat -h >/dev/null 2>&1");
573 if (ret == 0) {
574 sprintf (cmmd, "zcat %s", filename);
575 } else if (ret == -1) {
576 Message (MSG_POSTERR, "Unable to fork or exec zcat in ScanBioseqSetRelease");
577 return;
578 } else {
579 Message (MSG_POSTERR, "Unable to find zcat or gzcat in ScanBioseqSetRelease - please edit your PATH environment variable");
580 return;
581 }
582 }
583 }
584 fp = popen (cmmd, /* afp->binary? "rb" : */ "r");
585 usedPopen = TRUE;
586 } else {
587 fp = FileOpen (filename, afp->binary? "rb" : "r");
588 }
589 #else
590 fp = FileOpen (filename, afp->binary? "rb" : "r");
591 #endif
592 if (fp == NULL) {
593 Message (MSG_POSTERR, "FileOpen failed for input file '%s'", filename);
594 return;
595 }
596
597 aip = AsnIoNew (afp->binary? ASNIO_BIN_IN : ASNIO_TEXT_IN, fp, NULL, NULL, NULL);
598 if (aip == NULL) {
599 Message (MSG_POSTERR, "AsnIoNew failed for input file '%s'", filename);
600 return;
601 }
602
603 switch (afp->format) {
604 case ASN_FORMAT :
605 aop = afp->an;
606 break;
607 case XML_FORMAT :
608 aop = afp->an;
609 break;
610 default :
611 break;
612 }
613
614 atp = afp->atp_bss;
615
616 if (aop != NULL) {
617
618 if (afp->format == XML_FORMAT) {
619 while ((! io_failure) && (atp = AsnReadId (aip, afp->amp, atp)) != NULL) {
620 if (aip->io_failure) {
621 io_failure = TRUE;
622 aip->io_failure = FALSE;
623 }
624 if (atp == afp->atp_inst) {
625 /* converts compressed sequences to iupac like asn2xml */
626 bsp = BioseqNew ();
627 BioseqInstAsnRead (bsp, aip, atp);
628 BioseqInstAsnWrite (bsp, aop, atp);
629 bsp = BioseqFree (bsp);
630 } else {
631 AsnReadVal (aip, atp, &dv);
632 AsnWrite (aop, atp, &dv);
633 AsnKillValue (atp, &dv);
634 }
635 if (aip->io_failure) {
636 io_failure = TRUE;
637 aip->io_failure = FALSE;
638 }
639 }
640 } else {
641 while ((! io_failure) && (atp = AsnReadId (aip, afp->amp, atp)) != NULL) {
642 if (aip->io_failure) {
643 io_failure = TRUE;
644 aip->io_failure = FALSE;
645 }
646 AsnReadVal (aip, atp, &dv);
647 AsnWrite (aop, atp, &dv);
648 AsnKillValue (atp, &dv);
649 if (aip->io_failure) {
650 io_failure = TRUE;
651 aip->io_failure = FALSE;
652 }
653 }
654 }
655
656 } else {
657
658 while ((! io_failure) && (atp = AsnReadId (aip, afp->amp, atp)) != NULL) {
659 if (aip->io_failure) {
660 io_failure = TRUE;
661 aip->io_failure = FALSE;
662 }
663 if (atp == afp->atp_se) {
664
665 SeqMgrHoldIndexing (TRUE);
666 sep = SeqEntryAsnRead (aip, atp);
667 SeqMgrHoldIndexing (FALSE);
668
669 if (sep != NULL) {
670 bsplist = NULL;
671 if (afp->lock) {
672 bsplist = DoLockFarComponents (sep, afp->useThreads);
673 }
674
675 FormatRecord (sep, afp, bsplist);
676
677 bsplist = UnlockFarComponents (bsplist);
678 }
679
680 SeqEntryFree (sep);
681 omp = ObjMgrGet ();
682 ObjMgrReapOne (omp);
683 SeqMgrClearBioseqIndex ();
684 ObjMgrFreeCache (0);
685 FreeSeqIdGiCache ();
686
687 SeqEntrySetScope (NULL);
688
689 } else {
690
691 AsnReadVal (aip, atp, NULL);
692 }
693
694 if (aip->io_failure) {
695 io_failure = TRUE;
696 aip->io_failure = FALSE;
697 }
698 }
699 }
700
701 if (aip->io_failure) {
702 io_failure = TRUE;
703 }
704
705 if (io_failure) {
706 Message (MSG_POSTERR, "Asn io_failure for input file '%s'", filename);
707 }
708
709 AsnIoFree (aip, FALSE);
710
711 #ifdef OS_UNIX
712 if (usedPopen) {
713 pclose (fp);
714 } else {
715 FileClose (fp);
716 }
717 #else
718 FileClose (fp);
719 #endif
720 }
721
722 static void FormatWrapper (
723 SeqEntryPtr sep,
724 Pointer userdata
725 )
726
727 {
728 AppFlagPtr afp;
729 ValNodePtr bsplist;
730
731 if (sep == NULL) return;
732 afp = (AppFlagPtr) userdata;
733 if (afp == NULL) return;
734
735 bsplist = NULL;
736 if (afp->lock) {
737 bsplist = DoLockFarComponents (sep, afp->useThreads);
738 }
739
740 FormatRecord (sep, afp, bsplist);
741
742 bsplist = UnlockFarComponents (bsplist);
743 }
744
745 static void ProcessOneRecord (
746 CharPtr filename,
747 Pointer userdata
748 )
749
750 {
751 AppFlagPtr afp;
752 Pointer dataptr;
753 Uint2 datatype;
754 Uint2 entityID;
755 FILE *fp;
756 SeqEntryPtr sep;
757
758 if (StringHasNoText (filename)) return;
759 afp = (AppFlagPtr) userdata;
760 if (afp == NULL) return;
761
762 if (afp->automatic) {
763 ReadSequenceAsnFile (filename, afp->binary, afp->compressed, (Pointer) afp, FormatWrapper);
764 } else if (afp->catenated) {
765 fp = FileOpen (filename, "r");
766 if (fp != NULL) {
767 while ((dataptr = ReadAsnFastaOrFlatFile (fp, &datatype, &entityID, FALSE, FALSE, TRUE, FALSE)) != NULL) {
768 sep = GetTopSeqEntryForEntityID (entityID);
769 FormatWrapper (sep, afp);
770 }
771 FileClose (fp);
772 }
773 } else if (afp->batch) {
774 ProcessMultipleRecord (filename, afp);
775 } else {
776 ProcessSingleRecord (filename, afp);
777 }
778 }
779
780 static SeqEntryPtr SeqEntryFromAccnOrGi (
781 CharPtr accn
782 )
783
784 {
785 Boolean alldigits;
786 BioseqPtr bsp;
787 Char ch;
788 CharPtr ptr;
789 SeqEntryPtr sep = NULL;
790 SeqIdPtr sip;
791 Int4 uid = 0;
792 long int val;
793 ValNode vn;
794
795 if (StringHasNoText (accn)) return NULL;
796
797 TrimSpacesAroundString (accn);
798
799 alldigits = TRUE;
800 ptr = accn;
801 ch = *ptr;
802 while (ch != '\0') {
803 if (! IS_DIGIT (ch)) {
804 alldigits = FALSE;
805 }
806 ptr++;
807 ch = *ptr;
808 }
809
810 if (alldigits) {
811 if (sscanf (accn, "%ld", &val) == 1) {
812 uid = (Int4) val;
813 }
814 } else {
815 sip = SeqIdFromAccessionDotVersion (accn);
816 if (sip != NULL) {
817 uid = GetGIForSeqId (sip);
818 SeqIdFree (sip);
819 }
820 }
821
822 if (uid > 0) {
823 sep = PubSeqSynchronousQuery (uid, 0, -1);
824 if (sep != NULL) {
825 MemSet ((Pointer) &vn, 0, sizeof (ValNode));
826 vn.choice = SEQID_GI;
827 vn.data.intvalue = uid;
828 bsp = BioseqFind (&vn);
829 if (bsp != NULL) {
830 sep = SeqMgrGetSeqEntryForData ((Pointer) bsp);
831 }
832 }
833 }
834
835 return sep;
836 }
837
838 static CharPtr helpLines [] = {
839 "asn2all is primarily intended for generating reports from the binary",
840 "ASN.1 Bioseq-set release files downloaded from the NCBI ftp site",
841 "(ncbi-asn1 directory). It can produce GenBank and GenPept flatfiles,",
842 "FASTA sequence files, INSDSet structured XML, TinySeq XML, and 5-column",
843 "feature table format.",
844 "",
845 "The release files (which have .aso.gz suffix), should be uncompressed",
846 "with gunzip, resulting in files with suffix .aso. For example,",
847 "gbpri1.aso is the first file in the primate division, so the command",
848 "",
849 " gunzip gbpri1.aso.gz",
850 "",
851 "will result in gbpri1.aso being created. The original gbpri1.aso.gz",
852 "file is removed after successful decompression.",
853 "",
854 "In asn2all, the name of the file to be processed is specified by the -i",
855 "command line argument. Use -a t to indicate that it is a release file",
856 "and -b to indicate that it is binary ASN.1. A text ASN.1 file obtained",
857 "from Entrez can be processed by using -a a instead of -a t -b.",
858 "",
859 "Nucleotide and protein records can be processed simultaneously. Use the",
860 "-o argument to indicate the nucleotide output file, and the -v argument",
861 "for the protein output file.",
862 "",
863 "The -f argument determines the format to be generated. Legal values of",
864 "-f and the resulting formats are:",
865 "",
866 " g GenBank (nucleotide) or GenPept (protein)",
867 " f FASTA",
868 " d CDS FASTA (nucleotide) or Translated FASTA (protein)",
869 " t 5-column feature table",
870 " y TinySet XML",
871 " s INSDSet XML",
872 " a ASN.1 of entire record",
873 " x XML version of entire record",
874 "",
875 "The command",
876 "",
877 " asn2all -i gbpri1.aso -a t -b -f g -o gbpri1.nuc -v gbpri1.prt",
878 "",
879 "will generate GenBank and GenPept reports from gbpri1.aso.",
880 NULL
881 };
882
883 static void DisplayHelpText (
884 void
885 )
886
887 {
888 Int2 i;
889
890 for (i = 0; helpLines [i] != NULL; i++) {
891 printf ("%s\n", helpLines [i]);
892 }
893 printf ("\n");
894 }
895
896 /* Args structure contains command-line arguments */
897
898 #define p_argInputPath 0
899 #define i_argInputFile 1
900 #define o_argNtOutFile 2
901 #define v_argAaOutFile 3
902 #define x_argSuffix 4
903 #define f_argFormat 5
904 #define a_argType 6
905 #define b_argBinary 7
906 #define c_argCompressed 8
907 #define r_argRemote 9
908 #define k_argLocal 10
909 #define d_argAsnIdx 11
910 #define l_argLockFar 12
911 #define T_argThreads 13
912 #define n_argNear 14
913 #define X_argExtended 15
914 #define A_argAccession 16
915 #define h_argHelp 17
916
917
918 Args myargs [] = {
919 {"Path to Files", NULL, NULL, NULL,
920 TRUE, 'p', ARG_STRING, 0.0, 0, NULL},
921 {"Input File Name", "stdin", NULL, NULL,
922 TRUE, 'i', ARG_FILE_IN, 0.0, 0, NULL},
923 {"Nucleotide Output File Name", NULL, NULL, NULL,
924 TRUE, 'o', ARG_FILE_OUT, 0.0, 0, NULL},
925 {"Protein Output File Name", NULL, NULL, NULL,
926 TRUE, 'v', ARG_FILE_OUT, 0.0, 0, NULL},
927 {"File Selection Suffix", ".aso", NULL, NULL,
928 TRUE, 'x', ARG_STRING, 0.0, 0, NULL},
929 {"Format\n"
930 " g GenBank/GenPept\n"
931 " f FASTA\n"
932 " d CDS FASTA\n"
933 " t Feature Table\n"
934 " y TinySet XML\n"
935 " s INSDSet XML\n"
936 " a ASN.1\n"
937 " x XML\n"
938 " c Cache Components\n", NULL, NULL, NULL,
939 TRUE, 'f', ARG_STRING, 0.0, 0, NULL},
940 {"ASN.1 Type\n"
941 " a Automatic\n"
942 " c Catenated\n"
943 " z Any\n"
944 " e Seq-entry\n"
945 " b Bioseq\n"
946 " s Bioseq-set\n"
947 " m Seq-submit\n"
948 " t Batch Processing\n", "a", NULL, NULL,
949 TRUE, 'a', ARG_STRING, 0.0, 0, NULL},
950 {"Bioseq-set is Binary", "F", NULL, NULL,
951 TRUE, 'b', ARG_BOOLEAN, 0.0, 0, NULL},
952 {"Bioseq-set is Compressed", "F", NULL, NULL,
953 TRUE, 'c', ARG_BOOLEAN, 0.0, 0, NULL},
954 {"Remote Fetching", "F", NULL, NULL,
955 TRUE, 'r', ARG_BOOLEAN, 0.0, 0, NULL},
956 {"Local Fetching", "F", NULL, NULL,
957 TRUE, 'k', ARG_BOOLEAN, 0.0, 0, NULL},
958 {"Path to Indexed Binary ASN.1 Data", NULL, NULL, NULL,
959 TRUE, 'd', ARG_STRING, 0.0, 0, NULL},
960 {"Lock Components in Advance", "F", NULL, NULL,
961 TRUE, 'l', ARG_BOOLEAN, 0.0, 0, NULL},
962 {"Use Threads", "F", NULL, NULL,
963 TRUE, 'T', ARG_BOOLEAN, 0.0, 0, NULL},
964 {"Near Fasta Policy\n"
965 " a All\n"
966 " n Near Only\n"
967 " f Far Only\n", "n", NULL, NULL,
968 TRUE, 'n', ARG_STRING, 0.0, 0, NULL},
969 {"Extended Qualifier Output", "F", NULL, NULL,
970 TRUE, 'X', ARG_BOOLEAN, 0.0, 0, NULL},
971 {"Accession to Fetch", NULL, NULL, NULL,
972 TRUE, 'A', ARG_STRING, 0.0, 0, NULL},
973 {"Display Help Message", "F", NULL, NULL,
974 TRUE, 'h', ARG_BOOLEAN, 0.0, 0, NULL},
975 };
976
977 Int2 Main (void)
978
979 {
980 CharPtr asnin, aaout, directory, suffix, ntout, accn, asnidx, str;
981 AppFlagData afd;
982 Char app [64], format, nearpolicy, type, xmlbuf [128];
983 DataVal av;
984 ValNodePtr bsplist;
985 Boolean help, indexed, local, remote;
986 SeqEntryPtr sep;
987
988 /* standard setup */
989
990 ErrSetFatalLevel (SEV_MAX);
991 ErrClearOptFlags (EO_SHOW_USERSTR);
992 ErrSetLogfile ("stderr", ELOG_APPEND);
993 UseLocalAsnloadDataAndErrMsg ();
994 ErrPathReset ();
995
996 if (! AllObjLoad ()) {
997 Message (MSG_FATAL, "AllObjLoad failed");
998 return 1;
999 }
1000 if (! SubmitAsnLoad ()) {
1001 Message (MSG_FATAL, "SubmitAsnLoad failed");
1002 return 1;
1003 }
1004 if (! FeatDefSetLoad ()) {
1005 Message (MSG_FATAL, "FeatDefSetLoad failed");
1006 return 1;
1007 }
1008 if (! SeqCodeSetLoad ()) {
1009 Message (MSG_FATAL, "SeqCodeSetLoad failed");
1010 return 1;
1011 }
1012 if (! GeneticCodeTableLoad ()) {
1013 Message (MSG_FATAL, "GeneticCodeTableLoad failed");
1014 return 1;
1015 }
1016
1017 /* process command line arguments */
1018
1019 sprintf (app, "asn2all %s", ASN2ALL_APPLICATION);
1020 if (! GetArgs (app, sizeof (myargs) / sizeof (Args), myargs)) {
1021 return 0;
1022 }
1023
1024 /* additional setup modifications */
1025
1026 help = (Boolean) myargs [h_argHelp].intvalue;
1027 if (help) {
1028 DisplayHelpText ();
1029 return 0;
1030 }
1031
1032 if (! objgbseqAsnLoad ()) {
1033 Message (MSG_POSTERR, "objgbseqAsnLoad failed");
1034 return 1;
1035 }
1036 if (! objinsdseqAsnLoad ()) {
1037 Message (MSG_POSTERR, "objinsdseqAsnLoad failed");
1038 return 1;
1039 }
1040
1041 if (GetAppParam ("NCBI", "SETTINGS", "XMLPREFIX", NULL, xmlbuf, sizeof (xmlbuf))) {
1042 AsnSetXMLmodulePrefix (StringSave (xmlbuf));
1043 }
1044
1045 MemSet ((Pointer) &afd, 0, sizeof (AppFlagData));
1046
1047 remote = (Boolean ) myargs [r_argRemote].intvalue;
1048 local = (Boolean) myargs [k_argLocal].intvalue;
1049 asnidx = (CharPtr) myargs [d_argAsnIdx].strvalue;
1050 indexed = (Boolean) StringDoesHaveText (asnidx);
1051 accn = (CharPtr) myargs [A_argAccession].strvalue;
1052
1053 directory = (CharPtr) myargs [p_argInputPath].strvalue;
1054 asnin = (CharPtr) myargs [i_argInputFile].strvalue;
1055 ntout = (CharPtr) myargs [o_argNtOutFile].strvalue;
1056 aaout = (CharPtr) myargs [v_argAaOutFile].strvalue;
1057 suffix = (CharPtr) myargs [x_argSuffix].strvalue;
1058
1059 /* default to stdout for nucleotide output if nothing specified */
1060
1061 if (StringHasNoText (ntout) &&
1062 StringHasNoText (aaout)) {
1063 ntout = "stdout";
1064 }
1065
1066 /* populate parameter structure */
1067
1068 afd.automatic = FALSE;
1069 afd.catenated = FALSE;
1070 afd.batch = FALSE;
1071 afd.binary = (Boolean) myargs [b_argBinary].intvalue;
1072 afd.compressed = (Boolean) myargs [c_argCompressed].intvalue;
1073 afd.lock = (Boolean) myargs [l_argLockFar].intvalue;
1074 afd.useThreads = (Boolean) myargs [T_argThreads].intvalue;
1075 afd.type = 1;
1076 afd.linelen = 70;
1077 afd.nearpolicy = 1;
1078 afd.mode = ENTREZ_MODE;
1079 afd.extended = (Boolean) myargs [X_argExtended].intvalue;
1080 afd.failed = FALSE;
1081
1082 str = myargs [f_argFormat].strvalue;
1083 TrimSpacesAroundString (str);
1084 if (StringDoesHaveText (str)) {
1085 format = str [0];
1086 } else {
1087 Message (MSG_POSTERR, "You must indicate a format with the -f parameter");
1088 return 1;
1089 }
1090
1091 format = TO_LOWER (format);
1092 switch (format) {
1093 case 'g' :
1094 afd.format = FLATFILE_FORMAT;
1095 break;
1096 case 'f' :
1097 afd.format = FASTA_FORMAT;
1098 break;
1099 case 'd' :
1100 afd.format = CDS_FORMAT;
1101 break;
1102 case 't' :
1103 afd.format = TABLE_FORMAT;
1104 break;
1105 case 'y' :
1106 afd.format = TINY_FORMAT;
1107 break;
1108 case 's' :
1109 afd.format = INSDSEQ_FORMAT;
1110 break;
1111 case 'a' :
1112 afd.format = ASN_FORMAT;
1113 break;
1114 case 'x' :
1115 afd.format = XML_FORMAT;
1116 break;
1117 case 'c' :
1118 afd.format = CACHE_COMPONENTS;
1119 break;
1120 default :
1121 afd.format = FLATFILE_FORMAT;
1122 break;
1123 }
1124
1125 str = myargs [a_argType].strvalue;
1126 TrimSpacesAroundString (str);
1127 if (StringDoesHaveText (str)) {
1128 type = str [0];
1129 } else {
1130 type = 'a';
1131 }
1132
1133 type = TO_LOWER (type);
1134 switch (type) {
1135 case 'a' :
1136 afd.type = 1;
1137 afd.automatic = TRUE;
1138 case 'c' :
1139 afd.type = 1;
1140 afd.catenated = TRUE;
1141 case 'z' :
1142 afd.type = 1;
1143 break;
1144 case 'e' :
1145 afd.type = 2;
1146 break;
1147 case 'b' :
1148 afd.type = 3;
1149 break;
1150 case 's' :
1151 afd.type = 4;
1152 break;
1153 case 'm' :
1154 afd.type = 5;
1155 break;
1156 case 't' :
1157 afd.type = 1;
1158 afd.batch = TRUE;
1159 afd.mode = RELEASE_MODE;
1160 break;
1161 default :
1162 afd.type = 1;
1163 break;
1164 }
1165
1166 str = myargs [n_argNear].strvalue;
1167 TrimSpacesAroundString (str);
1168 if (StringDoesHaveText (str)) {
1169 nearpolicy = str [0];
1170 } else {
1171 nearpolicy = 'a';
1172 }
1173
1174 nearpolicy = TO_LOWER (nearpolicy);
1175 switch (nearpolicy) {
1176 case 'a' :
1177 afd.nearpolicy = 1;
1178 break;
1179 case 'n' :
1180 afd.nearpolicy = 2;
1181 break;
1182 case 'f' :
1183 afd.nearpolicy = 3;
1184 break;
1185 default :
1186 afd.nearpolicy = 1;
1187 break;
1188 }
1189
1190 afd.nt = NULL;
1191 afd.aa = NULL;
1192 afd.an = NULL;
1193 afd.ap = NULL;
1194
1195 afd.amp = AsnAllModPtr ();
1196 afd.atp_bss = AsnFind ("Bioseq-set");
1197 afd.atp_bsss = AsnFind ("Bioseq-set.seq-set");
1198 afd.atp_se = AsnFind ("Bioseq-set.seq-set.E");
1199 afd.atp_inst = AsnFind ("Bioseq.inst");
1200 afd.atp_bsc = AsnFind ("Bioseq-set.class");
1201 afd.bssp_atp = AsnLinkType (NULL, afd.atp_bss);
1202 afd.atp_insd = AsnLinkType (NULL, AsnFind ("INSDSet"));
1203 afd.atp_insde = AsnLinkType (NULL, AsnFind ("INSDSet.E"));
1204 afd.atp_tss = AsnLinkType (NULL, AsnFind ("TSeqSet"));
1205 afd.atp_tsse = AsnLinkType (NULL, AsnFind ("TSeqSet.E"));
1206
1207 /* open output files */
1208
1209 switch (afd.format) {
1210 case FLATFILE_FORMAT :
1211 case FASTA_FORMAT :
1212 case CDS_FORMAT :
1213 case TABLE_FORMAT :
1214 if (! StringHasNoText (ntout)) {
1215 afd.nt = FileOpen (ntout, "w");
1216 if (afd.nt == NULL) {
1217 Message (MSG_FATAL, "Unable to open nucleotide output file");
1218 return 1;
1219 }
1220 }
1221 if (! StringHasNoText (aaout)) {
1222 afd.aa = FileOpen (aaout, "w");
1223 if (afd.aa == NULL) {
1224 Message (MSG_FATAL, "Unable to open protein output file");
1225 return 1;
1226 }
1227 }
1228 break;
1229 case TINY_FORMAT :
1230 case INSDSEQ_FORMAT :
1231 if (! StringHasNoText (ntout)) {
1232 afd.an = AsnIoOpen (ntout, "wx");
1233 if (afd.an == NULL) {
1234 Message (MSG_FATAL, "Unable to open nucleotide output file");
1235 return 1;
1236 }
1237 }
1238 if (! StringHasNoText (aaout)) {
1239 afd.ap = AsnIoOpen (aaout, "wx");
1240 if (afd.ap == NULL) {
1241 Message (MSG_FATAL, "Unable to open protein output file");
1242 return 1;
1243 }
1244 }
1245 break;
1246 case ASN_FORMAT :
1247 if (! StringHasNoText (ntout)) {
1248 afd.an = AsnIoOpen (ntout, "w");
1249 if (afd.an == NULL) {
1250 Message (MSG_FATAL, "Unable to open output file");
1251 return 1;
1252 }
1253 }
1254 break;
1255 case XML_FORMAT :
1256 if (! StringHasNoText (ntout)) {
1257 afd.an = AsnIoOpen (ntout, "wx");
1258 if (afd.an == NULL) {
1259 Message (MSG_FATAL, "Unable to open output file");
1260 return 1;
1261 }
1262 }
1263 break;
1264 case CACHE_COMPONENTS :
1265 if (! StringHasNoText (ntout)) {
1266 afd.an = AsnIoOpen (ntout, "wb");
1267 if (afd.an == NULL) {
1268 Message (MSG_FATAL, "Unable to open output file");
1269 return 1;
1270 }
1271 }
1272 break;
1273 default :
1274 break;
1275 }
1276
1277 /* register fetch functions */
1278
1279 if (remote) {
1280 PubSeqFetchEnable ();
1281 PubMedFetchEnable ();
1282 }
1283
1284 if (local) {
1285 LocalSeqFetchInit (FALSE);
1286 }
1287
1288 if (indexed) {
1289 AsnIndexedLibFetchEnable (asnidx, TRUE);
1290 }
1291
1292 /* open output structures */
1293
1294 switch (afd.format) {
1295 case TINY_FORMAT :
1296 if (afd.an != NULL) {
1297 AsnOpenStruct (afd.an, afd.atp_tss, (Pointer) &(afd.tss));
1298 }
1299 if (afd.ap != NULL) {
1300 AsnOpenStruct (afd.ap, afd.atp_tss, (Pointer) &(afd.tss));
1301 }
1302 break;
1303 case INSDSEQ_FORMAT :
1304 if (afd.an != NULL) {
1305 afd.xtran.gbseq = &(afd.gbsq);
1306 afd.xtran.aip = afd.an;
1307 afd.xtran.atp = afd.atp_insde;
1308 AsnOpenStruct (afd.an, afd.atp_insd, (Pointer) &(afd.gbst));
1309 }
1310 if (afd.ap != NULL) {
1311 afd.xtrap.gbseq = &(afd.gbsq);
1312 afd.xtrap.aip = afd.ap;
1313 afd.xtrap.atp = afd.atp_insde;
1314 AsnOpenStruct (afd.ap, afd.atp_insd, (Pointer) &(afd.gbst));
1315 }
1316 break;
1317 case CACHE_COMPONENTS :
1318 if (afd.an != NULL) {
1319 AsnOpenStruct (afd.an, afd.bssp_atp, (Pointer) &(afd.bss));
1320 av.intvalue = 7;
1321 AsnWrite (afd.an, afd.atp_bsc, &av);
1322 AsnOpenStruct (afd.an, afd.atp_bsss, (Pointer) &(afd.bss.seq_set));
1323 }
1324 break;
1325 default :
1326 break;
1327 }
1328
1329 /* process input file or download accession */
1330
1331 if (StringDoesHaveText (accn)) {
1332
1333 if (remote) {
1334 sep = SeqEntryFromAccnOrGi (accn);
1335 if (sep != NULL) {
1336 bsplist = NULL;
1337 if (afd.lock) {
1338 bsplist = DoLockFarComponents (sep, afd.useThreads);
1339 }
1340
1341 FormatRecord (sep, &afd, bsplist);
1342
1343 bsplist = UnlockFarComponents (bsplist);
1344
1345 SeqEntryFree (sep);
1346 }
1347 }
1348
1349 } else if (StringDoesHaveText (directory)) {
1350
1351 DirExplore (directory, NULL, suffix, TRUE, ProcessOneRecord, (Pointer) &afd);
1352
1353 } else {
1354
1355 ProcessOneRecord (asnin, &afd);
1356 }
1357
1358 /* close output structures */
1359
1360 switch (afd.format) {
1361 case TINY_FORMAT :
1362 if (afd.an != NULL) {
1363 AsnCloseStruct (afd.an, afd.atp_tss, NULL);
1364 AsnPrintNewLine (afd.an);
1365 }
1366 if (afd.ap != NULL) {
1367 AsnCloseStruct (afd.ap, afd.atp_tss, NULL);
1368 AsnPrintNewLine (afd.ap);
1369 }
1370 break;
1371 case INSDSEQ_FORMAT :
1372 if (afd.an != NULL) {
1373 AsnCloseStruct (afd.an, afd.atp_insd, NULL);
1374 AsnPrintNewLine (afd.an);
1375 }
1376 if (afd.ap != NULL) {
1377 AsnCloseStruct (afd.ap, afd.atp_insd, NULL);
1378 AsnPrintNewLine (afd.ap);
1379 }
1380 break;
1381 case CACHE_COMPONENTS :
1382 if (afd.an != NULL) {
1383 AsnCloseStruct (afd.an, afd.atp_bsss, (Pointer) &(afd.bss.seq_set));
1384 AsnCloseStruct (afd.an, afd.bssp_atp, (Pointer) &(afd.bss));
1385 AsnPrintNewLine (afd.an);
1386 }
1387 break;
1388 default :
1389 break;
1390 }
1391
1392 /* close output files */
1393
1394 if (afd.nt != NULL) {
1395 FileClose (afd.nt);
1396 }
1397 if (afd.aa != NULL) {
1398 FileClose (afd.aa);
1399 }
1400
1401 if (afd.an != NULL) {
1402 AsnIoClose (afd.an);
1403 }
1404
1405 if (afd.ap != NULL) {
1406 AsnIoClose (afd.ap);
1407 }
1408
1409 if (afd.format == CACHE_COMPONENTS) {
1410 CreateAsnIndex (ntout, NULL, TRUE);
1411 }
1412
1413 /* close fetch functions */
1414
1415 if (indexed) {
1416 AsnIndexedLibFetchDisable ();
1417 }
1418
1419 if (local) {
1420 LocalSeqFetchDisable ();
1421 }
1422
1423 if (remote) {
1424 PubMedFetchDisable ();
1425 PubSeqFetchDisable ();
1426 }
1427
1428 if (afd.failed) {
1429 return 1;
1430 }
1431
1432 return 0;
1433 }
1434
1435 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |