7b2075fb991ac5be64eb0b8deb75436b956af981
markd
  Tue Feb 2 12:01:05 2016 -0800
added options to process minimally structured genes and to output root records that are not processed

diff --git src/lib/gff3.c src/lib/gff3.c
index 032ecf2..4801400 100644
--- src/lib/gff3.c
+++ src/lib/gff3.c
@@ -620,32 +620,33 @@
 writeEscaped(g3a->type, fh);
 fprintf(fh, "\t%d\t%d", g3a->start+1, g3a->end);
 fputc('\t', fh);
 if (g3a->haveScore)
     fprintf(fh, "%g", g3a->score);
 else
     fputc('.', fh);
 fprintf(fh, "\t%c", (g3a->strand != NULL) ? g3a->strand[0] : '.');
 fputc('\t', fh);
 if (g3a->phase < 0)
     fputc('.', fh);
 else
     fprintf(fh, "%d", g3a->phase);
 }
 
-static void writeAnn(struct gff3Ann *g3a, FILE *fh)
-/* write an annotation record to the specified file */
+void gff3AnnWrite(struct gff3Ann *g3a, FILE *fh)
+/* Write an annotation record to the specified file.
+ * This only writes a single record, it is not recursive.*/
 {
 writeFields(g3a, fh);
 fputc('\t', fh);
 writeAttrs(g3a, fh);
 fputc('\n', fh);
 }
 
 static void addFasta(struct gff3File *g3f, char *dna, int size, char *name)
 /* add one fasta record */
 {
 struct dnaSeq *dnaSeq = gff3FileAlloc(g3f, sizeof(struct dnaSeq));
 slAddHead(&g3f->seqs, dnaSeq);
 struct hashEl *hel = hashAdd(g3f->seqMap, name, dnaSeq);
 dnaSeq->name = hel->name;
 dnaSeq->dna = gff3FileCloneStr(g3f, dna);
@@ -1073,31 +1074,31 @@
 writeSequenceRegions(g3f, fh);
 writeFeatureOntologies(g3f, fh);
 writeAttributeOntologies(g3f, fh);
 writeSourceOntologies(g3f, fh);
 writeSpecies(g3f, fh);
 writeGenomeBuild(g3f, fh);
 }
 
 void gff3FileWrite(struct gff3File *g3f, char *fileName)
 /* write contents of an GFF3File object to a file */
 {
 FILE *fh = mustOpen(fileName, "w");
 writeMeta(g3f, fh);
 struct gff3AnnRef *g3aRef;
 for (g3aRef = g3f->anns; g3aRef != NULL; g3aRef = g3aRef->next)
-    writeAnn(g3aRef->ann, fh);
+    gff3AnnWrite(g3aRef->ann, fh);
 writeFastas(g3f, fh);
 carefulClose(&fh);
 }
 
 int gff3AnnRefLocCmp(const void *va, const void *vb)
 /* sort compare function for two gff3AnnRef objects */
 {
 const struct gff3Ann *a = (*((struct gff3AnnRef **)va))->ann;
 const struct gff3Ann *b = (*((struct gff3AnnRef **)vb))->ann;
 int diff = strcmp(a->seqid, b->seqid);
 if ((diff == 0) && (a->strand != b->strand))
     {
     // allow for various types of strand fields. above tests handles both null
     if (a->strand == NULL)
         diff = 1;