Dry Lab

Logan query methods

How the 2,740,458-sequence Logan query was built from the nr catalytic domains, and how 5.57 billion DIAMONDx hits were turned into 3.20 billion unique ORFs, 1.74 billion with a significant HMM hit and 291,922,243 with a complete catalytic domain.

Why a second search, and why a smaller query?

To query the Logan contigs I need to hand over a fasta of the sequences I want searched, and the search costs money in proportion to what is in it. So the query is deliberately narrowed twice over: a sequence is only included if the HMMs say it has a complete catalytic domain — no empty catalytic residue positions — and only 90% identity centroids of those domains are kept.

That removes two kinds of waste. Sequences whose hit misses part of the catalytic machinery are off-target for our purposes, and searching accessory domains costs the same as searching catalytic ones while telling us nothing about plastic degradation.

Inputs

ComponentVersion usedNotes
HMMER3.4 (Aug 2023)hmmalign, hmmsearch
DIAMOND2.2.4linclust --id 90 --ext global --comp-based-stats 0
MMseqs2Release 18-8cc5ceasy-linclust, as an independent check on the clustering

The inputs are the 53 HMMs from the previous page and the significant nr hits from the nr search. Splitting the significant hits into per-component fastas first takes the search time from about ten hours down to about one.

Finding the catalytic domains in nr

Searching the HMMs against the nr homologs produces an annotation row per domain hit, carrying: the range the HMM hit, the identity of the amino acid found at each catalytic position, and a boolean for whether the hit is complete — a residue present in every catalytic position — or partial.

The 53 jobs ran in about 49 minutes and returned 9,468,263 domain-hit rows across 7,562,453 unique accessions, before any deduplication or completeness filter. Reducing each accession to its single lowest-E-value hit leaves 7,562,397 accessions, of which 7,561,905 are written out as the PETadex-nr proteins.

Cutting the domains out

For every hit that survives, the full sequence is looked up in its component's database fasta and only the amino acids from the HMM start to the HMM end are written. The envelope convention matters if you are reproducing this, because it is the easiest thing to get wrong:

domain_seq = sequence[hmm_target_start - 1:hmm_target_end]   # 1-based, inclusive

Hits annotated as incomplete are dropped before this step, which leaves 6,764,617 complete nr catalytic domains plus 486 from PETadex-PAZy, spread over 46 component fastas.

Clustering to the Logan query

Those domains are then clustered at 90% identity with DIAMOND linclust, globally rather than locally, so that a member has to align across its whole length to its centroid. The centroids are the Logan query: 2,740,458 sequences.

Checking DIAMOND against MMseqs2

Clustering with one tool and trusting the count is a good way to overstate how many distinct sequences you have, so I re-clustered the same input with MMseqs2 and matched the parameters as closely as the two tools allow:

MMseqs2 parameterWhat it doesDIAMOND equivalent
easy-linclustlinear-time clusteringlinclust
--min-seq-id 0.9a member must share 90% identity with its centroid--id 90
-c 0.9 --cov-mode 0the alignment must cover 90% of both centroid and member, mimicking a global alignment--ext global
--alignment-mode 3computes the full alignment, including sequence identityfull alignment
--seq-id-mode 0identity calculated over the alignment lengthidentity over the alignment
--comp-bias-corr 0turns off composition-bias correction--comp-based-stats 0

Over the same 6,765,103 input domains, DIAMOND produces 2,740,458 clusters and MMseqs2 2,793,566 — a ratio of 0.981, so DIAMOND is making slightly fewer clusters, not inflating the count by splitting. Singletons come out at 1,846,170 against 1,911,582. The one real difference is the largest cluster: 10,229 sequences under DIAMOND against 5,250 under MMseqs2.

Figure 1. Cluster size distribution for the same 6.77 million catalytic domains under DIAMOND linclust and MMseqs2 easy-linclust. The curves lie close enough together that the DIAMOND cluster count is not an artefact of splitting.

The nr quality-control funnel

Laid out end to end, the nr side of the pipeline narrows like this:

StepSequences
Significant DIAMOND hits from nr7,825,107
With a significant HMM hit7,562,397
With a residue in every catalytic position6,857,617
With the canonical residue in every position6,343,582
90% identity centroids — the Logan query2,740,458

Two side counts are worth keeping: 31,498 sequences have two or more catalytically complete domain hits, and 79,405 have only incomplete hits that nevertheless complement each other on the catalytic residues — one hit covering positions 1 and 2, another covering position 3.

Figure 2. The nr quality-control funnel, from 7,825,107 significant DIAMOND hits down to the 2,740,458 centroids that make up the Logan query.

Rayan Chikhi ran the DIAMONDx search of that query against the Logan contigs and returned the results: about 10 TB, or 2.6 TB compressed, as 100 .zst files. I worked through them one at a time.

The raw search returned 5,573,419,026 DIAMONDx rows, independently counted three ways — by a bash row count over the compressed files, by the parser, and in the parquet — which all agree. 2,714,983 of the 2,740,458 query sequences got at least one hit, and 16,725,463 hits are reported with an E-value of exactly 0.

Turning contig hits into ORFs

Logan returns contigs, not proteins, so each hit has to be turned into an open reading frame. For every row the pipeline cleans the header into TSV, records it in a parquet, then calls the ORF stop-to-stop on the DNA and finds the frame whose translation exactly contains the reported hit region. Three cases come out of that:

  • No internal stop — one ORF.
  • An internal stop splits the hit into two valid ORFs, both at least 30 aa — both are kept.
  • An internal stop splits the hit but only one side is valid — the piece under 30 aa is dropped, because it is not a protein.

