ad4115d207739881f3dd609fb174f5c92e7a06c1 kent Fri Jul 26 11:50:02 2013 -0700 Making it write out '@' line again. diff --git src/utils/fastqStatsAndSubsample/fastqStatsAndSubsample.c src/utils/fastqStatsAndSubsample/fastqStatsAndSubsample.c index 262e69b..f992ce2 100644 --- src/utils/fastqStatsAndSubsample/fastqStatsAndSubsample.c +++ src/utils/fastqStatsAndSubsample/fastqStatsAndSubsample.c @@ -137,34 +137,37 @@ int i; for (i=0; i<arraySize; ++i) total += array[i]; return total; } boolean oneFastqRecord(struct lineFile *lf, FILE *f, boolean copy, boolean firstTime) /* Read next fastq record from LF, and optionally copy it to f. Return FALSE at end of file * Do a _little_ error checking on record while we're at it. The format has already been * validated on the client side fairly thoroughly. */ { char *line; int lineSize; /* Deal with initial line starting with '@' */ -if (!nextLineMustMatchChar(lf, '@', FALSE)) +if (!lineFileNext(lf, &line, &lineSize)) return FALSE; +if (line[0] != '@') + errAbort("Expecting line starting with '@' got %s line %d of %s", + line, lf->lineIx, lf->fileName); if (copy) - fprintf(f, "@\n"); + mustWrite(f, line, lineSize); /* Deal with line containing sequence. */ if (!lineFileNext(lf, &line, &lineSize)) errAbort("%s truncated in middle of record", lf->fileName); /* Get size and add it to stats */ int seqSize = lineSize-1; if (seqSize > MAX_READ_SIZE) errAbort("Sequence size %d too long line %d of %s. Max is %d", seqSize, lf->lineIx, lf->fileName, MAX_READ_SIZE); if (firstTime) { maxReadBases = minReadBases = seqSize; } else @@ -246,34 +249,38 @@ mustWrite(f, line, lineSize); return TRUE; } boolean maybeCopyFastqRecord(struct lineFile *lf, FILE *f, boolean copy, int *retSeqSize) /* Read next fastq record from LF, and optionally copy it to f. Return FALSE at end of file * Do a _little_ error checking on record while we're at it. The format has already been * validated on the client side fairly thoroughly. */ { char *line; int lineSize; /* Deal with initial line starting with '@' */ -if (!nextLineMustMatchChar(lf, '@', FALSE)) +if (!lineFileNext(lf, &line, &lineSize)) return FALSE; +if (line[0] != '@') + errAbort("Expecting line starting with '@' got %s line %d of %s", + line, lf->lineIx, lf->fileName); if (copy) - fprintf(f, "@\n"); + mustWrite(f, line, lineSize); + /* Deal with line containing sequence. */ if (!lineFileNext(lf, &line, &lineSize)) errAbort("%s truncated in middle of record", lf->fileName); if (copy) mustWrite(f, line, lineSize); int seqSize = lineSize-1; /* Deal with line containing just '+' that separates sequence from quality. */ /* Deal with line containing just '+' that separates sequence from quality. */ nextLineMustMatchChar(lf, '+', TRUE); if (copy) fprintf(f, "+\n"); /* Deal with quality score line. */