Beispiel #1
0
        public void GetLibraryInfo(SrmSettings settings, ExplicitMods mods, bool useFilter,
                                   ref SpectrumHeaderInfo libInfo,
                                   Dictionary <double, LibraryRankedSpectrumInfo.RankedMI> transitionRanks)
        {
            PeptideLibraries libraries = settings.PeptideSettings.Libraries;

            // No libraries means no library info
            if (!libraries.HasLibraries)
            {
                libInfo = null;
                return;
            }
            // If not loaded, leave everything alone, and let the update
            // when loading is complete fix things.
            if (!libraries.IsLoaded)
            {
                return;
            }

            IsotopeLabelType labelType;

            if (!settings.TryGetLibInfo(Peptide.Sequence, PrecursorCharge, mods, out labelType, out libInfo))
            {
                libInfo = null;
            }
            else if (transitionRanks != null)
            {
                try
                {
                    SpectrumPeaksInfo spectrumInfo;
                    string            sequenceMod = settings.GetModifiedSequence(Peptide.Sequence, labelType, mods);
                    if (libraries.TryLoadSpectrum(new LibKey(sequenceMod, PrecursorCharge), out spectrumInfo))
                    {
                        var spectrumInfoR = new LibraryRankedSpectrumInfo(spectrumInfo, labelType,
                                                                          this, settings, mods, useFilter, 50);
                        foreach (var rmi in spectrumInfoR.PeaksRanked)
                        {
                            if (!transitionRanks.ContainsKey(rmi.PredictedMz))
                            {
                                transitionRanks.Add(rmi.PredictedMz, rmi);
                            }
                            if (!useFilter && rmi.PredictedMz2 != 0 && !transitionRanks.ContainsKey(rmi.PredictedMz2))
                            {
                                transitionRanks.Add(rmi.PredictedMz2, rmi);
                            }
                        }
                    }
                }
                // Catch and ignore file access exceptions
                catch (IOException) {}
                catch (UnauthorizedAccessException) {}
                catch (ObjectDisposedException) {}
            }
        }