LuminBench-Nano-ESMC-RAW / BUILD_RECIPE.md
jojo23333's picture
Initialize verified RAW 70%-cluster release metadata
afc0b49 verified
|
Raw
History Blame Contribute Delete
4.87 kB
# Reproducing the 70%-identity representative FASTAs
The canonical implementation is
[`dev/data/process_full_corpus.py`](https://github.com/Lumin-Science/LuminBench-Nano-ESMC/blob/main/dev/data/process_full_corpus.py).
All Python environments are managed by `uv`; MMseqs2 is invoked as a pinned
external binary and its version is recorded in each clustering receipt.
## 1. Pin and download the three source arms
| Source | Frozen input |
|---|---|
| UniRef90 | [UniRef release 2023_02 archive](https://ftp.uniprot.org/pub/databases/uniprot/previous_releases/release-2023_02/uniref/uniref2023_02.tar.gz), 211,819,312,677 bytes, MD5 `353681f464572bb199fa032f714d4669` |
| MGnify | [Protein DB 2023_02 `mgy_clusters.fa.gz`](https://ftp.ebi.ac.uk/pub/databases/metagenomics/peptide_database/2023_02/mgy_clusters.fa.gz), 83,473,342,442 bytes, MD5 `332d36d2a943bdb769237a03e050ed03` |
| OMG/IMG | All 959 Parquet objects in [`tattabio/OMG`](https://huggingface.co/datasets/tattabio/OMG), 1,253,813,127,320 bytes total, pinned by path, size, and LFS SHA-256 in [`dev/data/omg_upstream_shards.tsv`](https://github.com/Lumin-Science/LuminBench-Nano-ESMC/blob/main/dev/data/omg_upstream_shards.tsv) |
## 2. Normalize and quality-filter
For every record, in order:
1. remove whitespace and a terminal `*`;
2. uppercase the sequence;
3. map unsupported amino-acid characters to `X`;
4. reject sequences shorter than 60 residues;
5. reject sequences with more than 20% non-canonical residues; and
6. in the OMG payload, keep numeric JGI/IMG accessions and remove `ERZ` MGnify-
origin rows so MGnify is not represented twice.
The measured funnel was:
| Source | Original records | Short | >20% ambiguous | Wrong source | Quality eligible |
|---|---:|---:|---:|---:|---:|
| UniRef90 | 170,669,877 | 4,755,787 | 29,797 | 0 | 165,884,293 |
| MGnify | 729,215,663 | 117,372,608 | 26,021 | 0 | 611,817,034 |
| OMG/IMG | 3,280,269,924 | 145,672,826 | 0 | 1,048,850,563 | 2,085,746,535 |
## 3. Global exact deduplication
Accepted records are partitioned into 256 leading-byte SHA-256 buckets. Exact
normalized sequences are collapsed globally while preserving every
`(sha256, source, source_id)` membership in Parquet. A source-specific FASTA
view is then emitted for every source in which the sequence occurred.
The source views contain 165,884,293 UniRef90, 611,788,129 MGnify, and
963,673,186 OMG/IMG unique sequences. Their global union contains
1,661,993,387 exact unique sequences; source-view counts are larger because one
digest can belong to multiple source arms.
## 4. Source-specific diversity clustering
Each source view is clustered independently with MMseqs2 Linclust:
```text
mmseqs linclust sequences clusters tmp \
--min-seq-id 0.70 \
-c 0.80 \
--cov-mode 1 \
--cluster-mode 2 \
--threads 64
```
`--cov-mode 1` applies the 80% coverage requirement to the shorter sequence.
`createtsv` emits the representative/member digest pairs and `result2repseq`
plus `result2flat --use-fasta-header` emits the representative FASTA.
## 5. Reproduction commands
```bash
uv sync --frozen
PIPE=dev/data/process_full_corpus.py
ROOT=/absolute/path/to/protein-corpus
MMSEQS=/absolute/path/to/mmseqs
uv run --frozen python "$PIPE" download \
--data-root "$ROOT" \
--omg-manifest dev/data/omg_upstream_shards.tsv \
--download-workers 8
uv run --frozen python "$PIPE" normalize --source uniref90 \
--input "$ROOT/raw/uniref90_2023_02/uniref2023_02.tar.gz" \
--output "$ROOT/normalized/uniref90"
uv run --frozen python "$PIPE" normalize --source mgnify \
--input "$ROOT/raw/mgnify_2023_02/mgy_clusters.fa.gz" \
--output "$ROOT/normalized/mgnify"
# Expand all 959 OMG inputs from dev/data/omg_upstream_shards.tsv, then:
uv run --frozen python "$PIPE" normalize --source omg_img \
"${omg_inputs[@]}" --output "$ROOT/normalized/omg_img"
uv run --frozen python "$PIPE" deduplicate \
--input "$ROOT/normalized/uniref90" \
--input "$ROOT/normalized/mgnify" \
--input "$ROOT/normalized/omg_img" \
--output "$ROOT/deduplicated"
for source in uniref90 mgnify omg_img; do
uv run --frozen python "$PIPE" cluster \
--dedup-root "$ROOT/deduplicated" \
--source "$source" \
--output "$ROOT/clusters/$source" \
--mmseqs "$MMSEQS" \
--threads 64
done
```
Every output directory is create-once. The builder refuses to overwrite an
existing normalization, deduplication, or clustering directory.
## 6. Boundary of this RAW release
This release stops immediately after source-specific 70%-identity clustering.
It does not perform evaluation homology exclusion, exact evaluation exclusion,
cross-source representative ownership, length 32–16,384 filtering, validation
selection, or Parquet packing. Those steps produce the final
[`LuminBench-Nano-ESMC`](https://huggingface.co/datasets/LuminScience/LuminBench-Nano-ESMC)
release.