smith-chem-wisc / MetaMorpheus

Proteomics search software with integrated calibration, PTM discovery, bottom-up, top-down and LFQ capabilities
MIT License
91 stars 46 forks source link

Write spectrum library from PsmTsv in MetaDraw #2295

Closed trishorts closed 1 year ago

trishorts commented 1 year ago

I'd like to be able to create library spectra in MetaDraw. For this to happen, we need to be able to use the info from PsmTsv to generate the spectrum. This PR adds a new method to PsmFromTsv called ToLibrarySpectrum() that produces the library spectrum object. Once you have a library spectrum object, you simply need to call the .ToString() method to get the .msp format.

I copied the pdf/png export code in MetaDraw and added a button in the gui that lets the user export any number of selected PSMs for immediate export into a spectrum library.

The output was tested both in metadraw and in search. The written libraries load into metadraw and produce spectral angles in search.

I did need to update psmtsv read to correctly accomodate child scans (MS3) for both crosslink and glyco. There was previously an error reading the scan intesnities.

codecov[bot] commented 1 year ago

Codecov Report

Merging #2295 (21e0495) into master (a39fe3f) will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2295   +/-   ##
=======================================
  Coverage   92.02%   92.02%           
=======================================
  Files         135      135           
  Lines       20606    20625   +19     
  Branches     2829     2831    +2     
=======================================
+ Hits        18962    18980   +18     
  Misses       1161     1161           
- Partials      483      484    +1     
Impacted Files Coverage Δ
MetaMorpheus/EngineLayer/PsmTsv/PsmFromTsv.cs 97.82% <100.00%> (-0.16%) :arrow_down:
...etaMorpheus/GuiFunctions/MetaDraw/MetaDrawLogic.cs 95.66% <100.00%> (+0.02%) :arrow_up:
...Morpheus/GuiFunctions/MetaDraw/MetaDrawSettings.cs 99.11% <100.00%> (ø)
trishorts commented 1 year ago

I feel like ToLibrarySpectrum should spit out a LibrarySpectrum object. Then you could call to string or whatever on that. If we ever change how spectral libraries are written, I don't want to have to edit multiple different ToLibrarySpectrum methods

that makes sense. It is done now.

trishorts commented 1 year ago

i broke this writing glyco spectrum library