Function reference

Generated from functions.yaml by scripts/render_function_catalog.py.

Scalar options are positional: the stable C extension API has no named scalar arguments, so alphabet := 'dna' does not bind. Pass options in the order shown and omit trailing ones to use their defaults, for example sassy_matches('ACGT', text, 1, 'dna', false).

Function Kind Description
sassy_matches scalar Return every approximate match of one pattern in a text with at most k edits. alphabet is ‘dna’, ‘iupac’ or ‘ascii’; rc also searches the reverse complement; all_endpoints reports every qualifying endpoint instead of Sassy’s rightmost local minima; cigar_format is ‘text’, ‘packed’ or ‘both’.
sassy_matches_many scalar Search a panel of up to 4096 patterns in one text. Each hit carries the zero-based pattern_idx of the panel entry that produced it, so duplicate patterns stay distinct.
sassy_count scalar Count the matches sassy_matches would return, without building CIGAR strings.
sassy_count_many scalar Count the matches of every pattern in a panel, without building CIGAR strings.
sassy_contains scalar Return whether the text contains at least one match of the pattern with at most k edits.
sassy_contains_many scalar Return whether any pattern in the panel matches the text with at most k edits.
sassy_grep table Stream the matches of an ASCII pattern in one long text value, scanning overlapping 1 KiB regions and returning all qualifying endpoints. An outer LIMIT stops the scan once enough rows are produced.

CRISPR

Function Kind Description
sassy_crispr_matches scalar Find guide occurrences with at most k edits over the whole guide, including its trailing PAM. Hits must end in an exact IUPAC PAM match unless allow_pam_edits is true, and targets whose N fraction exceeds max_n_frac are dropped. Both strands are searched by default. cigar_format selects text, packed BAM operations, or both.
sassy_crispr_matches_many scalar Search a guide panel sharing the same PAM suffix; each hit carries the guide’s zero-based pattern_idx. Guides with different PAMs belong in separate rows or calls. cigar_format selects text, packed BAM operations, or both.

Diagnostics

Function Kind Description
sassy_backend_info table Report each SIMD backend (scalar, avx2, avx512, neon, wasm128): whether it is compiled into this build, supported by the running CPU, and selected. Selection happens on the first search.

sassy_matches

Return every approximate match of one pattern in a text with at most k edits. alphabet is ‘dna’, ‘iupac’ or ‘ascii’; rc also searches the reverse complement; all_endpoints reports every qualifying endpoint instead of Sassy’s rightmost local minima; cigar_format is ‘text’, ‘packed’ or ‘both’.

Signature:

sassy_matches(pattern, text, k[, alphabet[, rc[, all_endpoints[, cigar_format]]]])
-- Optional arguments are positional; defaults: alphabet = 'iupac', rc = true, all_endpoints = false, cigar_format = 'text'

Returns:

STRUCT(pattern_idx UBIGINT, text_start UBIGINT, text_end UBIGINT, pattern_start UBIGINT, pattern_end UBIGINT, cost INTEGER, strand VARCHAR, cigar VARCHAR, cigar_ops UINTEGER[])[]

Examples:

SELECT unnest(sassy_matches('ACGTAGG', 'TTACGTTGGAA', 1), recursive := true);
SELECT unnest(sassy_matches('error', 'errot: disk full', 1, 'ascii', false), recursive := true);
SELECT hit.text_start, hit.cigar, hit.cigar_ops
FROM (SELECT unnest(sassy_matches('ACGTAGG', 'TTACGTTGGAA', 1, 'dna', false, false, 'both')) AS hit);

sassy_matches_many

Search a panel of up to 4096 patterns in one text. Each hit carries the zero-based pattern_idx of the panel entry that produced it, so duplicate patterns stay distinct.

Signature:

sassy_matches_many(patterns, text, k[, alphabet[, rc[, all_endpoints[, cigar_format]]]])
-- Optional arguments are positional; defaults: alphabet = 'iupac', rc = true, all_endpoints = false, cigar_format = 'text'

Returns:

STRUCT(pattern_idx UBIGINT, text_start UBIGINT, text_end UBIGINT, pattern_start UBIGINT, pattern_end UBIGINT, cost INTEGER, strand VARCHAR, cigar VARCHAR, cigar_ops UINTEGER[])[]

Examples:

SELECT hit.pattern_idx, hit.text_start
FROM (SELECT unnest(sassy_matches_many(['ACGT', 'TTGC'], 'ACGTTTGCACGT', 0, 'dna', false)) AS hit);

sassy_count

Count the matches sassy_matches would return, without building CIGAR strings.

Signature:

sassy_count(pattern, text, k[, alphabet[, rc[, all_endpoints]]])
-- Optional arguments are positional; defaults: alphabet = 'iupac', rc = true, all_endpoints = false

