public void TestInitialize()
 {
     mockServiceLocator = new Mock<IServiceLocator>();
     ProjectBase project = TestHelper.CreateTestProject();
     experiment = project.Experiments.First() as Experiment;
     viewModel = new LabelingViewModel(experiment.Labeling.First(), experiment.ProteinStates.First(), experiment, mockServiceLocator.Object);
 }
示例#2
0
 public void TestInitialize()
 {
     mockServiceLocator = new Mock<IServiceLocator>();
     mockEventAggregator = new Mock<IEventAggregator>();
     experiment = TestHelper.GetTestExperiment(mockServiceLocator);
     run = new Run(Path.GetFileName(Properties.Settings.Default.mzXMLTestFile1), Properties.Settings.Default.mzXMLTestFile1, new ProteinState(experiment), new Labeling(experiment), experiment, new ProteoWizardDataProvider(mockEventAggregator.Object));
 }
        private static DeuterationResult GenerateDeuterationResult(Peptide peptide, ProteinState proteinState, Labeling labeling, Experiment experiment, Result result)
        {
            List<RunResult> replicates = new List<RunResult>();

            foreach (Run run in experiment.GetRunsByProteinState(proteinState))
            {
                if (run.Labeling == labeling)
                {
                    RunResult runResult = experiment.GetRunResult(result, run, peptide);
                    if (runResult != null)
                    {
                        replicates.Add(runResult);
                    }
                }
            }

            DeuterationResult deuterationResult = new DeuterationResult(peptide, proteinState, labeling, replicates);
            deuterationResult.AmountDeut = Math.Round(MathUtility.GetAverage(deuterationResult.DeuterationValues), 5);
            deuterationResult.AmountDeuterationStandardDeviation = Math.Round(MathUtility.GetStandardDeviation(deuterationResult.DeuterationValues), 5);
            deuterationResult.AmountDeuterationFromDeuterationDistribution = Math.Round(MathUtility.GetAverage(deuterationResult.DeuterationDistributedDeuterationValues), 5);
            deuterationResult.AmountDeuterationFromDeuterationDistributionStandardDeviation = Math.Round(MathUtility.GetStandardDeviation(deuterationResult.DeuterationDistributedDeuterationValues), 5);
            deuterationResult.CentroidMass = Math.Round(MathUtility.GetAverage(deuterationResult.CentroidMassValues), 5);
            deuterationResult.CentroidMassStandardDeviation = Math.Round(MathUtility.GetStandardDeviation(deuterationResult.CentroidMassValues), 5);
            if (replicates.Count > 0)
            {
                deuterationResult.TheoreticalCentroidMass = Math.Round(replicates.Average(item => item.TheoreticalAverageMass), 5);
            }

            return deuterationResult;
        }
 public SelectTemplateViewModel(Experiment experiment, IServiceLocator serviceLocator)
 {
     this.experiment = experiment;
     this.serviceLocator = serviceLocator;
     _selectedDataPath = Properties.Settings.Default.LastBrowseTemplateDataPath;
     LoadRecentLocations();
 }
示例#5
0
        public Result(string name, Experiment experiment)
            : this()
        {
            _experiment = experiment;
            _name = name;

            _location = "Results - " + DateTime.Now.ToString("yyyy-MM-dd hh.mm.ss") + ".xml";
        }
 public void TestInitialize()
 {
     mockServiceLocator = new Mock<IServiceLocator>();
     project = TestHelper.CreateTestProject();
     experiment = project.Experiments.First() as Experiment;
     viewModel = new PeptidesViewModel(project.Experiments.First() as Experiment, mockServiceLocator.Object);
     Assert.AreEqual(2, viewModel.Children.Count);
 }
示例#7
0
文件: Run.cs 项目: pol/MassSpecStudio
 public Run(string filename, string fullPath, ProteinState proteinState, Labeling labeling, Experiment experiment, IDataProvider dataProvider)
     : base(filename, fullPath, dataProvider)
 {
     ProteinState = proteinState;
     Labeling = labeling;
     Experiment = experiment;
     experiment.Runs.Add(this);
 }
        public HydraTemplateWizardController(IRegionManager regionManager, IServiceLocator serviceLocator, Experiment experiment)
        {
            _regionManager = regionManager;
            _experiment = experiment;
            _serviceLocator = serviceLocator;
            _wizardViewModels = new List<WizardStepViewModel>();

            SelectTemplateViewModel templateViewModel = new SelectTemplateViewModel(experiment, serviceLocator);
            _wizardViewModels.Add(templateViewModel);
        }
