当前位置: 首页>>代码示例>>C#>>正文


C# Peptide.EnsurePeptideAnalysis方法代码示例

本文整理汇总了C#中Peptide.EnsurePeptideAnalysis方法的典型用法代码示例。如果您正苦于以下问题:C# Peptide.EnsurePeptideAnalysis方法的具体用法?C# Peptide.EnsurePeptideAnalysis怎么用?C# Peptide.EnsurePeptideAnalysis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Peptide的用法示例。


在下文中一共展示了Peptide.EnsurePeptideAnalysis方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestChromatogramGenerator

        public void TestChromatogramGenerator()
        {
            String dbPath = Path.Combine(TestContext.TestDir, "test" + Guid.NewGuid() + ".tpg");
            using (var sessionFactory = SessionFactoryFactory.CreateSessionFactory(dbPath, SessionFactoryFlags.CreateSchema))
            {
                using (var session = sessionFactory.OpenSession())
                {
                    session.BeginTransaction();
                    DbWorkspace dbWorkspace = new DbWorkspace
                    {
                        TracerDefCount = 1,
                    };
                    session.Save(dbWorkspace);
                    DbTracerDef dbTracerDef = TracerDef.GetN15Enrichment();
                    dbTracerDef.Workspace = dbWorkspace;
                    dbTracerDef.Name = "Tracer";

                    session.Save(dbTracerDef);
                    session.Save(new DbSetting
                                     {
                                         Workspace = dbWorkspace,
                                         Name = SettingEnum.data_directory.ToString(),
                                         Value = GetDataDirectory()
                                     });
                    session.Transaction.Commit();
                }
            }
            Workspace workspace = new Workspace(dbPath);
            workspace.SetTaskScheduler(TaskScheduler.Default);
            var dbMsDataFile = new DbMsDataFile
                {
                    Name = "20090724_HT3_0",
                };
            using (var session = workspace.OpenWriteSession())
            {
                session.BeginTransaction();
                session.Save(dbMsDataFile);
                session.Transaction.Commit();
            }
            workspace.DatabasePoller.LoadAndMergeChanges(null);
            var msDataFile = workspace.MsDataFiles.FindByKey(dbMsDataFile.GetId());
            Assert.IsTrue(MsDataFileUtil.InitMsDataFile(workspace, msDataFile));
            DbPeptide dbPeptide;
            using (var session = workspace.OpenWriteSession())
            {
                session.BeginTransaction();
                dbPeptide = new DbPeptide
                {
                    Protein = "TestProtein",
                    Sequence = "YLAAYLLLVQGGNAAPSAADIK",
                    FullSequence = "K.YLAAYLLLVQGGNAAPSAADIK.A",
                };
                session.Save(dbPeptide);
                var searchResult = new DbPeptideSpectrumMatch
                {
                    Peptide = dbPeptide,
                    MsDataFile = session.Load<DbMsDataFile>(msDataFile.Id),
                    PrecursorCharge = 3,
                    RetentionTime = 20.557 * 60,
                };
                session.Save(searchResult);
                session.Transaction.Commit();
            }
            var peptide = new Peptide(workspace, dbPeptide);
            var peptideAnalysis = peptide.EnsurePeptideAnalysis();
            peptideAnalysis.IncChromatogramRefCount();
            var peptideFileAnalysis = PeptideFileAnalysis.EnsurePeptideFileAnalysis(peptideAnalysis, msDataFile);
            workspace.DatabasePoller.LoadAndMergeChanges(null);
            peptideAnalysis.IncChromatogramRefCount();
            var chromatogramGenerator = new ChromatogramGenerator(workspace);
            chromatogramGenerator.Start();
            while (peptideFileAnalysis.ChromatogramSet == null)
            {
                Thread.Sleep(100);
            }
            var chromatogramDatas = peptideFileAnalysis.GetChromatograms();
            Assert.IsFalse(chromatogramDatas.Chromatograms.Count == 0);
            chromatogramGenerator.Stop();
            while (chromatogramGenerator.IsThreadAlive)
            {
                Thread.Sleep(100);
            }
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:83,代码来源:ChromatogramGeneratorTest.cs

示例2: AddPeptide

        private void AddPeptide(Workspace workspace, PeakFinderPeptide peakFinderPeptide)
        {
            var msDataFile = GetMsDataFile(workspace, peakFinderPeptide.DataFile);
            Peptide peptide;
            using (var session = workspace.OpenWriteSession())
            {
                var dbMsDataFile = new DbMsDataFile
                {
                    Name = peakFinderPeptide.DataFile,
                    Label = peakFinderPeptide.DataFile,
                };
                if (msDataFile == null)
                {
                    session.BeginTransaction();
                    session.Save(dbMsDataFile);
                    session.Transaction.Commit();
                }
                workspace.DatabasePoller.LoadAndMergeChanges(null);
                msDataFile = workspace.MsDataFiles.FindByKey(dbMsDataFile.GetId());
                var dbPeptide = (DbPeptide)
                    session.CreateCriteria<DbPeptide>().Add(Restrictions.Eq("Sequence",
                                                                            peakFinderPeptide.PeptideSequence)).
                        UniqueResult();
                if (dbPeptide == null)
                {
                    dbPeptide = new DbPeptide
                    {
                        FullSequence = peakFinderPeptide.PeptideSequence,
                        Sequence = peakFinderPeptide.PeptideSequence,
                    };
                    session.BeginTransaction();
                    session.Save(dbPeptide);
                    session.Transaction.Commit();
                }

                session.BeginTransaction();
                session.Save(new DbPeptideSpectrumMatch
                {
                    RetentionTime = peakFinderPeptide.FirstDetectedTime * 60,
                    PrecursorCharge = peakFinderPeptide.MinCharge,
                    Peptide = dbPeptide,
                    MsDataFile = session.Load<DbMsDataFile>(msDataFile.Id),
                });
                if (peakFinderPeptide.LastDetectedTime != peakFinderPeptide.FirstDetectedTime)
                {
                    session.Save(new DbPeptideSpectrumMatch
                                     {
                                         RetentionTime = peakFinderPeptide.LastDetectedTime * 60,
                                         PrecursorCharge = peakFinderPeptide.MaxCharge,
                                         Peptide = dbPeptide,
                                         MsDataFile = session.Load<DbMsDataFile>(msDataFile.Id),
                                     });
                }
                session.Transaction.Commit();
                peptide = new Peptide(workspace, dbPeptide);
            }
            MsDataFileUtil.InitMsDataFile(workspace, msDataFile);
            var peptideAnalysis = peptide.EnsurePeptideAnalysis();
            if (peptideAnalysis == null)
            {
                Assert.Fail();
            }
            PeptideFileAnalysis.EnsurePeptideFileAnalysis(peptideAnalysis, msDataFile);
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:64,代码来源:PeakFinderTest.cs


注:本文中的Peptide.EnsurePeptideAnalysis方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。