What happens
CARDINALITY on an MS1 condition raises KeyError: 'mzenumeration'. The same qualifier
on the equivalent MS2 condition works.
QUERY scaninfo(MS1DATA) WHERE MS1MZ=(100 OR 200):CARDINALITY=range(min=2, max=2)
KeyError: 'mzenumeration'
Why
_merge_filter_cardinality in massql/msql_engine_filters.py groups on that column:
enumeration_df = ms_peak_df.groupby(["scan", "mzenumeration"]).first().reset_index()
The MS2 path sets it before appending each per-value frame:
ms2_filtered_df["mzenumeration"] = i
The MS1 path (ms1_condition) has no equivalent assignment, so the column never exists by
the time the merge reads it.
Suggested fix
Set ms1_filtered_df["mzenumeration"] = i in the MS1 loop, mirroring the MS2 path.
The same gap is in ms2prec_condition
ms2prec_condition also appends a per-value frame without setting mzenumeration, so a
multi-valued MS2PREC carrying CARDINALITY should reach the same KeyError. Grepping the
three condition functions for the assignment finds it only in the MS2 product path. I read
that one rather than running it, so it is worth confirming before fixing.
What happens
CARDINALITYon an MS1 condition raisesKeyError: 'mzenumeration'. The same qualifieron the equivalent MS2 condition works.
Why
_merge_filter_cardinalityinmassql/msql_engine_filters.pygroups on that column:The MS2 path sets it before appending each per-value frame:
The MS1 path (
ms1_condition) has no equivalent assignment, so the column never exists bythe time the merge reads it.
Suggested fix
Set
ms1_filtered_df["mzenumeration"] = iin the MS1 loop, mirroring the MS2 path.The same gap is in
ms2prec_conditionms2prec_conditionalso appends a per-value frame without settingmzenumeration, so amulti-valued
MS2PRECcarryingCARDINALITYshould reach the sameKeyError. Grepping thethree condition functions for the assignment finds it only in the MS2 product path. I read
that one rather than running it, so it is worth confirming before fixing.