struct qaSeq *qaRead(char *qaName) /* Read in a .qa file (all records) or die trying. */ { struct qaSeq *qa, *qaList = NULL; if (isQacFile(qaName)) { boolean isSwapped; FILE *f = qacOpenVerify(qaName, &isSwapped); while ((qa = qacReadNext(f, isSwapped)) != NULL) { slAddHead(&qaList, qa); } fclose(f); } else { struct lineFile *lf = lineFileOpen(qaName, TRUE); while ((qa = qaReadNext(lf)) != NULL) { slAddHead(&qaList, qa); } lineFileClose(&lf); } slReverse(&qaList); return qaList; }
void qaToQac(char *inName, char *outName) /* qaToQac - convert from uncompressed to compressed * quality score format. */ { struct lineFile *lf = lineFileOpen(inName, TRUE); FILE *f = mustOpen(outName, "wb"); struct qaSeq *qa; qacWriteHead(f); while ((qa = qaReadNext(lf)) != NULL) { qacWriteNext(f, qa); qaSeqFree(&qa); } lineFileClose(&lf); fclose(f); }