示例#9
0
        public void CreateDirectoryStructure()
        {
            Assert.IsFalse(Directory.Exists(TestExperimentDirectory));

            Experiment experiment = new Experiment(TestExperimentName, new MassSpecStudio.Core.Domain.ProjectBase("temp", @"C:\"), new HydraExperimentType(mockServiceLocator.Object));
            experiment.CreateDirectoryStructure();

            Assert.IsTrue(Directory.Exists(TestExperimentDirectory));
            Assert.IsTrue(Directory.Exists(Path.Combine(TestExperimentDirectory, "Data")));
            Assert.IsTrue(Directory.Exists(Path.Combine(TestExperimentDirectory, "Results")));
        }
示例#10
0
 public static WizardViewModel CreateController(Experiment experiment, IRegionManager regionManager, IServiceLocator serviceLocator)
 {
     if (experiment.ExperimentTypeObject is TemplatedHydraExperimentType)
     {
         return new HydraTemplateWizardController(regionManager, serviceLocator, experiment);
     }
     else
     {
         return new HydraExperimentWizardController(regionManager, serviceLocator, experiment);
     }
 }
        public void TestInitialize()
        {
            mockEventAggregator = new Mock<IEventAggregator>();
            mockServiceLocator = new Mock<IServiceLocator>();
            mockServiceLocator.Setup(mock => mock.GetAllInstances<IDataProvider>()).Returns(new List<IDataProvider>() { new ProteoWizardDataProvider(mockEventAggregator.Object) });

            ProjectBase project = TestHelper.CreateTestProject();
            experiment = project.Experiments.First() as Experiment;
            experimentViewModel = new ExperimentViewModel(experiment);
            viewModel = new DataProviderViewModel(experimentViewModel, mockServiceLocator.Object);
        }
示例#12
0
        public void TestInitialize()
        {
            IXYData xyData = new XYData(new double[] { 1, 2 }, new double[] { 3, 4 });
            mockServiceLocator = new Mock<IServiceLocator>();
            mockEventAggregator = new Mock<IEventAggregator>();
            mockDataProvider = new Mock<IDataProvider>();
            mockDataProvider.Setup(mock => mock.GetTotalIonChromatogram(TimeUnit.Seconds)).Returns(xyData);
            mockDataProvider.Setup(mock => mock.GetExtractedIonChromatogram(2, 2, 0.5, TimeUnit.Seconds)).Returns(xyData);
            mockDataProvider.Setup(mock => mock.GetSpectrum(2, 3, 3, 6, 0)).Returns(xyData);

            experiment = Test.TestHelper.GetTestExperiment(mockServiceLocator);
            run = new Run(Path.GetFileName(Properties.Settings.Default.mzXMLTestFile1), Properties.Settings.Default.mzXMLTestFile1, new ProteinState(experiment), new Labeling(experiment), experiment, mockDataProvider.Object);
        }
        public HydraExperimentWizardController(IRegionManager regionManager, IServiceLocator serviceLocator, Experiment experiment)
        {
            _regionManager = regionManager;
            _experiment = experiment;
            _serviceLocator = serviceLocator;
            _wizardViewModels = new List<WizardStepViewModel>();

            ExperimentViewModel experimentViewModel = new ExperimentViewModel(experiment);
            _wizardViewModels.Add(new ProteinStatesViewModel(experimentViewModel));
            _wizardViewModels.Add(new LabellingsViewModel(experimentViewModel));
            _wizardViewModels.Add(new DataProviderViewModel(experimentViewModel, serviceLocator));
            _wizardViewModels.Add(new RunsViewModel(experimentViewModel));
            _wizardViewModels.Add(new ImportPeptidesViewModel(experimentViewModel));
        }
示例#14
0
        private string GetNextName(Experiment experiment)
        {
            int maximumCount = 0;
            foreach (ProteinState proteinState in experiment.ProteinStates.Where(item => item.Name.ToLower().StartsWith("protein state")).OrderBy(item => item.Name))
            {
                int result = 0;
                if (Int32.TryParse(proteinState.Name.ToLower().Replace("protein state", string.Empty), out result))
                {
                    maximumCount = result > maximumCount ? result : maximumCount;
                }
            }

            return "Protein state " + (maximumCount + 1);
        }
 public void Execute(Experiment experiment, Result result)
 {
     _output.Publish("- Calculating Deuteration Results");
     result.DeuterationResults = new List<DeuterationResult>();
     foreach (Peptide peptide in experiment.Peptides.PeptideCollection)
     {
         foreach (ProteinState proteinState in experiment.ProteinStates)
         {
             foreach (Labeling labeling in experiment.Labeling)
             {
                 result.DeuterationResults.Add(GenerateDeuterationResult(peptide, proteinState, labeling, experiment, result));
             }
         }
     }
     _output.Publish("- Deuteration Results Calculation Complete");
 }
示例#16
0
        public void TestInitialize()
        {
            mockEventAggregator = new Mock<IEventAggregator>();
            mockServiceLocator = new Mock<IServiceLocator>();
            mockServiceLocator.Setup(mock => mock.GetAllInstances<IDataProvider>()).Returns(new List<IDataProvider>() { new ProteoWizardDataProvider(mockEventAggregator.Object) });
            experiment = TestHelper.GetTestExperiment(mockServiceLocator);

            try
            {
                if (Directory.Exists(TestExperimentDirectory))
                {
                    Directory.Delete(TestExperimentDirectory, true);
                }
            }
            catch
            {
                // Do Nothing
            }
        }
示例#17
0
 public void TestInitialize()
 {
     project = TestHelper.CreateTestProject();
     viewModel = new ProjectViewModel(project);
     samplesViewModel = viewModel.Children.First().Children.First() as SamplesViewModel;
     experiment = (Experiment)project.Experiments.First();
 }
示例#18
0
 private void OpenExperiment()
 {
     experiment = Experiment.Open(Properties.Settings.Default.TestExperiment1, new MassSpecStudio.Core.Domain.ProjectBase("testProject1", Properties.Settings.Default.ProjectRootDirectory), mockServiceLocator.Object);
 }
示例#19
0
 private static Hydra.Core.Domain.Run CreateRun(string filename, ProteinState proteinState, Labeling labeling, Experiment experiment, Mock<IEventAggregator> mockEventAggregator)
 {
     string runFileName = Path.GetFileName(filename);
     File.Copy(filename, Path.Combine(TestExperimentDirectory, "Data", runFileName), true);
     Hydra.Core.Domain.Run run = new Hydra.Core.Domain.Run(
         @"Data\" + runFileName,
         Path.Combine(TestExperimentDirectory, "Data", runFileName),
         proteinState,
         labeling,
         experiment,
         new ProteoWizardDataProvider(mockEventAggregator.Object));
     return run;
 }
示例#20
0
        public static Result Open(Experiment experiment, string path)
        {
            DataContractSerializer serializer = new DataContractSerializer(typeof(Result));
            using (XmlReader stream = XmlReader.Create(Path.Combine(GetFullPath(experiment), path)))
            {
                Result result = serializer.ReadObject(stream, true) as Result;
                result.Location = path;
                result._experiment = experiment;

                foreach (RunResult runResult in result.RunResults)
                {
                    runResult.Run = experiment.Runs.Where(item => item.FileName == runResult.Run.FileName).FirstOrDefault();
                }
                return result;
            }
        }
示例#21
0
 public void TestInitialize()
 {
     mockServiceLocator = new Mock<IServiceLocator>();
     experiment = TestHelper.GetTestExperiment(mockServiceLocator);
     proteinState = new ProteinState(experiment);
 }
示例#22
0
 private static string GetFullPath(Experiment experiment)
 {
     return Path.Combine(Path.GetDirectoryName(experiment.Location), "Results");
 }
示例#23
0
        protected ExperimentBase CreateExperimentFile(ProjectBase project, string experimentName)
        {
            string experimentDirectory = Path.Combine(project.Directory, experimentName);
            Experiment experiment = new Experiment(experimentName, project, this);
            experiment.Save();

            return experiment;
        }
示例#24
0
 public void Save(Experiment experiment)
 {
     experiment.Save();
 }
示例#25
0
 public void TestInitialize()
 {
     mockServiceLocator = new Mock<IServiceLocator>();
     experiment = TestHelper.GetTestExperiment(mockServiceLocator);
     labeling = new Labeling(experiment);
 }
示例#26
0
 private void SetNextPercentAndTime(Experiment experiment)
 {
     Labeling maxLabelingPercentage = experiment.Labeling.OrderByDescending(item => item.LabelingPercent).FirstOrDefault();
     if (maxLabelingPercentage != null)
     {
         if ((maxLabelingPercentage.LabelingPercent + 10) > 100)
         {
             LabelingPercent = 100;
         }
         else
         {
             LabelingPercent = maxLabelingPercentage.LabelingPercent + 10;
         }
         LabelingTime = maxLabelingPercentage.LabelingTime + 1;
     }
     else
     {
         LabelingPercent = 20;
         LabelingTime = 1;
     }
 }
示例#27
0
 public ProteinState(Experiment parentExperiment)
 {
     _name = GetNextName(parentExperiment);
     _parentExperiment = parentExperiment;
     _parentExperiment.ProteinStates.Add(this);
 }
示例#28
0
 public void TestInitialize()
 {
     mockServiceLocator = new Mock<IServiceLocator>();
     experiment = new Experiment("testExperiment1", new ProjectBase("testProject1", @"..\..\..\..\testData\testProjects\"), new HydraExperimentType(mockServiceLocator.Object));
     DeleteTestResultFile();
 }
示例#29
0
 public static IList<Result> OpenDirectory(Experiment experiment)
 {
     string[] resultFiles = Directory.GetFiles(Path.Combine(GetFullPath(experiment)), "*.xml");
     IList<Result> results = new List<Result>();
     foreach (string resultFile in resultFiles)
     {
         results.Add(Result.Open(experiment, Path.GetFileName(resultFile)));
     }
     return results;
 }
 public void TestInitialize()
 {
     ProjectBase project = TestHelper.CreateTestProject();
     experiment = project.Experiments.First() as Experiment;
     viewModel = new ExperimentViewModel(experiment);
 }