Returns:

UBIGINT

Examples:

SELECT sassy_count('ACGT', 'ACGTNNACGT', 0, 'iupac', false);

sassy_count_many

Count the matches of every pattern in a panel, without building CIGAR strings.

Signature:

sassy_count_many(patterns, text, k[, alphabet[, rc[, all_endpoints]]])
-- Optional arguments are positional; defaults: alphabet = 'iupac', rc = true, all_endpoints = false

Returns:

UBIGINT

Examples:

SELECT sassy_count_many(['ACGT', 'TTGC'], 'ACGTTTGCACGT', 0, 'dna', false);

sassy_contains

Return whether the text contains at least one match of the pattern with at most k edits.

Signature:

sassy_contains(pattern, text, k[, alphabet[, rc[, all_endpoints]]])
-- Optional arguments are positional; defaults: alphabet = 'iupac', rc = true, all_endpoints = false

Returns:

BOOLEAN

Examples:

SELECT sassy_contains('ACGT', 'TTACGTT', 0), sassy_contains('ACGT', 'TTTT', 0);

sassy_contains_many

Return whether any pattern in the panel matches the text with at most k edits.

Signature:

sassy_contains_many(patterns, text, k[, alphabet[, rc[, all_endpoints]]])
-- Optional arguments are positional; defaults: alphabet = 'iupac', rc = true, all_endpoints = false

Returns:

BOOLEAN

Examples:

SELECT sassy_contains_many(['ACGT', 'GGGG'], 'TTACGT', 0, 'dna', false);

sassy_grep

Stream the matches of an ASCII pattern in one long text value, scanning overlapping 1 KiB regions and returning all qualifying endpoints. An outer LIMIT stops the scan once enough rows are produced.

Signature:

sassy_grep(pattern VARCHAR, text VARCHAR, k BIGINT)

Returns:

TABLE(text_start UBIGINT, text_end UBIGINT, cost INTEGER, cigar VARCHAR)

Examples:

SELECT * FROM sassy_grep('timeout', 'request timedout; retry timeout', 1);
SELECT text_start FROM sassy_grep('error', 'error: ' || repeat('ready ', 100000), 1) LIMIT 1;

sassy_crispr_matches

Find guide occurrences with at most k edits over the whole guide, including its trailing PAM. Hits must end in an exact IUPAC PAM match unless allow_pam_edits is true, and targets whose N fraction exceeds max_n_frac are dropped. Both strands are searched by default. cigar_format selects text, packed BAM operations, or both.

Signature:

sassy_crispr_matches(guide, text, k[, pam_length[, allow_pam_edits[, max_n_frac[, rc[, cigar_format]]]]])
-- Optional arguments are positional; defaults: pam_length = 3, allow_pam_edits = false, max_n_frac = 0.2, rc = true, cigar_format = 'text'

Returns:

STRUCT(pattern_idx UBIGINT, text_start UBIGINT, text_end UBIGINT, pattern_start UBIGINT, pattern_end UBIGINT, cost INTEGER, strand VARCHAR, cigar VARCHAR, cigar_ops UINTEGER[])[]

Examples:

SELECT unnest(sassy_crispr_matches('ACGTNGG', 'TTACGTAGGTT', 1), recursive := true);

sassy_crispr_matches_many

Search a guide panel sharing the same PAM suffix; each hit carries the guide’s zero-based pattern_idx. Guides with different PAMs belong in separate rows or calls. cigar_format selects text, packed BAM operations, or both.

Signature:

sassy_crispr_matches_many(guides, text, k[, pam_length[, allow_pam_edits[, max_n_frac[, rc[, cigar_format]]]]])
-- Optional arguments are positional; defaults: pam_length = 3, allow_pam_edits = false, max_n_frac = 0.2, rc = true, cigar_format = 'text'

Returns:

STRUCT(pattern_idx UBIGINT, text_start UBIGINT, text_end UBIGINT, pattern_start UBIGINT, pattern_end UBIGINT, cost INTEGER, strand VARCHAR, cigar VARCHAR, cigar_ops UINTEGER[])[]

Examples:

SELECT hit.pattern_idx, hit.text_start, hit.strand
FROM (SELECT unnest(sassy_crispr_matches_many(['ACGTNGG', 'TTTTNGG'], 'TTACGTAGGTT', 0)) AS hit);

sassy_backend_info

Report each SIMD backend (scalar, avx2, avx512, neon, wasm128): whether it is compiled into this build, supported by the running CPU, and selected. Selection happens on the first search.

Signature:

sassy_backend_info()

Returns:

TABLE(name VARCHAR, compiled BOOLEAN, supported BOOLEAN, selected BOOLEAN)

Examples:

SELECT * FROM sassy_backend_info();