static Boolean SetUpAsnStreamData (AsnStreamPtr asp) { if (asp == NULL) return FALSE; if (! SeqSetAsnLoad()) { Message (MSG_POSTERR, "Unable to load SeqSet parse tree"); return FALSE; } asp->amp = AsnAllModPtr(); if (asp->amp == NULL) { Message (MSG_POSTERR, "Unable to obtain ASN.1 module pointer"); return FALSE; } /* Get pointers to ASN.1 types that must be dealt with in asn_in */ if ( (asp->atp_bss = AsnFind("Bioseq-set")) == NULL) { Message (MSG_POSTERR, "could not find type Bioseq-set"); return FALSE; } if ( (asp->atp_bss_se = AsnFind("Bioseq-set.seq-set.E")) == NULL) { Message (MSG_POSTERR, "AsnFind failure: Bioseq-set.seq-set.E"); return FALSE; } if ( (asp->atp_se = AsnFind("Seq-entry")) == NULL) { Message (MSG_POSTERR, "AsnFind failure: Seq-entry"); return FALSE; } return TRUE; }
/***************************************************************************** * * Main program loop to read, process, write SeqEntrys * *****************************************************************************/ Int2 Main(void) { AsnIoPtr aipout=NULL, aipin; AsnTypePtr atp, atp_inst; AsnModulePtr amp; DataVal dv; CharPtr ftype; BioseqPtr bsp; /* check command line arguments */ if ( ! GetArgs("asn2xml 1.0",NUMARG, myargs)) return 1; /* load the sequence alphabets */ /* (and sequence parse trees) */ if (! SeqEntryLoad()) ErrShow(); if (! SubmitAsnLoad()) ErrShow(); if (! SeqCodeSetLoad()) ErrShow(); /* get pointer to all loaded ASN.1 modules */ amp = AsnAllModPtr(); if (amp == NULL) { ErrShow(); return 1; } if (myargs[1].intvalue) atp = AsnFind("Seq-entry"); else if (myargs[2].intvalue) atp = AsnFind("Seq-submit"); else atp = AsnFind("Bioseq-set"); /* get the initial type pointers */ if (atp == NULL) { ErrShow(); return 1; } atp_inst = AsnFind("Bioseq.inst"); if (atp_inst == NULL) { ErrShow(); return 1; } /* open the ASN.1 input file in the right mode */ if ((aipin = AsnIoOpen (myargs[0].strvalue, myargs[3].intvalue?"rb":"r")) == NULL) { ErrPostEx(SEV_ERROR,0,0, "Can't open %s", myargs[0].strvalue); ErrShow(); return 1; } /* open the ASN.1 output file in the right mode */ if (myargs[4].strvalue != NULL) /* output desired? */ { ftype = "wx"; if ((aipout = AsnIoOpen (myargs[4].strvalue, ftype)) == NULL) { ErrPostEx(SEV_ERROR,0,0, "Can't open %s", myargs[4].strvalue); ErrShow(); return 1; } } /* log errors instead of die */ if (myargs[5].strvalue != NULL) { if (! ErrSetLog (myargs[5].strvalue)) { ErrShow(); return 1; } else ErrSetOpts (ERR_CONTINUE, ERR_LOG_ON); } while ((atp = AsnReadId(aipin, amp, atp)) != NULL) { if (atp == atp_inst) /* need object loader convert */ { bsp = BioseqNew(); /* need newly initialized bsp */ BioseqInstAsnRead(bsp, aipin, atp); BioseqInstAsnWrite(bsp, aipout, atp); bsp = BioseqFree(bsp); } else { AsnReadVal(aipin, atp, &dv); /* read it */ AsnWrite(aipout, atp, &dv); /* write it */ AsnKillValue(atp, &dv); /* free it */ } } AsnIoClose(aipin); AsnIoClose(aipout); return(0); }
Int2 Main (void) { AsnIoPtr aop = NULL; AsnModulePtr amp; AsnTypePtr atp_bss, atp_ss, atp_se; BioseqSet bss; FILE *fp; ValNodePtr head, vnp; Char path [PATH_MAX]; CharPtr progname, str, subfile; ErrSetFatalLevel (SEV_MAX); ErrClearOptFlags (EO_SHOW_USERSTR); UseLocalAsnloadDataAndErrMsg (); ErrPathReset (); if (! AllObjLoad ()) { Message (MSG_FATAL, "AllObjLoad failed"); return 1; } if (! SubmitAsnLoad ()) { Message (MSG_FATAL, "SubmitAsnLoad failed"); return 1; } if (! SeqCodeSetLoad ()) { Message (MSG_FATAL, "SeqCodeSetLoad failed"); return 1; } if (! GeneticCodeTableLoad ()) { Message (MSG_FATAL, "GeneticCodeTableLoad failed"); return 1; } MemSet ((Pointer) &bss, 0, sizeof (BioseqSet)); amp = AsnAllModPtr (); if (amp == NULL) { Message (MSG_FATAL, "Unable to load AsnAllModPtr"); return 1; } atp_bss = AsnFind ("Bioseq-set"); if (atp_bss == NULL) { Message (MSG_FATAL, "Unable to find ASN.1 type Bioseq-set"); return 1; } atp_ss = AsnFind ("Bioseq-set.seq-set"); if (atp_ss == NULL) { Message (MSG_FATAL, "Unable to find ASN.1 type Bioseq-set.seq-set"); return 1; } atp_se = AsnFind ("Bioseq-set.seq-set.E"); if (atp_se == NULL) { Message (MSG_FATAL, "Unable to find ASN.1 type Bioseq-set.seq-set.E"); return 1; } ProgramPath (path, sizeof (path)); progname = StringRChr (path, DIRDELIMCHR); if (progname != NULL) { progname++; } else { progname = "idcleanscan"; } if (! GetArgs (progname, sizeof (myargs) / sizeof (Args), myargs)) { return 0; } fp = FileOpen (myargs [o_argOutputFile].strvalue, "a"); if (fp == NULL) { Message (MSG_FATAL, "FileOpen failed"); return 1; } if (StringHasNoText (myargs [p_argInputPath].strvalue)) { str = myargs [i_argInputFile].strvalue; if (! StringHasNoText (str)) { DoReleaseFile (str, myargs [b_argBinaryFile].intvalue, myargs [c_argCompressed].intvalue, fp, aop, NULL); } } else { head = DirCatalog (myargs [p_argInputPath].strvalue); if (! StringHasNoText (myargs [s_argSubset].strvalue)) { aop = AsnIoOpen (myargs [s_argSubset].strvalue, /* "wb" */ "w"); AsnOpenStruct (aop, atp_bss, (Pointer) &bss); AsnOpenStruct (aop, atp_ss, (Pointer) bss.seq_set); /* av.intvalue = BioseqseqSet_class_genbank; AsnWrite (aop, atp_cls, &av); */ } for (vnp = head; vnp != NULL; vnp = vnp->next) { if (vnp->choice == 0) { str = (CharPtr) vnp->data.ptrvalue; if (! StringHasNoText (str)) { subfile = myargs [x_argFileSelect].strvalue; if (StringHasNoText (subfile) || StringStr (str, subfile) != NULL) { #ifdef OS_UNIX /* printf ("%s\n", str); */ #endif DoReleaseFile (str, myargs [b_argBinaryFile].intvalue, myargs [c_argCompressed].intvalue, fp, aop, atp_se); } } } } if (aop != NULL) { AsnCloseStruct (aop, atp_ss, (Pointer) bss.seq_set); AsnCloseStruct (aop, atp_bss, (Pointer) &bss); AsnIoClose (aop); } ValNodeFreeData (head); } FileClose (fp); return 0; }
NCBITEST_AUTO_INIT() { CONNECT_Init(); SeqLocAsnLoad(); s_SeqIdATP = AsnFind(const_cast<char*>("Seq-id")); // avoid warnings }
Int2 Main(void) { AsnIoPtr aip; FILE * aa = NULL, * na = NULL, * ql = NULL; SeqEntryPtr sep; SeqSubmitPtr ssp; AsnTypePtr atp, atp2; AsnModulePtr amp; Uint1 group_segs = 0; Boolean limit_to_genbank, make_dna, make_protein, make_quality, far_quality, do_it; /* check command line arguments */ if ( ! GetArgs("asn2fast",NUMARG, myargs)) return 1; /* load the sequence alphabets */ /* (and sequence parse trees) */ if (! SeqEntryLoad()) { ErrShow(); return 1; } /* get pointer to all loaded ASN.1 modules */ amp = AsnAllModPtr(); if (amp == NULL) { ErrShow(); return 1; } if (myargs[11].intvalue) { if (! SubmitAsnLoad()) Message(MSG_FATAL, "Unable to load parse trees."); atp2 = AsnFind("Seq-submit"); if (atp2 == NULL) Message(MSG_FATAL, "Unable to find Seq-submit"); atp = AsnFind("Seq-submit"); if (atp == NULL) Message(MSG_FATAL, "Unable to find Seq-submit"); } else { atp = AsnFind("Bioseq-set"); /* get the initial type pointers */ if (atp == NULL) { ErrShow(); return 1; } atp2 = AsnFind("Bioseq-set.seq-set.E"); if (atp2 == NULL) { ErrShow(); return 1; } } make_protein = (Boolean)(myargs[7].intvalue); make_dna = (Boolean)(myargs[8].intvalue); make_quality = (Boolean)(myargs[12].intvalue); far_quality = (Boolean)(myargs[14].intvalue); /* open the ASN.1 input file in the right mode */ if ((aip = AsnIoOpen (myargs[0].strvalue, myargs[2].intvalue?"rb":"r")) == NULL) { ErrShow(); return 1; } /* open the output file */ if ((myargs[3].strvalue != NULL) && (make_protein)) { if ( (aa = FileOpen (myargs[3].strvalue, "w")) == NULL) { ErrShow(); return 1; } } if ((myargs[4].strvalue != NULL) && (make_dna)) { if ( (na = FileOpen (myargs[4].strvalue, "w")) == NULL) { ErrShow(); return 1; } } if ((myargs[13].strvalue != NULL) && (make_quality)) { if ( (ql = FileOpen (myargs[13].strvalue, "w")) == NULL) { ErrShow(); return 1; } } /* log errors instead of die */ if (myargs[5].strvalue != NULL) { if (! ErrSetLog (myargs[5].strvalue)) ErrShow(); else ErrSetOpts (ERR_CONTINUE, ERR_LOG_ON); } if (myargs[6].intvalue) /* combine segmented seqs */ { group_segs = 1; if (myargs[10].intvalue) group_segs = 3; /* and instantiate virtuals */ } limit_to_genbank = (Boolean)(myargs[9].intvalue); if (myargs [15].intvalue) { ID1BioseqFetchEnable ("asn2fast", FALSE); } if (myargs [16].intvalue) { LocalSeqFetchInit (FALSE); } if ( myargs[1].intvalue) /* read one Seq-entry */ { sep = SeqEntryAsnRead(aip, NULL); do_it = TRUE; if (limit_to_genbank) do_it = CheckIsGenBank(sep); if (do_it) { if (make_protein) SeqEntrysToFasta(sep, aa, FALSE, group_segs); if (make_dna) SeqEntrysToFasta(sep, na, TRUE, group_segs); if (make_quality) { if (far_quality) { SeqEntryExplore (sep, (Pointer) ql, PrintFarQualScores); } else { SeqEntryExplore (sep, (Pointer) ql, PrintQualScores); } } } SeqEntryFree(sep); } else if ( myargs[11].intvalue) /* read Seq-submit's */ { while ((atp = AsnReadId(aip, amp, atp)) != NULL) { if (atp == atp2) /* top level Seq-entry */ { ssp = SeqSubmitAsnRead(aip, atp); if (ssp->datatype == 1) { sep = (SeqEntryPtr) ssp->data; do_it = TRUE; if (limit_to_genbank) do_it = CheckIsGenBank(sep); if (do_it) { if (make_protein) SeqEntrysToFasta(sep, aa, FALSE, group_segs); if (make_dna) SeqEntrysToFasta(sep, na, TRUE, group_segs); if (make_quality) { if (far_quality) { SeqEntryExplore (sep, (Pointer) ql, PrintFarQualScores); } else { SeqEntryExplore (sep, (Pointer) ql, PrintQualScores); } } } } SeqSubmitFree(ssp); } else { AsnReadVal(aip, atp, NULL); } } } else /* read Seq-entry's from a Bioseq-set */ { while ((atp = AsnReadId(aip, amp, atp)) != NULL) { if (atp == atp2) /* top level Seq-entry */ { sep = SeqEntryAsnRead(aip, atp); do_it = TRUE; if (limit_to_genbank) do_it = CheckIsGenBank(sep); if (do_it) { if (make_protein) SeqEntrysToFasta(sep, aa, FALSE, group_segs); if (make_dna) SeqEntrysToFasta(sep, na, TRUE, group_segs); if (make_quality) { if (far_quality) { SeqEntryExplore (sep, (Pointer) ql, PrintFarQualScores); } else { SeqEntryExplore (sep, (Pointer) ql, PrintQualScores); } } } SeqEntryFree(sep); } else { AsnReadVal(aip, atp, NULL); } } } AsnIoClose(aip); if (make_protein) FileClose(aa); if (make_dna) FileClose(na); if (make_quality) FileClose (ql); if (myargs [16].intvalue) { LocalSeqFetchDisable (); } if (myargs [15].intvalue) { ID1BioseqFetchDisable (); } return(0); }
char *readASNSeq(const short whichEntry, const char *filename, const long skiplines, const short format, /* note: this is kASNseqentry or kASNseqset */ long *seqlen, short *nseq, short *error, char **seqid ) { AsnIoPtr aip = NULL; SeqEntryPtr the_set; AsnTypePtr atp, atp2; AsnModulePtr amp; Boolean inIsBinary= FALSE; /* damn, why can't asn routines test this? */ char *seq, stemp[200]; int i, count; *seqlen= 0; *nseq= 0; *error= 0; seq= NULL; /*fprintf(stderr,"readASNseq: SeqEntryLoad\n");*/ /* asn dictionary setups */ if (! SeqEntryLoad()) goto errxit; /* sequence alphabets (and sequence parse trees) */ amp = AsnAllModPtr(); /* get pointer to all loaded ASN.1 modules */ if (amp == NULL) goto errxit; atp = AsnFind("Bioseq-set"); /* get the initial type pointers */ if (atp == NULL) goto errxit; atp2 = AsnFind("Bioseq-set.seq-set.E"); if (atp2 == NULL) goto errxit; /* open the ASN.1 input file in the right mode */ /*fprintf(stderr,"readASNseq: AsnIoOpen(%s)\n", filename);*/ if ((aip = AsnIoOpen(filename, inIsBinary?"rb":"r")) == NULL) goto errxit; for (i=0; i<skiplines; i++) fgets( stemp, 255, aip->fp); /* this may mess up asn routines... */ if (! ErrSetLog ("stderr")) goto errxit; else ErrSetOpts(ERR_CONTINUE, ERR_LOG_ON); /*?? log errors instead of die */ seq= NULL; if (format == kASNseqentry) { /* read one Seq-entry */ /*fprintf(stderr,"readASNseq: SeqEntryAsnRead\n");*/ the_set = SeqEntryAsnRead(aip, NULL); SeqEntryToRaw(the_set, false, whichEntry, nseq, &seq, seqid, seqlen); SeqEntryFree(the_set); goto goodexit; } else { /* read Seq-entry's from a Bioseq-set */ count = 0; /*fprintf(stderr,"readASNseq: AsnReadId\n");*/ while ((atp = AsnReadId(aip, amp, atp)) != NULL) { if (atp == atp2) { /* top level Seq-entry */ the_set = SeqEntryAsnRead(aip, atp); SeqEntryToRaw(the_set, false, whichEntry, nseq, &seq, seqid, seqlen); SeqEntryFree(the_set); if (*nseq >= whichEntry) goto goodexit; } else AsnReadVal(aip, atp, NULL); count++; } } goodexit: AsnIoClose(aip); *error= 0; return seq; errxit: AsnIoClose(aip); *error= eASNerr; if (seq) free(seq); return NULL; }
/***************************************************************************** * * PrintFormatTraverse(pfp, pflp, index, indent) * *****************************************************************************/ NLM_EXTERN Int2 PrintFormatTraverse(PrintFormatPtr pfp, PrintFormatListPtr pflp, Int2 index, Int2 indent) { PrintFormatItemPtr pfip; CharPtr template_format; PrintTemplatePtr usetemplate; Int2 count = 0, retcount; PrintFormBlockPtr pfbp; AsnTypePtr atp; AsnTypePtr PNTR typeptr = NULL; Int2 typecount = 0; while (pfp != NULL) { usetemplate = NULL; if (pfp->form->choice == PrintForm_use_template) { template_format = (CharPtr)(pfp->form->data.ptrvalue); usetemplate = PrintTemplateFind(template_format); if (usetemplate == NULL) { ErrPost(CTX_OBJPRT, 1, "..couldn't find template [%s]\n", template_format); return 0; } } if (pflp != NULL) { pfip = &(pflp->list[index]); pfip->sort_key = index; pfip->indent_level = indent; pfip->format = pfp; atp = AsnFind(pfp->asn1); /* get the node */ if (atp == NULL) { ErrPost(CTX_OBJPRT, 1, "PrintFormatTraverse: can't find [%s]", pfp->asn1); return 0; } pfip->atp = atp; pfip->isa = AsnFindBaseIsa(atp); pfip->_template = usetemplate; typeptr = AsnTypePathFind(NULL, pfp->asn1, &typecount); if (typeptr == NULL) return 0; pfip->types = typeptr; pfip->numtypes = typecount; } index++; count++; if (pfp->form->choice == PrintForm_block) { pfbp = (PrintFormBlockPtr)(pfp->form->data.ptrvalue); retcount = PrintFormatTraverse(pfbp->components, pflp, index, (Int2)(indent+1)); if (retcount == 0) /* failure */ return 0; count += retcount; index += retcount; } pfp = pfp->next; } return count; }
Int2 Main (void) { Char app [64], type; CSpeedFlagData cfd; CharPtr directory, filter, infile, logfile, outfile, str, suffix; Boolean remote; time_t runtime, starttime, stoptime; /* standard setup */ ErrSetFatalLevel (SEV_MAX); ErrClearOptFlags (EO_SHOW_USERSTR); UseLocalAsnloadDataAndErrMsg (); ErrPathReset (); /* finish resolving internal connections in ASN.1 parse tables */ if (! AllObjLoad ()) { Message (MSG_FATAL, "AllObjLoad failed"); return 1; } if (! SubmitAsnLoad ()) { Message (MSG_FATAL, "SubmitAsnLoad failed"); return 1; } if (! FeatDefSetLoad ()) { Message (MSG_FATAL, "FeatDefSetLoad failed"); return 1; } if (! SeqCodeSetLoad ()) { Message (MSG_FATAL, "SeqCodeSetLoad failed"); return 1; } if (! GeneticCodeTableLoad ()) { Message (MSG_FATAL, "GeneticCodeTableLoad failed"); return 1; } /* process command line arguments */ sprintf (app, "cspeedtest %s", CSPEEDTEST_APPLICATION); if (! GetArgs (app, sizeof (myargs) / sizeof (Args), myargs)) { return 0; } MemSet ((Pointer) &cfd, 0, sizeof (CSpeedFlagData)); directory = (CharPtr) myargs [p_argInputPath].strvalue; infile = (CharPtr) myargs [i_argInputFile].strvalue; outfile = (CharPtr) myargs [o_argOutputFile].strvalue; filter = (CharPtr) myargs [f_argFilter].strvalue; suffix = (CharPtr) myargs [x_argSuffix].strvalue; cfd.batch = FALSE; cfd.binary = (Boolean) myargs [b_argBinary].intvalue; cfd.compressed = (Boolean) myargs [c_argCompressed].intvalue; cfd.lock = (Boolean) myargs [l_argLockFar].intvalue; cfd.type = 1; str = myargs [a_argType].strvalue; TrimSpacesAroundString (str); if (StringDoesHaveText (str)) { type = str [0]; } else { type = 'a'; } type = TO_LOWER (type); switch (type) { case 'a' : cfd.type = 1; break; case 'e' : cfd.type = 2; break; case 'b' : cfd.type = 3; break; case 's' : cfd.type = 4; break; case 'm' : cfd.type = 5; break; case 't' : cfd.type = 1; cfd.batch = TRUE; break; case 'f' : cfd.type = 6; break; case 'l' : cfd.type = 7; break; default : cfd.type = 1; break; } remote = (Boolean) myargs [R_argRemote].intvalue; cfd.maxcount = myargs [X_argMaxCount].intvalue; if (cfd.maxcount < 1) { cfd.maxcount = 1; } cfd.io = myargs [O_argInOut].strvalue; cfd.clean = myargs [K_argClean].strvalue; cfd.skip = myargs [P_argSkip].strvalue; cfd.index = myargs [I_argIndex].strvalue; cfd.seq = myargs [S_argSeq].strvalue; cfd.feat = myargs [F_argFeat].strvalue; cfd.desc = myargs [D_argDesc].strvalue; cfd.verify = myargs [V_argVerify].strvalue; cfd.amp = AsnAllModPtr (); cfd.atp_bss = AsnFind ("Bioseq-set"); cfd.atp_bsss = AsnFind ("Bioseq-set.seq-set"); cfd.atp_se = AsnFind ("Bioseq-set.seq-set.E"); cfd.atp_bsc = AsnFind ("Bioseq-set.class"); cfd.bssp_atp = AsnLinkType (NULL, cfd.atp_bss); logfile = (CharPtr) myargs [L_argLogFile].strvalue; if (StringDoesHaveText (logfile)) { cfd.logfp = FileOpen (logfile, "w"); } if (remote) { PubSeqFetchEnable (); } if (StringDoesHaveText (outfile)) { cfd.ofp = FileOpen (outfile, "w"); } starttime = GetSecs (); if (StringDoesHaveText (directory)) { DirExplore (directory, NULL, suffix, FALSE, ProcessOneRecord, (Pointer) &cfd); } else if (StringDoesHaveText (infile)) { ProcessOneRecord (infile, (Pointer) &cfd); } if (cfd.ofp != NULL) { FileClose (cfd.ofp); } stoptime = GetSecs (); runtime = stoptime - starttime; if (cfd.logfp != NULL) { fprintf (cfd.logfp, "Finished in %ld seconds\n", (long) runtime); FileClose (cfd.logfp); } printf ("Finished in %ld seconds\n", (long) runtime); if (remote) { PubSeqFetchDisable (); } return 0; }
Int2 Main (void) { AsnIoPtr aip; AsnTypePtr atp; FILE *dfp = NULL; Boolean do_nuc = FALSE; Boolean do_prot = FALSE; XtraPtr extra; FILE *fp; GBSeq gbsq; GBSet gbst; Boolean get_var; Char line [256]; Boolean only_new; CharPtr str; Char xmlbuf [128]; XtraBlock xtra; ErrSetFatalLevel (SEV_MAX); ErrClearOptFlags (EO_SHOW_USERSTR); UseLocalAsnloadDataAndErrMsg (); ErrPathReset (); if (! AllObjLoad ()) { Message (MSG_FATAL, "AllObjLoad failed"); return 1; } if (! SubmitAsnLoad ()) { Message (MSG_FATAL, "SubmitAsnLoad failed"); return 1; } if (! SeqCodeSetLoad ()) { Message (MSG_FATAL, "SeqCodeSetLoad failed"); return 1; } if (! GeneticCodeTableLoad ()) { Message (MSG_FATAL, "GeneticCodeTableLoad failed"); return 1; } if (! objgbseqAsnLoad ()) { Message (MSG_POSTERR, "objgbseqAsnLoad failed"); return 1; } if (! GetArgs ("gbseqget", sizeof (myargs) / sizeof (Args), myargs)) { return 0; } fp = FileOpen (myargs [i_argInputFile].strvalue, "r"); if (fp == NULL) { return 1; } if (! StringHasNoText (myargs [d_argDateFile].strvalue)) { dfp = FileOpen (myargs [d_argDateFile].strvalue, "r"); if (dfp == NULL) { return 1; } } if (GetAppParam ("NCBI", "SETTINGS", "XMLPREFIX", NULL, xmlbuf, sizeof (xmlbuf))) { AsnSetXMLmodulePrefix (StringSave (xmlbuf)); } MemSet ((Pointer) &xtra, 0, sizeof (XtraBlock)); MemSet ((Pointer) &gbsq, 0, sizeof (GBSeq)); xtra.gbseq = &gbsq; aip = AsnIoOpen (myargs [o_argOutputFile].strvalue, "wx"); if (aip == NULL) { Message (MSG_POSTERR, "AsnIoOpen failed"); FileClose (fp); return 1; } only_new = (Boolean) myargs [n_argNewRecords].intvalue; get_var = (Boolean) myargs [v_argVariations].intvalue; str = myargs [m_argMolecule].strvalue; if (StringICmp (str, "n") == 0) { do_nuc = TRUE; } else if (StringICmp (str, "p") == 0) { do_prot = TRUE; } else if (StringICmp (str, "b") == 0) { do_nuc = TRUE; do_prot = TRUE; } else { do_nuc = TRUE; } PubSeqFetchEnable (); xtra.aip = aip; atp = AsnLinkType (NULL, AsnFind ("GBSet")); xtra.atp = AsnLinkType (NULL, AsnFind ("GBSet.E")); if (atp == NULL || xtra.atp == NULL) { Message (MSG_POSTERR, "AsnLinkType or AsnFind failed"); return 1; } extra = &xtra; MemSet ((Pointer) &gbst, 0, sizeof (GBSet)); AsnOpenStruct (aip, atp, (Pointer) &gbst); if (dfp != NULL) { DoQuery (fp, dfp, extra, get_var, do_nuc, do_prot); } else { str = ReadALine (line, sizeof (line), fp); while (str != NULL) { if (! StringHasNoText (str)) { ProcessAccession (str, extra, only_new, get_var, do_nuc, do_prot); } str = ReadALine (line, sizeof (line), fp); } } AsnCloseStruct (aip, atp, NULL); AsnPrintNewLine (aip); AsnIoClose (aip); FileClose (dfp); FileClose (fp); PubSeqFetchDisable (); return 0; }