klib
[Ported from github.com/attractivechaos/klib] added block arena
Brought by drakestapleton
| 1 | #include <zlib.h> |
| 2 | #include <stdio.h> |
| 3 | #include "kseq.h" |
| 4 | KSEQ_INIT(gzFile, gzread) |
| 5 | |
| 6 | int main(int argc, char *argv[]) |
| 7 | { |
| 8 | gzFile fp; |
| 9 | kseq_t *seq; |
| 10 | int l; |
| 11 | if (argc == 1) { |
| 12 | fprintf(stderr, "Usage: %s <in.fasta>\n", argv[0]); |
| 13 | return 1; |
| 14 | } |
| 15 | fp = gzopen(argv[1], "r"); |
| 16 | seq = kseq_init(fp); |
| 17 | while ((l = kseq_read(seq)) >= 0) { |
| 18 | printf("name: %s\n", seq->name.s); |
| 19 | if (seq->comment.l) printf("comment: %s\n", seq->comment.s); |
| 20 | printf("seq: %s\n", seq->seq.s); |
| 21 | if (seq->qual.l) printf("qual: %s\n", seq->qual.s); |
| 22 | } |
| 23 | printf("return value: %d\n", l); |
| 24 | kseq_destroy(seq); |
| 25 | gzclose(fp); |
| 26 | return 0; |
| 27 | } |