Esempio n. 1
0
        public DeuterationResult(Peptide peptide, ProteinState proteinState, Labeling labeling, IList<RunResult> replicateResults)
        {
            _peptide = peptide;
            _proteinState = proteinState;
            _labeling = labeling;
            _replicateResults = replicateResults;

            DeuterationValues = new List<double>();
            DeuterationDistributedDeuterationValues = new List<double>();
            CentroidMassValues = new List<double>();

            NValue = 0;
            foreach (RunResult replicate in _replicateResults)
            {
                if (replicate != null)
                {
                    this.TheoreticalCentroidMass = replicate.TheoreticalAverageMass;

                    if (replicate.IsUsedInCalculations)
                    {
                        DeuterationValues.Add(replicate.AmountDeut);
                        DeuterationDistributedDeuterationValues.Add(replicate.AmountDeutFromDeutDist);
                        CentroidMassValues.Add(replicate.AverageMass);
                        NValue++;
                    }
                }
            }
        }
        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;
        }
Esempio n. 3
0
        public static ProjectBase CreateTestProject()
        {
            DeleteProjectDirectory();

            Mock<IEventAggregator> mockEventAggregator = new Mock<IEventAggregator>();
            Mock<IServiceLocator> mockServiceLocator = new Mock<IServiceLocator>();
            mockServiceLocator.Setup(mock => mock.GetAllInstances<IDataProvider>()).Returns(new List<IDataProvider>() { new ProteoWizardDataProvider(mockEventAggregator.Object) });
            ProjectBase project = new ProjectBase("temp", @"c:\");
            HydraExperimentType hydraExperimentType = new HydraExperimentType(mockServiceLocator.Object);
            Experiment experiment = hydraExperimentType.CreateExperiment(project, "testExperiment") as Experiment;
            ProteinState proteinState1 = new ProteinState(experiment);
            ProteinState proteinState2 = new ProteinState(experiment);
            Labeling labeling1 = new Labeling(experiment);
            Labeling labeling2 = new Labeling(experiment);

            CreateRun(Properties.Settings.Default.mzXMLTestFile1, proteinState1, labeling1, experiment, mockEventAggregator);
            CreateRun(Properties.Settings.Default.mzXMLTestFile2, proteinState1, labeling1, experiment, mockEventAggregator);
            CreateRun(Properties.Settings.Default.mzXMLTestFile2, proteinState1, labeling2, experiment, mockEventAggregator);
            CreateRun(Properties.Settings.Default.mzXMLTestFile2, proteinState2, labeling1, experiment, mockEventAggregator);

            experiment.Peptides.PeptideCollection.Add(CreatePeptide("SAMPLE", 1));
            experiment.Peptides.PeptideCollection.Add(CreatePeptide("SAMPLES", 20));

            experiment.Save();
            project.Experiments.Add(experiment);
            return project;
        }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
        public void NotEqualOperator()
        {
            Labeling labeling2 = new Labeling(experiment);

            Assert.IsTrue(labeling != labeling2);

            labeling2.LabelingTime = 1;
            Assert.IsTrue(labeling != labeling2);

            labeling2.LabelingPercent = 20;
            Assert.IsFalse(labeling != labeling2);
        }
Esempio n. 6
0
        public void Equals()
        {
            Labeling labeling2 = new Labeling(experiment);

            Assert.IsFalse(labeling.Equals(null));
            Assert.IsFalse(labeling.Equals(labeling2));

            labeling2.LabelingTime = 1;
            Assert.IsFalse(labeling.Equals(labeling2));

            labeling2.LabelingPercent = 20;
            Assert.IsTrue(labeling.Equals(labeling2));
        }
Esempio n. 7
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;
 }
        private Experiment CreateTestExperiment()
        {
            Experiment experiment = hydraExperimentType.CreateExperiment(project, TestExperimentName) as Experiment;
            ProteinState proteinState = new ProteinState(experiment);
            Labeling labeling = new Labeling(experiment);

            string runFileName = Path.GetFileName(Properties.Settings.Default.mzXMLTestFile1);
            File.Copy(Properties.Settings.Default.mzXMLTestFile1, Path.Combine(TestExperimentDirectory, "Data", runFileName), true);
            Run run = new Run(
                @"Data\" + runFileName,
                Path.Combine(TestExperimentDirectory, "Data", runFileName),
                proteinState,
                labeling,
                experiment,
                new ProteoWizardDataProvider(mockEventAggregator.Object));
            experiment.Save();
            return experiment as Experiment;
        }
Esempio n. 9
0
 public void TestInitialize()
 {
     mockServiceLocator = new Mock<IServiceLocator>();
     experiment = TestHelper.GetTestExperiment(mockServiceLocator);
     labeling = new Labeling(experiment);
 }
Esempio n. 10
0
        public void SetNextPercentAndTime()
        {
            labeling = new Labeling(experiment);

            Assert.AreEqual(2, labeling.LabelingTime);
            Assert.AreEqual(30, labeling.LabelingPercent);
        }