Repository navigation
refactor(transforms): map genes from the FASTA only, drop biopython and mygene - #312
Conversation
…nd mygene Gene mapping needed two optional dependencies for work the FASTA already carries. biopython only iterated records so the GN= field could be read from the header, and mygene queried MyGene.info for genomic accessions, which is what --species was for. Neither ships in the published container (the Dockerfile installs a bare `pip install .`), so `qpxc transform gene-map` could not run there at all: importing Bio raised, and the MyGene lookup silently returned nothing. Parse the headers directly instead. Only header lines are read, sequences are skipped, and .gz is opened transparently, so the mapping is offline, reproducible and faster on large databases. gg_accessions is no longer overwritten from the API — a converter's value survives, and the column is created as NULL when absent. Removes the [transforms] extra, the --species option, and the fetch_accessions / include_accessions arguments.
|
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 QodoParse gene mappings directly from FASTA headers
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 12 |
| 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
1. Git install guidance names a dead extra
|
| [project.optional-dependencies] | ||
| mzidentml = ["lxml>=4.9.0"] | ||
| pdc = ["pridepy>=0.0.15"] | ||
| transforms = ["biopython", "mygene>=1.0.0"] |
There was a problem hiding this comment.
1. Git install guidance names a dead extra 🐞 Bug ⚙ Maintainability
Removing the transforms entry from project.optional-dependencies leaves the README's Git installation command requesting qpx[quantify,transforms,plotting]. Users following that command request an undefined extra and are incorrectly told that transforms still require optional installation.
Agent Prompt
## Issue description
The optional `transforms` extra was removed, but the README's Git installation example still requests it.
## Fix Focus Areas
- README.md[84-90]
- pyproject.toml[34-40]
## Recommended Fix
Remove `transforms` from the README's optional-extras command, leaving only extras that remain declared in `pyproject.toml`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
gene-map only took a single parquet, so annotating a converted dataset meant calling it per file and left the .h5mu describing the genes the converter wrote, not the ones just mapped. --dataset annotates every quantification view that carries protein accessions (pg and feature), preserving each file's identity recipe so pg_id / feature_id do not change, then rebuilds the MuData view when the dataset has one. Writes go through a staging directory, so --in-place never truncates a parquet that is still being read. The converters' best-effort h5mu writer moves to qpx.mudata.write_dataset_mudata so both paths refresh the view the same way; BaseOrchestrator._write_mudata delegates to it.
Codacy flagged two new issues: the dataset helper carried 13 branches (12 max) and the new pg log used an f-string. Extract the copy, view-annotation and mudata-refresh steps into their own functions, and pass log arguments lazily here and in the three surrounding messages. No behaviour change.
Follow-up to #311, which stopped a null gene column from killing the h5mu write. This removes the reason the column was empty in the first place being hard to fix:
gene-mapcould not run where we needed it.Why
qpxc transform gene-mapneeded two optional dependencies for work the FASTA already carries:GN=could be read from the header.--specieswas for; it never affected gene names.Neither ships in the published container: the Dockerfile runs a bare
pip install .with no extras. Verified inghcr.io/bigbio/qpx:1.1.3on our cluster —import BioraisesModuleNotFoundError, so the command cannot run there, and the MyGene lookup would fail soft and return nothing.A single
--speciesis also wrong for the databases we search (human + contaminants, sometimes human+mouse entrapment), so any accessions fetched would be partly wrong.What
Parse the FASTA headers directly. Only header lines are read (sequences skipped) and
.gzopens transparently, so mapping is offline, reproducible, and faster on large databases.gg_accessionsis no longer overwritten from the API: a value written by a converter survives, and the column is created as NULL when absent.Removed: the
[transforms]extra (withbiopythonandmygene), the--speciesoption, and thefetch_accessions/include_accessionsarguments.Tests
Four new tests cover header shapes (three-field, two-field, bare), entries without
GN=, gzip input, and that existinggg_accessionssurvives annotation. Full unit suite: 227 passed.