---
title: "Motif Discovery"
method: POST
path: "/motif_discover"
tags: ["Sequence"]
---

# Motif Discovery

`POST /motif_discover`

## Request

- Base URL: `https://seqbench.com/api/v1`
- URL: `https://seqbench.com/api/v1/motif_discover`
- Auth: none required

Find a motif NOBODY TYPED: given a set of sequences (multi-record FASTA), report the short pattern they share, as a consensus, a position-weight matrix and one site per sequence. This is the opposite question from motif_finder, which searches for a pattern you already have. Gibbs site sampler (Lawrence et al., Science 1993), one occurrence per sequence, both strands by default. ⚠️ READ `found` BEFORE THE CONSENSUS: a Gibbs sampler returns a motif from ANY input, including pure noise, because its objective has a maximum whether or not anything is there — so every run is scored against shuffled copies of the same sequences, which hold the same length and base composition and no arrangement. `found` is true only when the real alignment beats every shuffle outright AND clears the control mean by the margin in `control.zScore`; when it is false the consensus and sites are still returned, so you can see what was rejected. Measured: 0 of 20 pure-noise sets were reported as found, and a 10-mer planted in all 12 sequences was recovered exactly on 5 of 5 seeds. The sampler is deterministic — the same input gives the same answer, so a saved or shared result reproduces; pass a different `seed` to see whether the motif survives a different starting point, because one that does not is weak.

## Request body

- object
  - `sequences` string, required: Two or more sequences as multi-record FASTA. Records shorter than the motif width are left out and named in notes. At most 500 sequences and 100,000 residues in total.
  - `width` integer: Motif length in bases (4-30). The width is given rather than searched for: trying every width and keeping the best score would select on the same quantity the control measures, and a wider motif scores higher for free.
  - `bothStrands` boolean: Allow a site on either strand. A motif has no canonical orientation, so the consensus may come back as the reverse complement of the one you expect.
  - `seed` integer: Sampler seed. Fixed by default so one input gives one answer; change it to test whether the motif is stable.

## Response `200`

Tool ran successfully.

- SuccessResponse: Standard success envelope returned by every single-tool call.
  - `ok` unknown, required
  - `tool` string, required: The tool slug that ran.
  - `result` object, required: Tool-specific output object. Its shape depends on the tool — call `GET /{tool}` or see the docs for each tool's fields.
  - `gate` GateResult
    - `pass` boolean, required: True if and only if every hard check passed.
    - `checks` GateCheck[], required
      - `id` string, required
      - `label` string, required
      - `severity` 'hard' | 'soft', required
      - `pass` boolean, required
      - `message` string, required
      - `value` number
      - `threshold` string
    - `notChecked` string[], required: Honest list of what this gate does NOT verify.
  - `provenance` Provenance, required
    - `apiVersion` string, required
    - `tool` union, required: Tool slug, or an array of slugs (one per step) for a workflow.
      - string
      - string[]
    - `generatedAt` string, date-time, required: ISO 8601 timestamp of when the result was generated.

## Other responses

- `400`: Invalid argument or the tool could not run.
- `404`: Unknown tool.
- `429`: Rate limited (metered tools only). Body carries code `rate_limited` and retryable `true`; honor the Retry-After header.
- `503`: A metered tool is momentarily at capacity. The identical request should succeed after Retry-After; body carries code `upstream_unavailable`.

---

[API](https://skmtc.dev/seqbench/apis/seqbench-api.md) · [All operations](https://skmtc.dev/seqbench/apis/seqbench-api/llms.txt) · [OpenAPI document](https://skmtc.dev/seqbench/apis/seqbench-api/revisions/132575216865?raw)
