62746b4dd3909b50dce1928ca75d3ba8316f83e6 braney Tue Jul 14 15:42:46 2020 -0700 changes from user Sergej Nowoshilow on github diff --git src/lib/gff.c src/lib/gff.c index 03c409b..795589a 100644 --- src/lib/gff.c +++ src/lib/gff.c @@ -280,32 +280,32 @@ if ((hel = hashLookup(gff->featureHash, words[2])) == NULL) { struct gffFeature *el; AllocVar(el); hel = hashAdd(gff->featureHash, words[2], el); el->name = hel->name; slAddHead(&gff->featureList, el); } struct gffFeature *feature = hel->val; feature->count += 1; gl->feature = hel->name; if (!isdigit(words[3][0]) || !isdigit(words[4][0])) gffSyntaxError(fileName, lineIx, "col 3 or 4 not a number "); -gl->start = atoi(words[3])-1 + baseOffset; -gl->end = atoi(words[4]) + baseOffset; +gl->start = atol(words[3])-1 + baseOffset; +gl->end = atol(words[4]) + baseOffset; gl->score = atof(words[5]); gl->strand = words[6][0]; gl->frame = words[7][0]; if (wordCount >= 9) { if (!gff->typeKnown) { gff->typeKnown = TRUE; gff->isGtf = isGtfGroup(words[8]); } if (gff->isGtf) { parseGtfEnd(words[8], gff, gl, fileName, lineIx); } @@ -370,39 +370,39 @@ return gff; } struct gffFile *gffRead(char *fileName) /* Create a gffFile structure from a GFF file. */ { struct gffFile *gff = gffFileNew(fileName); gffFileAdd(gff, fileName, 0); return gff; } static void getGroupBoundaries(struct gffGroup *group) /* Fill in start, end, strand of group from lines. */ { struct gffLine *line; -int start = 0x3fffffff; -int end = -start; +long start = -1; +long end = -1; line = group->lineList; group->strand = line->strand; for (; line != NULL; line = line->next) { - if (start > line->start) + if ((start < 0) || (start > line->start)) start = line->start; - if (end < line->end) + if ((end < 0) || (end < line->end)) end = line->end; } group->start = start; group->end = end; } void gffGroupLines(struct gffFile *gff) /* Group lines of gff file together, in process moving * gff->lineList to gffGroup->lineList. */ { struct gffLine *line, *nextLine; struct hash *groupHash = gff->groupHash; char *groupName; struct gffGroup *group; struct gffLine *ungroupedLines = NULL; @@ -437,33 +437,33 @@ void gffOutput(struct gffLine *el, FILE *f, char sep, char lastSep) /* Print out GTF. Separate fields with sep. Follow last field with lastSep. */ { if (sep == ',') fputc('"',f); fprintf(f, "%s", el->seq); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->source); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%s", el->feature); if (sep == ',') fputc('"',f); fputc(sep,f); -fprintf(f, "%u", el->start+1); +fprintf(f, "%lu", el->start+1); fputc(sep,f); -fprintf(f, "%u", el->end); +fprintf(f, "%lu", el->end); fputc(sep,f); fprintf(f, "%f", el->score); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%c", el->strand); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); fprintf(f, "%c", el->frame); if (sep == ',') fputc('"',f); fputc(sep,f); if (sep == ',') fputc('"',f); if (el->geneId != NULL) fprintf(f, "gene_id %s\"%s%s\"; ", (sep == ',') ? "\\" : "",