void fastq_qualadj(FILE* fin, FILE* fout, int offset)
{
- fastq_t* fqf = fastq_open(fin);
- seq_t* seq = fastq_alloc_seq();
+ fastq_t* fqf = fastq_create(fin);
+ seq_t* seq = seq_create();
size_t i;
int c;
- while (fastq_next(fqf, seq)) {
+ while (fastq_read(fqf, seq)) {
for (i = 0; i < seq->qual.n; ++i) {
- c = (int) seq->qual.s[i] - offset;
+ c = (int) seq->qual.s[i] + offset;
c = c < 0 ? 0 : (c > 126 ? 126: c);
seq->qual.s[i] = (char) c;
}
fastq_print(fout, seq);
}
- fastq_free_seq(seq);
- fastq_close(fqf);
+ seq_free(seq);
+ fastq_free(fqf);
}
}
else if (offset == 0) offset = atoi(argv[optind++]);
- fprintf(stderr, "%d\n", offset);
-
FILE* fin;
if (optind >= argc || (argc - optind == 1 && strcmp(argv[optind],"-") == 0)) {