static void *worker(void *data) { worker_t *w = (worker_t *)data; for(size_t i = w->start; i < w->n; i+= w->step) { kseq_t *s = &kv_A(w->reads, i); aln_v result = align_read(s, w->ref_seqs, w->config); kstring_t str = { 0, 0, NULL }; write_sam_records(&str, s, result, w->ref_seqs, w->read_group_id, w->config->n_keep, w->config->max_drop); w->sams[i] = str; for(size_t j = 0; j < kv_size(result); j++) free(kv_A(result, j).cigar); kv_destroy(result); kseq_stack_destroy(s); } return 0; }
int main(int argc, char** argv) { char *align_file = NULL; if (argc != 2) { print_usage("Invalid number of arguments."); return 2; } align_file = argv[1]; int *alignment = NULL; int align_len = 0; HMMStateMap *state_hmm_map = NULL; int total_states = 0; FILE *fp = fopen(align_file, "rb"); align_len = align_read(&alignment, &total_states, &state_hmm_map, fp); fclose(fp); printf("Frame number: %d\n", align_len); for (int i = 0; i < align_len; i++) { printf("%d ", alignment[i]); } printf("\n"); printf ("Total states: %d\n", total_states); for (int i = 0; i < align_len; i++) { printf("%d(%d) ", state_hmm_map[alignment[i]].hmm_id, state_hmm_map[alignment[i]].hmm_state_id); } printf("\n"); return 0; }
int get_superblock(struct ext_superblock_t *sb, int fd, char *buf, uint32_t size, int fs) { int offset = align_read(fd, buf, SUPERBLOCKOFFSET, SUPERBLOCKSIZE, size, DOM0BLOCKSIZE); if (offset < 0) { printf("offset:%d\n", offset); return -1; } if (parse_superblock(sb, buf + offset, size - offset, fs) < 0) { printf("parse error\n"); return -1; } return 0; }
int aln_by_fingerprint(struct ALN_Options * op) { int tmp; tmp = format_Options(op); if(tmp < 0) return tmp; fprintf(stdout, "===> Dump parameters...%d\r\n", op->verbose & 0x80); if(op->verbose & 0x80) { dump_Options(op); } fprintf(stdout, "===> Load database...%d\r\n", op->verbose & 0x01); if(op->verbose & 0x01) { tmp = load_spt(op); if(tmp < 0) return tmp; } if((op->verbose & 0x07) == 0x07) { tmp = align_read_conflict(op); if(tmp < 0) return tmp; } if((op->verbose & 0x05) == 0x05) { tmp = align_read_debug(op); if(tmp < 0) return tmp; } fprintf(stdout, "===> Align reads...%d\r\n", (op->verbose & 0x03) == 0x03); if((op->verbose & 0x03) == 0x03) { tmp = align_read(op); if(tmp < 0) return tmp; } if(op->pt != NULL) free(op->pt); if(op->index != NULL) free(op->index); return 0; }