예제 #1
0
        private static void SaveRedundantSpectra(ISession sessionRedundant,
                                                 IEnumerable <SpectrumKeyTime> redundantSpectraIds,
                                                 IDictionary <string, long> dictFiles,
                                                 DbRefSpectra refSpectra,
                                                 Library library)
        {
            foreach (var specLiteKey in redundantSpectraIds)
            {
                if (specLiteKey.Key.RedundantId == 0)
                {
                    continue;
                }
                // If this source file has already been saved, get its database Id.
                // Otherwise, save it.
                long spectrumSourceId = GetSpecturmSourceId(sessionRedundant, specLiteKey.FilePath, dictFiles);

                // Get peaks for the redundant spectrum
                var peaksInfo        = library.LoadSpectrum(specLiteKey.Key);
                var redundantSpectra = new DbRefSpectraRedundant
                {
                    Id               = specLiteKey.Key.RedundantId,
                    PeptideSeq       = refSpectra.PeptideSeq,
                    PrecursorMZ      = refSpectra.PrecursorMZ,
                    PrecursorCharge  = refSpectra.PrecursorCharge,
                    PeptideModSeq    = refSpectra.PeptideModSeq,
                    NumPeaks         = (ushort)peaksInfo.Peaks.Count(),
                    Copies           = refSpectra.Copies,
                    RetentionTime    = specLiteKey.Time.RetentionTime,
                    IonMobilityValue = specLiteKey.Time.IonMobilityValue.GetValueOrDefault(),
                    IonMobilityType  = specLiteKey.Time.IonMobilityType.GetValueOrDefault(),
                    IonMobilityHighEnergyDriftTimeOffsetMsec = specLiteKey.Time.IonMobilityHighEnergyDriftTimeOffsetMsec,
                    FileId = spectrumSourceId
                };

                var peaks = new DbRefSpectraRedundantPeaks
                {
                    RefSpectra    = redundantSpectra,
                    PeakIntensity = IntensitiesToBytes(peaksInfo.Peaks),
                    PeakMZ        = MZsToBytes(peaksInfo.Peaks)
                };
                redundantSpectra.Peaks = peaks;

                sessionRedundant.Save(redundantSpectra);
            }

            sessionRedundant.Flush();
            sessionRedundant.Clear();
        }
예제 #2
0
        private static void SaveRedundantSpectra(ISession sessionRedundant,
            IEnumerable<SpectrumKeyTime> redundantSpectraIds,
            IDictionary<string, long> dictFiles,
            DbRefSpectra refSpectra,
            Library library)
        {
            foreach (var specLiteKey in redundantSpectraIds)
            {
                if (specLiteKey.Key.RedundantId == 0)
                {
                    continue;
                }
                // If this source file has already been saved, get its database Id.
                // Otherwise, save it.
                long spectrumSourceId = GetSpecturmSourceId(sessionRedundant, specLiteKey.FilePath, dictFiles);

                // Get peaks for the redundant spectrum
                var peaksInfo = library.LoadSpectrum(specLiteKey.Key);
                var redundantSpectra = new DbRefSpectraRedundant
                                           {
                                               Id = specLiteKey.Key.RedundantId,
                                               PeptideSeq = refSpectra.PeptideSeq,
                                               PrecursorMZ = refSpectra.PrecursorMZ,
                                               PrecursorCharge = refSpectra.PrecursorCharge,
                                               PeptideModSeq = refSpectra.PeptideModSeq,
                                               NumPeaks = (ushort) peaksInfo.Peaks.Count(),
                                               Copies = refSpectra.Copies,
                                               RetentionTime = specLiteKey.Time.RetentionTime,
                                               IonMobilityValue = specLiteKey.Time.IonMobilityValue.GetValueOrDefault(),
                                               IonMobilityType = specLiteKey.Time.IonMobilityType.GetValueOrDefault(),
                                               IonMobilityHighEnergyDriftTimeOffsetMsec = specLiteKey.Time.IonMobilityHighEnergyDriftTimeOffsetMsec,
                                               FileId = spectrumSourceId
                                           };

                var peaks = new DbRefSpectraRedundantPeaks
                                {
                                    RefSpectra = redundantSpectra,
                                    PeakIntensity = IntensitiesToBytes(peaksInfo.Peaks),
                                    PeakMZ = MZsToBytes(peaksInfo.Peaks)
                                };
                redundantSpectra.Peaks = peaks;

                sessionRedundant.Save(redundantSpectra);
            }

            sessionRedundant.Flush();
            sessionRedundant.Clear();
        }