/* * do something to try to introduce more noise into the 'GetNoise' call */ static void rng_systemJitter(void) { static int fileToRead = 1; if (ReadOneFile(fileToRead)) { fileToRead = 1; } else { fileToRead++; } }
static void ProcessOneRecord ( CharPtr directory, CharPtr base, CharPtr organism, Boolean findorf, Boolean altstart, Boolean validate, Boolean flatfile ) { BioSourcePtr biop = NULL; BioseqPtr bsp; Uint2 datatype, entityID; Int2 genCode; MolInfoPtr mip; SeqAnnotPtr sap; SeqEntryPtr sep; SeqFeatPtr sfp; SqnTagPtr stp; CharPtr ttl; ValNodePtr vnp; Message (MSG_POST, "Processing %s\n", base); bsp = (BioseqPtr) ReadOneFile (directory, base, "fsa", &datatype); if (bsp == NULL || datatype != OBJ_BIOSEQ) { ObjMgrFree (datatype, (Pointer) bsp); return; } if (bsp->mol == Seq_mol_na) { bsp->mol = Seq_mol_dna; } vnp = ValNodeExtract (&(bsp->descr), Seq_descr_title); if (vnp != NULL) { ttl = (CharPtr) vnp->data.ptrvalue; if (ttl != NULL) { stp = SqnTagParse (ttl); if (stp != NULL) { biop = OldParseTitleIntoBioSource (stp, bsp, organism); } SqnTagFree (stp); } ValNodeFreeData (vnp); } if (biop == NULL) { biop = OldParseTitleIntoBioSource (NULL, bsp, organism); } if (biop != NULL) { SeqDescrAddPointer (&(bsp->descr), Seq_descr_source, (Pointer) biop); } mip = MolInfoNew (); if (mip != NULL) { mip->biomol = MOLECULE_TYPE_GENOMIC; SeqDescrAddPointer (&(bsp->descr), Seq_descr_molinfo, (Pointer) mip); } entityID = ObjMgrRegister (datatype, (Pointer) bsp); sep = GetBestTopParentForData (entityID, bsp); genCode = SeqEntryToGeneticCode (sep, NULL, NULL, 0); if (findorf) { AnnotateBestOrf (bsp, genCode, altstart); } sap = (SeqAnnotPtr) ReadOneFile (directory, base, "tbl", &datatype); if (sap != NULL && datatype == OBJ_SEQANNOT && sap->type == 1) { sap->next = bsp->annot; bsp->annot = sap; } else { ObjMgrFree (datatype, (Pointer) sap); } /* for parsed in features or best ORF, promote CDS products to protein bioseq */ for (sap = bsp->annot; sap != NULL; sap = sap->next) { if (sap->type == 1) { SetEmptyGeneticCodes (sap, genCode); sfp = (SeqFeatPtr) sap->data; PromoteXrefs (sfp, bsp, entityID); } } sep = GetTopSeqEntryForEntityID (entityID); if (sep != NULL) { SeriousSeqEntryCleanup (sep, NULL, NULL); WriteOneFile (directory, base, "sqn", sep); if (validate || flatfile) { SeqMgrIndexFeatures (entityID, 0); } if (validate) { Message (MSG_POST, "Validating %s\n", base); ValidateOneFile (directory, base, "val", sep); } if (flatfile) { Message (MSG_POST, "Flatfile %s\n", base); sep = FindNucSeqEntry (sep); FlatfileOneFile (directory, base, "gbf", sep); } } ObjMgrFreeByEntityID (entityID); }