agentsclimarketplace

Gcf assignment from distance matrix

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/gcf-assignment-from-distance-matrix

Use when when you have pre-computed BGC feature vectors (from domain architecture or other representations) and need to group them into functionally coherent GCFs for comparative analysis.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill gcf-assignment-from-distance-matrix

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

6.3 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it

GCF assignment from distance matrix

Summary

Assigns biosynthetic gene clusters (BGCs) to Gene Cluster Families (GCFs) by performing hierarchical or flat clustering on l2-normalized BGC feature vectors using cosine distance as the metric. This skill implements the distance-based grouping step that is central to the BiG-SLiCE v2 clustering pipeline.

When to use

When you have pre-computed BGC feature vectors (from domain architecture or other representations) and need to group them into functionally coherent GCFs for comparative analysis. Use this skill after feature extraction but before downstream comparative genomics or biosynthetic diversity profiling. Cosine-distance clustering is particularly suitable when BGC representations are sparse or high-dimensional.

When NOT to use

  • Input is already a pre-computed GCF assignment table or clustering result; use this skill only when starting from raw or normalized feature vectors.
  • BGC feature vectors have not been extracted yet; use domain annotation tools (e.g., antiSMASH, pyHMMER) first.
  • You require Euclidean distance clustering rather than cosine distance; this skill is optimized for normalized representations.

Inputs

  • BGC feature vectors (raw or pre-normalized)
  • BGC identifiers (e.g., antiSMASH output IDs)

Outputs

  • BGC-to-GCF mapping table (TSV format with BGC ID and GCF cluster ID columns)
  • GCF cluster assignments

How to apply

Load pre-computed BGC feature vectors into memory and apply l2-normalization to all vectors to convert Euclidean distances into cosine-like distances. Perform hierarchical or flat clustering on the normalized vectors using cosine distance as the metric, which measures the angle between normalized vectors rather than their magnitude. Assign each BGC to a GCF cluster based on the clustering result using a distance threshold appropriate to your biological context (typically guided by the dendrogram or silhouette analysis). Export the BGC-to-GCF mapping as a two-column TSV table with BGC identifier and GCF cluster ID. The rationale for l2-normalization is that it eliminates the magnitude component of feature vectors, allowing the distance metric to reflect only compositional similarity—important for BGCs with varying numbers of domains.

Related tools

  • BiG-SLiCE (Primary clustering engine that implements l2-normalization and cosine-distance-based hierarchical/flat clustering for GCF assignment) — https://github.com/medema-group/bigslice
  • pyHMMER (Fast HMMER3 bindings used by BiG-SLiCE v2 for profile-HMM domain annotation to generate input feature vectors) — https://github.com/althonos/pyhmmer
  • antiSMASH v7.0.0 (BGC detection and gene cluster definition tool; output is used as input for feature extraction and clustering)

Examples

bigslice -i <input_folder> <output_folder> && python -c "import sqlite3; conn = sqlite3.connect('<output_folder>/result.db'); cursor = conn.execute('SELECT bgc_id, gcf_id FROM bgc_to_gcf'); [print(f'{row[0]}	{row[1]}') for row in cursor.fetchall()]"

Evaluation signals

  • All BGCs receive exactly one GCF assignment; no missing or duplicate assignments.
  • l2-norm of each normalized feature vector equals 1.0 (or very close due to floating-point precision).
  • Cosine distances between vectors in the same GCF are consistently smaller than distances between vectors assigned to different GCFs (verify via silhouette coefficient or Davies–Bouldin index).
  • Output TSV is valid and parseable, with non-empty BGC ID and GCF ID columns for all rows.
  • GCF cluster IDs are contiguous integers or strings with no gaps or collisions.

Limitations

  • Clustering quality depends heavily on the quality and coverage of the input feature vectors; poor domain annotation upstream will degrade GCF assignments.
  • The choice of distance threshold or clustering algorithm (hierarchical vs. flat) is not explicitly specified in the source material; users must calibrate this based on their biological context.
  • No changelog or detailed algorithmic justification is available in the source documentation; the rationale for cosine distance is cited from an external publication (https://www.nature.com/articles/s41564-022-01110-2).
  • Scalability on very large BGC collections (>10^6 clusters) is not quantified; memory requirements for the normalized feature matrix may become prohibitive.

Evidence

  • [readme] Clustering now uses cosine-like (l2-normalized) distances: "Clustering now uses cosine-like (via l2-normalization) distances"
  • [other] Apply l2-normalization to enable cosine-like distance computation: "Apply l2-normalization to all feature vectors to enable cosine-like distance computation"
  • [other] Perform hierarchical or flat clustering on normalized vectors: "Perform hierarchical or flat clustering on the normalized vectors using cosine distance as the metric"
  • [other] Export BGC-to-GCF mapping as TSV table: "Export the BGC-to-GCF mapping as a TSV table with BGC identifier and GCF cluster ID columns"
  • [readme] Ability to export pre-calculated BGCs and GCFs into TSVs: "Ability to export pre-calculated BGCs and GCFs table into TSVs (use --export-csv parameter)"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.