Skip to content

Import tested code from ProteomIQon - #12

Merged
caroott merged 5 commits into
mainfrom
developer
Aug 30, 2026
Merged

Import tested code from ProteomIQon#12
caroott merged 5 commits into
mainfrom
developer

Conversation

@caroott

@caroott caroott commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

ProteomIQon has carried a local file (BioFSharp.Mz_Temp.fs) with newer versions of code that really belongs in this library. This PR moves those parts into BioFSharp.Mz. The code was moved verbatim, only namespaces and a few names were adapted. The versions moved here are the ones ProteomIQon's pipeline tools have been running in production, so where the two codebases had drifted apart, the ProteomIQon behavior wins.

What is new

SparsePeakArray (new module)
A sparse, binned representation of peak arrays with a dot product, used for fast spectrum similarity scoring. Comes from ProteomIQon, where ConsensusSpectralLibrary and SWATHAnalysis use it.

SearchDB: lookup by sequence and global modification
Two new functions (prepareSelectModsequenceBySequenceAndGMod and getThreadSafePeptideLookUpFromFileBySequenceAndGMod) that look up a ModSequence entry by its sequence and GlobalMod value. Until now the library only offered the mass range lookup. The quantification tools need the direct lookup.

FDRControl: PEP value machinery
Five functions for posterior error probability estimation (getLogisticRegressionFunction, createTargetDecoyHis, calculatePEPValues, logitTransformPepValues, initCalculateLin). One adaptation: initCalculateLin takes a plain trace: string -> unit callback instead of an NLog logger, so this library gains no logging dependency.

What changed in existing code

ProteinInference adopts the newer ProteomIQon behavior:

  • PSMInput reads its score from the ModelScore column (was PercolatorScore). This matches what PSMStatistics actually writes today.
  • createProteinModelInfoFromEntry reads the GFF3 ID attribute (was Name) and falls back to Forward for unknown strand characters. The old code crashed with a match failure on anything but + or -.
  • assignTranscriptsToGenes takes a parser function (string -> string option) instead of a regex pattern string.
  • isGene and isRNA are generic over the GFF line type.

Everything else (the MAYU FDR functions, the shared inference helpers) was compared function by function against the ProteomIQon versions and confirmed identical, so it stays as is.

@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.55947% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.62%. Comparing base (83d898a) to head (9bb2403).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/BioFSharp.Mz/FDRControl.fs 98.80% 1 Missing ⚠️
src/BioFSharp.Mz/SearchDB.fs 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #12      +/-   ##
==========================================
+ Coverage   70.46%   71.62%   +1.15%     
==========================================
  Files          42       44       +2     
  Lines       13317    13765     +448     
  Branches      778      795      +17     
==========================================
+ Hits         9384     9859     +475     
+ Misses       3928     3901      -27     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@caroott
caroott merged commit 2ea4929 into main Aug 30, 2026
6 checks passed
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