That gives 5,780,630,372 ORF pieces written to the component fastas: more pieces than there were hits, because 159,279,814 hits were split on an internal stop, while 395,454,341 pieces were dropped for being under 30 aa. No hit failed to have its frame found. The resulting ORFs run from the 30 aa floor to a median of 96 aa, with a mean of 150.9 aa.

Collapsing identical ORFs

nr is 100% non-redundant by construction, so the Logan set is made to match. Within each component, sequences are deduplicated by exact string match, hits above the 1 × 10⁻⁵ cutoff are dropped, and the record keeps its lowest-E-value accession first with every duplicate accession listed after it.

5,780,630,372 ORF pieces collapse to 3,202,954,878 unique sequences, a ratio of 1.80. The most repeated single ORF was found 784,796 times.

Figure 3. How many ORF pieces collapsed onto each unique sequence. Most are seen once, but the tail is long: the most repeated ORF appears 784,796 times.

Running 53 HMMs over 3.2 billion ORFs

The deduplicated set is sharded 100 ways per component, so the HMM search is 5,300 jobs — 53 HMMs across 100 shards — run 40 at a time. The whole search finished inside 46 minutes, with the reduce step across sub-components and shards taking another 37. Every job completed; none were killed.

Each sequence with a significant hit is assigned a petadex_id of the form LG{integer}, and the annotations carry the same fields as the nr pass: the hit range, the residue identity at each catalytic position, and whether the hit is complete or partial.

Extracting the Logan catalytic domains

Extraction follows the nr logic exactly. Every LG id is reduced to its single lowest-E-value hit across every sub-component and domain, its full-length record is written out, and only if that winning hit is complete is the catalytic domain written to the precluster fasta.

That last condition is worth being explicit about: a sequence whose best hit is incomplete is not clustered even if another of its hits is complete. 291,922,243 sequences pass that best-hit test, while 297,915,422 have a complete hit somewhere — the 5,993,179 difference is counted separately as complete_hit_lost_to_better_incomplete_hit.

The Logan quality-control funnel

StepSequences
ORF pieces written by the parser5,780,630,372
Unique ORFs after 100% deduplication3,202,954,878
With a significant HMM hit1,740,282,847
With a residue in every catalytic position297,915,422
With the canonical residue in every position271,597,707
Precluster catalytic domains (best hit complete)291,922,243

As on the nr side, 144,319 sequences have two or more complete, non-overlapping domain hits and 5,348,968 have only incomplete hits that complement each other.

Figure 4. The Logan quality-control funnel. 5.78 billion ORF pieces become 3.20 billion unique sequences, 1.74 billion with a significant HMM hit, and 291,922,243 whose best hit covers the whole catalytic domain.

Complete, truncated, or genuinely partial

1,442,367,425 sequences have a significant hit but no complete catalytic domain, and it matters a great deal whether that is because the protein is divergent or because the assembly ran out. A hit counts as a truncation when the missing catalytic positions are explained by the ORF ending: catalytic sites are ordered by HMM column, and if the missing sites fall before the first present site the hit has to start within 10 residues of the N-terminus, or after the last present site it has to end within 10 residues of the C-terminus.

On that rule, 1,190,913,159 are truncations and 251,454,266 are not — so the large majority of incomplete hits are assembly artefacts rather than proteins that genuinely lack the machinery.

Figure 5. Distance from each significant HMM hit to the nearer end of its ORF, complete against partial hits, with the 10-residue truncation threshold marked. Partial hits pile up hard against the terminus, which is what a truncation looks like.
Figure 6. One point per HMM: model length and the span between the first and last catalytic residue, against how many Logan sequences get a complete hit. The wider a model's catalytic span, the smaller the share of hits that can cover all of it.

That last figure is the honest summary of the whole exercise: completeness is partly a property of the enzyme family, not only of the assembly. An HMM whose catalytic residues are spread far apart needs a longer uninterrupted ORF to be satisfied, so its completeness rate will always look worse.

Limitations

  • The Logan E-values are on an nr-sized scale. See the caveat above. Everything downstream of the 1 × 10⁻⁵ cutoff inherits it.
  • The search parameters are not recorded on our side. Until they come from Rayan Chikhi, this page cannot state the sensitivity, the hit limit or the Logan release it describes.
  • Contig-level statistics are not reported here. The parquet gives a mean of 1.00 hits per contig and zero contigs with more than one hit, which cannot be right; the contig key needs checking first.
  • Best-hit extraction discards complete hits. 5,993,179 sequences have a complete catalytic domain that is not clustered, because a better-scoring incomplete hit won the record.
  • The HMMs carry their own limits forward, including the four sub-components with no model and the non-hydrolase regions still inside some envelopes.

What is still to come

The Logan catalytic domains are not yet clustered. The precluster count above stands in for what will eventually be the Logan 90% identity centroids, so the corpus is not final and the numbers on this page are the state of a draft notebook rather than a finished stage. Clustering across the nr and Logan domains together is the next step.

Reproducing

# 1. search the HMMs against the nr homologs, per component, and annotate
#    hit ranges, catalytic residue identities and completeness
./hmm_search.sh --hmms petadex_hmms/ --targets per_component/ --evalue 1e-5

# 2. extract complete catalytic domains, then cluster at 90% identity, globally
diamond linclust -d nr_catalytic_domains.fastaa -o clusters.tsv \
  --id 90 --ext global --comp-based-stats 0

# 3. after the Logan search returns, parse each .pro.zst into ORFs, dedup at
#    100% identity, shard, then search the same HMMs over the shards
./logan_hmm_search.sh --shards per_component_shards/ --jobs 40 \
  --total-search-size 1101054423   # nr-sized Z — see the caveat above