Skip to content

Making max_seq_count actually truncate parsed MSAs#308

Open
Pana-TsK wants to merge 2 commits into
aqlaboratory:mainfrom
Pana-TsK:main
Open

Making max_seq_count actually truncate parsed MSAs#308
Pana-TsK wants to merge 2 commits into
aqlaboratory:mainfrom
Pana-TsK:main

Conversation

@Pana-TsK

Copy link
Copy Markdown

Summary

Behavior change: Previously all parsed sequences were kept. The final MSA-rows feature was then bounded by the downstream max_rows (16384) subsampling, but the profile and deletion-mean features are computed on the full pre-subsample MSA (main_msa_redundant), so they were never bounded. This fix therefore changes those features for any chain whose source MSAs exceed their caps, and also changes which databases populate the max_rows budget. Chains with shallow MSAs (already under every cap) are unaffected.

parse_a3m() and parse_stockholm() called MsaArray.truncate() without inplace=True, leading to Msa truncation being calculated, but set to return a new MsaArray object, which was then discarded.

Additionally, The method also constructed a ValueError without ever raise-ing it (the same discarded-expression bug), so a wrong-typed input passed silently instead of erroring, which I removed. The line row_slice = slice(min(row_slice.stop, self.__len__())) is redundant. It attempts to clamp the count so the caller can never ask for more rows than exist, but numpy and pandas already clamp out-of-range slices, indexing past the end just returns everything, without error. the regression test test_truncate_over_length_keeps_all_rows covers this.

Changes
parse_a3m() and parse_stockholm() now use inplace=True, so the methods return truncated MSAs as intended. Additionally, the mentioned valueError has been deleted (it would never fire), the line row_slice = slice(min(row_slice.stop, self.__len__())) has also been deleted.

Testing
AI-generated regression tests (simple, easy to check & reason about), have been written, to show that this issue was real and now has been resolved.

Pana-TsK added 2 commits July 12, 2026 17:26
parse_a3m and parse_stockholm called MsaArray.truncate() without
inplace=True and discarded the returned copy, so max_seq_count was a
no-op and every sequence was kept. Pass inplace=True so the cap applies,
and simplify MsaArray.truncate's row_slice handling (drop the never-raised
ValueError and the redundant bounds clamp, which numpy/pandas already do).
Add regression tests for both parsers and for truncate's int/slice paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant