feat: fetch PRIDE spectra by USI via PROXI (MzSpectrum)#1099
Open
trishorts wants to merge 1 commit into
Open
Conversation
Adds spectrum access to the PRIDE client (capability after the merged manifest MVP smith-chem-wisc#1088 and file download smith-chem-wisc#1093). Given a USI, GetSpectrumAsync returns the peaks as an mzLib MzSpectrum; GetProxiSpectrumAsync returns the raw PROXI object, keeping the controlled-vocabulary attributes (charge, precursor m/z, ms level, scan number, instrument). - PrideProxiSpectrum DTO (status/usi/mzs/intensities/attributes), attributes reuse MzLibUtil.CvParam like PrideArchiveFile. - PrideArchiveExtensions.ToMzSpectrum: pure, offline peaks->MzSpectrum transform; defensively sorts a copy by ascending m/z (MzSpectrum assumes sorted, does not sort itself) and rejects a mzs/intensities length mismatch. - PROXI lives under a different path root than the v3 archive base, so the request uses an absolute URI (verified live: resultType=full returns a 1-element JSON array; unknown USI 404s, malformed USI 400s -> HttpRequestException). - Adds a MassSpectrometry project reference (no dependency cycle). - Tests: 16 offline (fixture-based) + live canary [Category(ExternalService)] +[Category(Pride)] routed through ExternalServiceTestHelper (skip-on-outage). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DZiz2D6dfQ55WetZpJSey2
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1099 +/- ##
=======================================
Coverage 91.50% 91.51%
=======================================
Files 439 440 +1
Lines 53542 53579 +37
Branches 6511 6519 +8
=======================================
+ Hits 48995 49031 +36
Misses 3275 3275
- Partials 1272 1273 +1
🚀 New features to boost your workflow:
|
zhuoxinshi
approved these changes
Jul 20, 2026
pcruzparri
approved these changes
Jul 20, 2026
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.
The nut
Given a USI (Universal Spectrum Identifier), fetch a spectrum from PRIDE and get it back as an mzLib
MzSpectrum— the next capability on the PRIDE client after the merged manifest MVP (#1088) and file download (#1093).What's here
New API on
PrideArchiveClient:GetSpectrumAsync(usi)→MzSpectrum— the common case: the spectrum's peaks as an mzLib spectrum.GetProxiSpectrumAsync(usi)→PrideProxiSpectrum— the raw PROXI object, keeping the controlled-vocabularyattributes(charge state, selected ion m/z, ms level, scan number, instrument) that anMzSpectrumcannot carry.Supporting pieces:
PrideProxiSpectrumDTO (status/usi/mzs/intensities/attributes); attributes reuseMzLibUtil.CvParam, exactly asPrideArchiveFiledoes.PrideArchiveExtensions.ToMzSpectrum()— a pure, offline peaks→MzSpectrumtransform (mirrors howGetHttpsDownloadUrlis a pure extension beside the networkedDownloadFileAsync).Design notes
/pride/proxi/archive/v0.1/vs/pride/ws/archive/v3/), so the request is issued as an absolute URI rather than resolving against the client's archiveBaseAddress.MzSpectrumassumes ascending m/z and validates nothing, soToMzSpectrumdefensively (a) rejects amzs/intensitieslength mismatch and (b) sorts a copy of the peaks (leaving the DTO's arrays untouched), constructing withshouldCopy: falseto avoid a redundant copy.MassSpectrometryproject reference toUsefulProteomicsDatabases(no dependency cycle —MassSpectrometrydepends only onChemistry+MzLibUtil).Verified against the live API
Probed the real endpoint before writing the DTO:
resultType=fullreturns a 1-element JSON array of{status, usi, mzs[], intensities[], attributes[cvParam]}; an unknown/unreadable USI returns 404 and a malformed USI 400, both surfacing asHttpRequestExceptionthrough the existing non-success path.Tests
ToMzSpectrumtransform incl. sort/length-mismatch/null/empty edges).[Category("ExternalService")]+[Category("Pride")], routed throughExternalServiceTestHelperso a PRIDE/EBI outage skips while a genuine contract break fails — same convention as test(ci): unify Koina under ExternalService; non-blocking live tests that skip on outage #1090/feat(usefulproteomicsdatabases): add PRIDE Archive REST client #1088/feat: download PRIDE Archive files over HTTPS + manifest helpers (stacked on #1088) #1093.🤖 Generated with Claude Code