Issue 807: Fix/Improve File > Export > Spectral Library

issues
Status:resolved
Assigned To:Brendan MacLean
Type:Defect
Area:Skyline
Priority:3
Milestone:21.2
Opened:2021-05-12 by Brendan MacLean
Changed:2022-03-08 by Kaipo Tamura
Resolved:2022-03-08 by Kaipo Tamura
Resolution:Fixed
Closed:
2021-05-12 Brendan MacLean
Title»Fix/Improve File > Export > Spectral Library
Assigned To»Kaipo
Notify»bsearle;searleb
Type»Defect
Area»Skyline
Priority»3
Milestone»21.2
Based on a request from Brian Searle, I have reviewed the code for File > Export > Spectral Library and found:
1. It always exports the first spectrum (chrom info) for a precursor instead of the "best"
2. The way Skyline currently calculates the "best" has not been updated since we moved from LegacyScore
3. There is UI code in the Model class for doing the export which needs to be moved to a UI folder

For 1, we should change the code to be something like this:
            SpectrumMzInfo spectrumMzInfo;
            var isBest = replicateIndex == nodePep.BestResult;
            if (!spectra.TryGetValue(key, out spectrumMzInfo) || isBest)
            {
                spectrumMzInfo = new SpectrumMzInfo
                {
                    SourceFile = DocumentFilePath,
                    Key = key,
                    PrecursorMz = nodeTranGroup.PrecursorMz,
                    SpectrumPeaks = new SpectrumPeaksInfo(mi.ToArray()),
                    RetentionTimes = spectrumMzInfo?.RetentionTimes ?? new List<SpectrumMzInfo.IonMobilityAndRT>(),
                    IonMobility = im,
                    Protein = nodePepGroup.Name,
                    RetentionTime = rt
                };
                spectra[key] = spectrumMzInfo;
            }
            spectrumMzInfo.RetentionTimes.Add(new SpectrumMzInfo.IonMobilityAndRT(chromFileName, im, rt, isBest));

For 2, we need to improve PeptideDocNode.CalcBestResult() to use the mProphet calculated ZScore when it is present, use the full DefaultScoringModel if not, and use maximum precursor score, not summed.

2022-03-08 Kaipo Tamura
resolve as Fixed
Statusopen»resolved
Assigned ToKaipo»Brendan MacLean