int gt_merstatistics(const char *inputindex, GtUword mersize, GtUword minocc, GtUword maxocc, const char *storeindex, bool storecounts, bool scanfile, bool performtest, GtLogger *logger, GtError *err) { bool haserr = false; Sequentialsuffixarrayreader *ssar; gt_error_check(err); ssar = gt_newSequentialsuffixarrayreaderfromfile(inputindex, SARR_LCPTAB | SARR_SUFTAB | SARR_ESQTAB, (scanfile && !performtest) ? true : false, logger, err); if (ssar == NULL) { haserr = true; } if (!haserr) { if (enumeratelcpintervals(inputindex, ssar, storeindex, storecounts, mersize, minocc, maxocc, performtest, logger, err) != 0) { haserr = true; } } if (ssar != NULL) { gt_freeSequentialsuffixarrayreader(&ssar); } return haserr ? -1 : 0; }
int gt_tyr_occratio_func(const char *inputindex, bool scanfile, unsigned long minmersize, unsigned long maxmersize, GtArrayuint64_t *uniquedistribution, GtArrayuint64_t *nonuniquedistribution, GtArrayuint64_t *nonuniquemultidistribution, GtLogger *logger, GtError *err) { bool haserr = false; Sequentialsuffixarrayreader *ssar; gt_error_check(err); ssar = gt_newSequentialsuffixarrayreaderfromfile(inputindex, SARR_LCPTAB | SARR_SUFTAB | SARR_ESQTAB, scanfile ? SEQ_scan : SEQ_mappedboth, logger, err); if (ssar == NULL) { haserr = true; } if (!haserr) { if (computeoccurrenceratio(ssar, minmersize, maxmersize, uniquedistribution, nonuniquedistribution, nonuniquemultidistribution, logger, err) != 0) { haserr = true; } } if (ssar != NULL) { gt_freeSequentialsuffixarrayreader(&ssar); } return haserr ? -1 : 0; }
static int callenummaxpairs(const char *indexname, unsigned int userdefinedleastlength, bool scanfile, Processmaxpairs processmaxpairs, void *processmaxpairsinfo, GtLogger *logger, GtError *err) { bool haserr = false; Sequentialsuffixarrayreader *ssar; gt_error_check(err); ssar = gt_newSequentialsuffixarrayreaderfromfile(indexname, SARR_LCPTAB | SARR_SUFTAB | SARR_ESQTAB | SARR_SSPTAB, scanfile ? SEQ_scan : SEQ_mappedboth, logger, err); if (ssar == NULL) { haserr = true; } if (!haserr && gt_enumeratemaxpairs(ssar, gt_encseqSequentialsuffixarrayreader(ssar), gt_readmodeSequentialsuffixarrayreader(ssar), userdefinedleastlength, processmaxpairs, processmaxpairsinfo, err) != 0) { haserr = true; } if (ssar != NULL) { gt_freeSequentialsuffixarrayreader(&ssar); } return haserr ? -1 : 0; }
static int gt_readjoiner_cnttest_runner(GT_UNUSED int argc, GT_UNUSED const char **argv, GT_UNUSED int parsed_args, void *tool_arguments, GT_UNUSED GtError *err) { GtReadjoinerCnttestArguments *arguments = tool_arguments; GtEncseqLoader *el = NULL; GtEncseq *reads = NULL; GtBitsequence *bits = NULL; GtUword nofreads; int had_err = 0; gt_error_check(err); gt_assert(arguments); if (arguments->test == GT_READJOINER_CNTTEST_SHOWLIST) { GtStr *fn = NULL; fn = gt_str_clone(arguments->readset); gt_str_append_cstr(fn, GT_READJOINER_SUFFIX_CNTLIST); had_err = gt_cntlist_parse(gt_str_get(fn), true, &bits, &nofreads, err); gt_str_delete(fn); } else if (arguments->test == GT_READJOINER_CNTTEST_BRUTEFORCE || arguments->test == GT_READJOINER_CNTTEST_KMP) { el = gt_encseq_loader_new(); gt_encseq_loader_drop_description_support(el); gt_encseq_loader_disable_autosupport(el); if (!arguments->singlestrand) gt_encseq_loader_mirror(el); reads = gt_encseq_loader_load(el, gt_str_get(arguments->readset), err); if (reads == NULL) had_err = -1; else { gt_rdj_pairwise_exact(GT_OVLFIND_CNT, reads, !arguments->singlestrand, false, arguments->test == GT_READJOINER_CNTTEST_KMP, 1UL, true, NULL, NULL, false, NULL, &bits, &nofreads); } gt_encseq_delete(reads); gt_encseq_loader_delete(el); } else if (arguments->test == GT_READJOINER_CNTTEST_ESA) { Sequentialsuffixarrayreader *ssar = NULL; GtUword readlength = 0, firstrevcompl = 0; GtLogger *verbose_logger = gt_logger_new(arguments->verbose, GT_LOGGER_DEFLT_PREFIX, stderr); ssar = gt_newSequentialsuffixarrayreaderfromfile(gt_str_get( arguments->readset), SARR_LCPTAB | SARR_SUFTAB | SARR_SSPTAB, true, verbose_logger, err); if (gt_error_is_set(err)) had_err = -1; else { nofreads = gt_encseq_num_of_sequences(ssar->encseq); if (!arguments->singlestrand) { nofreads = GT_DIV2(nofreads); firstrevcompl = nofreads; } GT_INITBITTAB(bits, nofreads); if (!arguments->singlestrand) if (gt_encseq_accesstype_get(ssar->encseq) == GT_ACCESS_TYPE_EQUALLENGTH) readlength = gt_encseq_seqlength(ssar->encseq, 0); (void)gt_contfind_bottomup(ssar, false, bits, arguments->singlestrand ? 0 : firstrevcompl, readlength); } if (ssar != NULL) gt_freeSequentialsuffixarrayreader(&ssar); gt_logger_delete(verbose_logger); } else { gt_assert(false); } if (!had_err) had_err = gt_cntlist_show(bits, nofreads, NULL, false, err); gt_free(bits); return had_err; }