Repository navigation
Phase 2: proteomics reading, filtering and unit conversion - #4
Merged
Merged
Conversation
filter_prot_data ports GECKO 2's filter_ProtData: a protein is kept when it is detected in two thirds of the replicates and its relative standard deviation is below 1, and is represented by mean + 1.96 SD rather than by its mean. A protein with a missing replicate is dropped, because its spread cannot be evaluated. Abundances are converted from mmol/gDW to mg/gDW with UniProt molecular masses, which covers every measured protein and removes the mean-mass fallback the MATLAB implementation used for proteins outside the model. P61830 is listed once per gene of the duplicated histone; the reader collapses it and fails if the rows ever disagree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3 — review that one first; this diff is only the new data layer.
What changed
src/overflow/proteomics.py— reading, the replicate quality filter,mmol/gDW → mg/gDW conversion, the f-factor and the protein-content
rescaling.
data/uniprot.tsv— vendored molecular masses (GECKOdevelop4,same commit as the models), covering all 2928 measured proteins.
tests/test_proteomics.py— 31 tests.The filter is checked against MATLAB's own output, not just described
filter_ProtDatareportsmean + 1.96·SD, not the replicate mean — easyto get wrong, and invisible afterwards. The legacy
results/modelGeneration/modifiedEnzymes_*.txtfiles record the abundancesthe MATLAB run carried forward, so they pin the filter exactly:
before integration, so every entry is raw filter output.
intervene, and are strictly higher in the legacy file where it did — the
test asserts that direction, so a filter that drifted downward would fail.
Two data issues found
P61830is on two rows (the duplicated histone, one row per gene) withidentical values. The reader collapses it and raises if duplicated rows ever
disagree, rather than letting pandas return a DataFrame where a Series was
expected.
stdpropagates NaN, sosuch a row can never pass the variability test — the
2/3presence checkabove it only ever fires on explicit zeros. Substituting 0 for NaN, which is
the natural Python reading, would keep those proteins with a downward-biased
abundance. Ported faithfully and tested.
Filter output
Measured mass lands at 72–86% of the stated protein content, which is what a
correct unit conversion should look like. A test brackets this per condition,
so a unit slip fails loudly rather than propagating into enzyme constraints.
Deliberate fidelity choices
Ptot * sumPfilt/sumPis a molar ratio in the original, nota mass ratio, and is ported as such. Because the filter reports
mean + 1.96·SD, the kept fraction exceeds one and the protein contentscales upwards — visible in the table above. Preserved rather than
"corrected".
covers more proteins than the filtered set. A test asserts it agrees with
geckopy's
calculate_f_factorto 1e-12.