예제 #1
0
 public MassSpectrum(MassSpectrum metaSpectrum, pwiz.CLI.msdata.Spectrum spectrum)
 {
     source             = metaSpectrum.source;
     spectrumList       = metaSpectrum.spectrumList;
     index              = metaSpectrum.index;
     Tag                = metaSpectrum.Tag;
     AnnotationSettings = metaSpectrum.AnnotationSettings;
     //element = spectrum;
     id = metaSpectrum.id;
 }
예제 #2
0
        public static void AddSubsetPeakData (NHibernate.ISession session)
        {
            session.Transaction.Begin();
            session.Clear();
            foreach (SpectrumSource source in session.Query<SpectrumSource>())
            {
                var subsetPeakData = new msdata.MSData();
                subsetPeakData.id = subsetPeakData.run.id = source.Name;
                var spectrumList = new msdata.SpectrumListSimple();
                subsetPeakData.run.spectrumList = spectrumList;

                foreach (Spectrum spectrum in source.Spectra.OrderBy(o => o.Index))
                {
                    var spectrumData = new msdata.Spectrum();
                    spectrumData.id = spectrum.NativeID;
                    spectrumData.index = spectrum.Index;
                    spectrumData.setMZIntensityArrays(new List<double>() { 100, 200, 300, 400, 500 },
                                                      new List<double>() { 10, 20, 30, 40, 50 });
                    spectrumList.spectra.Add(spectrumData);
                }

                session.Evict(source);
                var newSource = new SpectrumSource(subsetPeakData)
                {
                    Id = source.Id,
                    Group = source.Group,
                    Name = source.Name,
                    URL = source.URL
                };
                session.Update(newSource);
            }
            session.Transaction.Commit();
        }