static int hmmsearch_call_coarse_search(GtCondenseq* ces, char *hmmsearch_path, char *table_filename, char *hmm_filename, GtLogger *logger, GtError *err) { int had_err = 0; char **hmmargs = NULL, *hmmenv[] = { NULL }; GtStr *coarse_fas = gt_condenseq_unique_fasta_file(ces); GtSafePipe *pipe = NULL; gt_assert(coarse_fas != NULL); /* Array has to end with NULL */ hmmargs = gt_calloc((size_t) 8, sizeof (*hmmargs)); hmmargs[0] = hmmsearch_path; hmmargs[1] = gt_cstr_dup("--noali"); hmmargs[2] = gt_cstr_dup("--notextw"); hmmargs[3] = gt_cstr_dup("--domtblout"); hmmargs[4] = table_filename; hmmargs[5] = hmm_filename; hmmargs[6] = gt_str_get(coarse_fas); gt_logger_log(logger, "calling: %s", hmmsearch_path); pipe = gt_safe_popen(hmmsearch_path, hmmargs, hmmenv, err); if (pipe == NULL) had_err = -1; gt_free(hmmargs[1]); gt_free(hmmargs[2]); gt_free(hmmargs[3]); gt_free(hmmargs); gt_str_delete(coarse_fas); /* pipe test for splint */ if (!had_err && pipe != NULL) { if (gt_log_enabled()) { GtStr *line = gt_str_new(); while (gt_str_read_next_line(line, pipe->read_fd) == 0) { gt_log_log("%s", gt_str_get(line)); gt_str_reset(line); } gt_str_delete(line); } (void) gt_safe_pclose(pipe); } return had_err; }
int gt_hcr_encoder_encode(GtHcrEncoder *hcr_enc, const char *name, GtTimer *timer, GtError *err) { int had_err = 0; GtStr *name1; gt_error_check(err); if (timer != NULL) gt_timer_show_progress(timer, "write encoding", stdout); if (hcr_enc->encdesc_encoder != NULL) { GtCstrIterator *cstr_iterator = gt_fasta_header_iterator_new(hcr_enc->files, err); had_err = gt_encdesc_encoder_encode(hcr_enc->encdesc_encoder, cstr_iterator, name, err); gt_cstr_iterator_delete(cstr_iterator); } if (!had_err) had_err = hcr_write_seq_qual_data(name, hcr_enc, timer, err); if (!had_err && gt_log_enabled()) { name1 = gt_str_new_cstr(name); gt_str_append_cstr(name1, HCRFILESUFFIX); gt_log_log("sequences with qualities encoding overview:"); gt_log_log("**>"); if (hcr_enc->page_sampling) gt_log_log("applied sampling technique: sampling every " GT_WU "th page", hcr_enc->sampling_rate); else if (hcr_enc->regular_sampling) gt_log_log("applied sampling technique: sampling every " GT_WU "th read", hcr_enc->sampling_rate); else gt_log_log("applied sampling technique: none"); gt_log_log("total number of encoded nucleotide sequences with qualities: " GT_WU, hcr_enc->num_of_reads); gt_log_log("total number of encoded nucleotides: " GT_LLU, hcr_enc->seq_encoder->total_num_of_symbols); gt_log_log("bits per nucleotide encoding: %f", (gt_file_estimate_size(gt_str_get(name1)) * 8.0) / hcr_enc->seq_encoder->total_num_of_symbols); gt_log_log("<**"); gt_str_delete(name1); } return had_err; }
static void globalchaining_generic(bool maxscore_chains, unsigned long max_gap_width, GtFragment *fragments, unsigned long num_of_fragments, unsigned long seqlen1, double mincoverage, GtChainProc chainprocessor, void *cpinfo) { Overlapinfo *overlapinfo = NULL; GtChaininfo *chaininfo; GtChain *chain; chain = gt_chain_new(); chaininfo = gt_malloc(sizeof (GtChaininfo) * num_of_fragments); if (gt_log_enabled()) log_fragments(fragments, num_of_fragments); if (num_of_fragments > 1UL) { /* compute chains */ if (!maxscore_chains) { overlapinfo = gt_malloc(sizeof (Overlapinfo) * num_of_fragments); initoverlapinfo(overlapinfo, fragments, num_of_fragments); } bruteforcechainingscores(chaininfo, max_gap_width, fragments, num_of_fragments, overlapinfo); if (maxscore_chains) { findmaximalscores(chain, chaininfo, fragments, num_of_fragments, max_gap_width, chainprocessor, cpinfo); } else { findmaximalscores_withoverlaps(chain, chaininfo, fragments, num_of_fragments, max_gap_width, seqlen1, mincoverage, chainprocessor, cpinfo, overlapinfo); gt_free(overlapinfo); } } else { chainingboundarycases(chain, fragments, num_of_fragments); if (maxscore_chains || ((double) GETSTOREDLENGTH(1, 0) / (double) seqlen1) >= mincoverage) { chainprocessor(chain, fragments, num_of_fragments, max_gap_width, cpinfo); } } gt_free(chaininfo); gt_chain_delete(chain); }