Repository navigation
fix(mudata): write empty strings for null gene names - #311
Conversation
An all-NULL gg_names column is inferred as float64, so h5py rejects var with "Can't implicitly convert non-string objects to strings" and mdata.write() fails. TMT datasets whose consensusXML carries no GN= descriptions hit this on every protein row (MSV000085836: 4.89M rows, all NULL), aborting the pipeline at the qpx conversion step after the data itself converted fine. Fill missing gene names with "" and coerce to str, as _load_run_obs already does for its string columns.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoHandle null protein gene names in MuData serialization
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can hide the parts of a finding you never read, like the evidence or the agent prompt |
Problem
mdata.write()fails withTypeError: Can't implicitly convert non-string objects to strings(h5py, writing keygene_nameof/var) whenever every protein lacks a gene name._build_protein_adatareadspg.gg_names[1], which is NULL when a protein has no gene. With a few nulls the column staysobjectand writes fine; when all values are NULL pandas infersfloat64(all NaN) and h5py refuses it.This is the norm for TMT datasets whose consensusXML carries no
GN=protein descriptions. Hit in production on MSV000085836 (TMT10, 552 raw files): all 4,891,140 protein rows had NULLgg_names, so the quantms pipeline aborted atQPX_OPENMSCONSENSUSafter ~80 min — on all three attempts, and after the parquet outputs had already been written correctly. Label-free runs were unaffected (e.g. PXD000396: genes on 111,195 of 111,235 rows).Fix
Fill missing gene names with
""and coerce tostr, mirroring what_load_run_obsalready does for its string columns.Test
test_protein_var_gene_names_serialise_when_every_gene_is_nullbuilds a pg bundle withgg_names=Noneand asserts the h5mu write succeeds. Verified it fails ondevwith exactly the production error and passes with the fix. Fulltests/unit/test_mudata.py: 23 passed.