コード例 #1
0
ファイル: match_pattern.c プロジェクト: zachcp/Biostrings
void _match_pattern_XString(const Chars_holder *P, const Chars_holder *S,
		SEXP max_mismatch, SEXP min_mismatch,
		SEXP with_indels, SEXP fixed,
		const char *algo)
{
	int max_nmis, min_nmis, fixedP, fixedS;

	max_nmis = INTEGER(max_mismatch)[0];
	min_nmis = INTEGER(min_mismatch)[0];
	if (max_nmis < P->length - S->length
	 || min_nmis > P->length)
		return;
	fixedP = LOGICAL(fixed)[0];
	fixedS = LOGICAL(fixed)[1];
	if (P->length <= max_nmis || strcmp(algo, "naive-inexact") == 0)
		match_naive_inexact(P, S, max_nmis, min_nmis, fixedP, fixedS);
	else if (strcmp(algo, "naive-exact") == 0)
		match_naive_exact(P, S);
	else if (strcmp(algo, "boyer-moore") == 0)
		_match_pattern_boyermoore(P, S, -1, 0);
	else if (strcmp(algo, "shift-or") == 0)
		_match_pattern_shiftor(P, S, max_nmis, fixedP, fixedS);
	else if (strcmp(algo, "indels") == 0)
		_match_pattern_indels(P, S, max_nmis, fixedP, fixedS);
	else
		error("\"%s\": unknown algorithm", algo);
	return;
}
コード例 #2
0
static void test_match_pattern_indels(const char *p, const char *s,
		int max_nmis, const char *expected_matches)
{
	cachedCharSeq P, S;

	Rprintf("P=%s S=%s max_nmis=%d expected_matches=%s\n", p, s,
		max_nmis, expected_matches);
	P.seq = p;
	P.length = strlen(P.seq);
	S.seq = s;
	S.length = strlen(S.seq);
	_match_pattern_indels(&P, &S, max_nmis, 1, 1);
	return;
}
コード例 #3
0
static void test_match_pattern_indels(const char *p, const char *s,
		int max_nmis, const char *expected_matches)
{
	Chars_holder P, S;

	Rprintf("P=%s S=%s max_nmis=%d expected_matches=%s\n", p, s,
		max_nmis, expected_matches);
	P.ptr = p;
	P.length = strlen(P.ptr);
	S.ptr = s;
	S.length = strlen(S.ptr);
	_match_pattern_indels(&P, &S, max_nmis, 1, 1);
	return;
}