Structure similarity search

From GoogleCloudPlatform/LifeSciences · View interactive version

Structure similarity search is an AI agent skill from the GitHub repository GoogleCloudPlatform/LifeSciences. Search PubChem and ChEMBL for compounds structurally similar to a query (Tanimoto similarity) or containing a query substructure. Use when finding analogs of hits, checking structural novelty of a compound, identifying related compounds with known bioactivity or ADMET data, or surveying prior art fo

How to use this skill

Skill file

1. When to use, and when not

Use this skill when you need to find structurally related compounds

in public databases. Entry points include:

exploration.

inform a lead series.

Do not use when:

record -> compound-identity-resolution.

-> binding-mode-analysis.

-> compound-property-profile.

target-activity relationships -> bioactivity-landscape.

2. Preconditions

network call. Unparseable SMILES are refused (exit 9).

analyze subcommand is offline.

(default).

3. Tool invocations

| Question | Run | Writes to |

|---|---|---|

| What known compounds are structurally similar? | oase similar search <SMILES> [--source both] [--threshold <T>] [--max-results 20] | raw/compounds/<slug>.similar-<source>.json + .meta.json |

| What known compounds contain this substructure? | oase similar substructure <SMILES> [--source both] [--max-results 20] | raw/compounds/<slug>.substruct-<source>.json + .meta.json |

| What is the verdict? | oase similar analyze <SMILES> | raw/compounds/<slug>.similar.analysis.json |

Run search or substructure before analyze. analyze reads from

disk and applies the similar-search threshold set. No network.

--threshold applies to similarity search only. Substructure

containment is boolean, not scored -- there is no threshold to set.

Output options: --json, --quiet, --out on all three subcommands.

--from on analyze only.

4. Interpretation contract

Outcomes

analyze returns one of:

exact_match_cutoff threshold. The compound itself is in the

database.

tanimoto_similarity_cutoff threshold (but below exact_match_cutoff).

Structurally similar compounds exist.

is structurally novel with respect to the queried databases.

Substructure-only analyze always returns "novel." Substructure

hits do not carry Tanimoto scores (containment is not similarity).

When analyze reads a substructure artifact, all hits have

tanimoto: null, so max_tanimoto is 0.0 -- below every threshold.

This is correct behavior. If you need a similarity verdict, run

search (not substructure) first. Substructure results are useful

on their own for motif-based queries ("what compounds share this

pharmacophore?") but should not be piped through analyze for a

novelty verdict.

Exit codes

any network call). Change the input.

Mandatory relays

| Relay code | Kind | Fires when | Obligation |

|---|---|---|---|

| similar.tanimoto_is_2d_only | Qualifier (claim-triggered) | At least one hit returned (conditional) | Tanimoto similarity is computed from 2D fingerprints and reflects shared substructure topology, not 3D shape complementarity or biological activity. Two compounds with high Tanimoto may have very different binding modes, selectivity profiles, or ADMET properties. Do not equate structural similarity to functional similarity. |

| similar.database_coverage_limited | Qualifier (defect-triggered) | Always (unconditional) | PubChem and ChEMBL cover a fraction of chemical space. A compound with no similar hits may have close analogs in proprietary collections, patent literature, or databases not queried. Do not treat "novel by PubChem/ChEMBL" as "novel." |

The unconditional relay is justified: the novelty claim -- "nothing

like this exists" -- is the claim most likely to be over-read. The

relay converts a claim of absence into a scoped claim.

Consequence rules

Both relays fire (tanimoto_is_2d_only because hits exist,

database_coverage_limited unconditionally). An exact match on

2D fingerprint is necessary but not sufficient for identity --

confirm via compound-identity-resolution if needed.

Both relays fire (tanimoto_is_2d_only because hits exist,

database_coverage_limited unconditionally). The Tanimoto score

measures 2D topology, not biological function -- two compounds

with high Tanimoto may have very different activity profiles. The

similar compound's known properties are useful leads for

investigation, not conclusions.

database_coverage_limited always fires. tanimoto_is_2d_only

fires only when hits exist (novel-with-hits, where all scores

fell below the threshold). "Novel" means "not found in the

databases searched at the given threshold."

Threshold set: similar-search@1.0

Three thresholds (cite by name, never by value):

hits are not considered "similar." Configurable via --threshold

and program overrides. Not a scientific constant -- different

fingerprint types and radii produce different similarity

distributions. Quote thresholds_applied from the analysis

artifact to report the value in force.

same fingerprint is a necessary (not sufficient) condition for

identity.

similar?" is a program decision that depends on the patent

landscape, the therapeutic area, and the IP strategy. The tool

reports hits and their scores; the classification is the

specialist's. Do not invent a value for this threshold.

What this section produces

Following this contract produces a Layer 1 finding in findings/

that cites the .analysis.json, satisfies all mandatory relays, and

does not over-read a "novel" verdict. Everything the tools emitted

stays under raw/compounds/.

5. Failure modes and anti-fabrication guard

Do not compute these values yourself. The value is whatever the

tool emitted. If the tool did not run, there is no value. If a

required tool is unavailable, report the task as blocked. Do not

estimate, and do not proceed on an assumed result.

Named pathologies

compounds with high Tanimoto may have very different binding modes,

selectivity profiles, ADMET properties, and biological activity.

Structural similarity is a starting point for investigation, not a

conclusion about function.

cover a fraction of chemical space. Proprietary collections, patent

filings, unpublished compounds, and specialty databases are not

searched. A "novel" verdict means "not found here," not "does not

exist."

containment is a structural relationship ("does compound X contain

motif Y?"), not a similarity measure. Running analyze on

substructure-only results always returns "novel" because

substructure hits lack Tanimoto scores. Use similarity search for

novelty assessment.

tanimoto_similarity_cutoff boundary is a function of the threshold,

the fingerprint type, and the fingerprint radius, not a biological

truth. Different ECFP radii can shift the score for the same

compound pair.

UNRESOLVED by design. "How similar is too similar?" is a program

decision. Do not pick a number -- report the scores and let the

program decide.

6. Provenance

Databases queried:

and substructure endpoints use an asynchronous ListKey protocol (the

tool handles polling internally).

Similarity and substructure endpoints are synchronous with

pagination.

Both are public APIs with no authentication required. Rate limits are

enforced by the CLI.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.