Beispiel #1
0
        private DoseResponseAndNonLinearRegressionAnalysisModel GetModelEquation(IDataset dataset)
        {
            var model = new DoseResponseAndNonLinearRegressionAnalysisModel(dataset)
            {
                AnalysisType           = AnalysisOption.Equation,
                Dose                   = null,
                DoseScale              = DoseScaleOption.Log10,
                EDICCoeff              = null,
                EDICStartValue         = null,
                Equation               = "y=mx+c",
                EquationXAxis          = "Dose1",
                EquationYAxis          = "Resp 1",
                MaxCoeff               = null,
                MaxStartValue          = null,
                MinCoeff               = null,
                MinStartValue          = null,
                Offset                 = null,
                QCDose                 = null,
                QCResponse             = null,
                Response               = null,
                ResponseTransformation = "None",
                SamplesResponse        = null,
                SlopeCoeff             = null,
                SlopeStartValue        = null,
                StartValues            = "1,2,3"
            };

            return(model);
        }
Beispiel #2
0
        private DoseResponseAndNonLinearRegressionAnalysisModel GetModelFourParameter(IDataset dataset)
        {
            var model = new DoseResponseAndNonLinearRegressionAnalysisModel(dataset)
            {
                AnalysisType           = AnalysisOption.FourParameter,
                Dose                   = "Dose1",
                DoseScale              = DoseScaleOption.Log10,
                EDICCoeff              = 8m,
                EDICStartValue         = 9m,
                Equation               = null,
                EquationXAxis          = null,
                EquationYAxis          = null,
                MaxCoeff               = 4m,
                MaxStartValue          = 5m,
                MinCoeff               = 2m,
                MinStartValue          = 1m,
                Offset                 = 1m,
                QCDose                 = "QCDose1",
                QCResponse             = "QC Resp1",
                Response               = "Resp 1",
                ResponseTransformation = "None",
                SamplesResponse        = "Sample 1",
                SlopeCoeff             = 6m,
                SlopeStartValue        = 7m,
                StartValues            = null
            };

            return(model);
        }
Beispiel #3
0
        public void GetCommandLineArguments_Equation_ReturnsCorrectString()
        {
            //Arrange
            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            DoseResponseAndNonLinearRegressionAnalysisModel sut = GetModelEquation(GetDataset());

            //Act
            string result = sut.GetCommandLineArguments();

            //Assert
            Assert.Equal("Equation NULL None NULL NULL Log10 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL y=mx+c 1,2,3 Respivs_sp_ivs1 Dose1", result);
        }
Beispiel #4
0
        public void ScriptFileName_ReturnsCorrectString()
        {
            //Arrange
            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            DoseResponseAndNonLinearRegressionAnalysisModel sut = new DoseResponseAndNonLinearRegressionAnalysisModel();

            //Act
            string result = sut.ScriptFileName;

            //Assert
            Assert.Equal("DoseResponseAndNonLinearRegressionAnalysis", result);
        }
Beispiel #5
0
        public void GetCommandLineArguments_FourParameter_ReturnsCorrectString()
        {
            //Arrange
            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            DoseResponseAndNonLinearRegressionAnalysisModel sut = GetModelFourParameter(GetDataset());

            //Act
            string result = sut.GetCommandLineArguments();

            //Assert
            Assert.Equal("FourParameter Respivs_sp_ivs1 None Dose1 1 Log10 QCivs_sp_ivsResp1 QCDose1 Sampleivs_sp_ivs1 2 4 6 8 1 5 7 9 NULL NULL NULL NULL", result);
        }
        protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            DoseResponseAndNonLinearRegressionAnalysisModel model = (DoseResponseAndNonLinearRegressionAnalysisModel)validationContext.ObjectInstance;

            if (value == null && model.AnalysisType == DoseResponseAndNonLinearRegressionAnalysisModel.AnalysisOption.FourParameter)
            {
                return(new ValidationResult(validationContext.DisplayName + " is a required variable."));
            }
            else
            {
                return(ValidationResult.Success);
            }
        }
Beispiel #7
0
        public void TransformationsList_ReturnsCorrectList()
        {
            //Arrange
            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            DoseResponseAndNonLinearRegressionAnalysisModel sut = new DoseResponseAndNonLinearRegressionAnalysisModel();

            //Act
            IEnumerable <string> result = sut.TransformationsList;

            //Assert
            Assert.IsAssignableFrom <IEnumerable <string> >(result);
            Assert.Equal(new List <string>()
            {
                "None", "Log10", "Loge", "Square Root", "ArcSine", "Rank"
            }, result);
        }
Beispiel #8
0
        public void ExportData_Equation_ReturnsCorrectStringArray()
        {
            //Arrange
            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Mock <IDataset> mockDataset = new Mock <IDataset>();

            mockDataset.Setup(x => x.DatasetID).Returns(It.IsAny <int>);
            mockDataset.Setup(x => x.DatasetToDataTable()).Returns(GetTestDataTable());

            DoseResponseAndNonLinearRegressionAnalysisModel sut = GetModelEquation(mockDataset.Object);

            //Act
            string[] result = sut.ExportData();

            //Assert
            Assert.Equal("Respivs_sp_ivs1,Dose1", result[0]);
            Assert.Equal(19, result.Count());
            Assert.StartsWith("0.971844660194175,1", result[15]);
        }
Beispiel #9
0
        public void ExportData_FourParameter_ReturnsCorrectStringArray()
        {
            //Arrange
            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            Mock <IDataset> mockDataset = new Mock <IDataset>();

            mockDataset.Setup(x => x.DatasetID).Returns(It.IsAny <int>);
            mockDataset.Setup(x => x.DatasetToDataTable()).Returns(GetTestDataTable());

            DoseResponseAndNonLinearRegressionAnalysisModel sut = GetModelFourParameter(mockDataset.Object);

            //Act
            string[] result = sut.ExportData();

            //Assert
            Assert.Equal("Respivs_sp_ivs1,Dose1,QCivs_sp_ivsResp1,QCDose1,Sampleivs_sp_ivs1", result[0]);
            Assert.Equal(19, result.Count());
            Assert.StartsWith("0.856310679611651,0.1", result[12]);
        }
Beispiel #10
0
        public void GetArguments_FourParameter_ReturnsCorrectArguments()
        {
            //Arrange
            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            DoseResponseAndNonLinearRegressionAnalysisModel sut = GetModelFourParameter(GetDataset());

            //Act
            List <Argument> result = sut.GetArguments().ToList();

            //Assert
            var responses = result.Single(x => x.Name == "AnalysisType");

            Assert.Equal("FourParameter", responses.Value);

            var dose = result.Single(x => x.Name == "Dose");

            Assert.Equal("Dose1", dose.Value);

            var doseScale = result.Single(x => x.Name == "DoseScale");

            Assert.Equal("Log10", doseScale.Value);

            var edicCoeff = result.Single(x => x.Name == "EDICCoeff");

            Assert.Equal("8", edicCoeff.Value);

            var edicStartValue = result.Single(x => x.Name == "EDICStartValue");

            Assert.Equal("9", edicStartValue.Value);

            var equation = result.Single(x => x.Name == "Equation");

            Assert.Null(equation.Value);

            var equationXAxis = result.Single(x => x.Name == "EquationXAxis");

            Assert.Null(equationXAxis.Value);

            var equationYAxis = result.Single(x => x.Name == "EquationYAxis");

            Assert.Null(equationYAxis.Value);

            var maxCoeff = result.Single(x => x.Name == "MaxCoeff");

            Assert.Equal("4", maxCoeff.Value);

            var maxStartValue = result.Single(x => x.Name == "MaxStartValue");

            Assert.Equal("5", maxStartValue.Value);

            var minCoeff = result.Single(x => x.Name == "MinCoeff");

            Assert.Equal("2", minCoeff.Value);

            var minStartValue = result.Single(x => x.Name == "MinStartValue");

            Assert.Equal("1", minStartValue.Value);

            var offset = result.Single(x => x.Name == "Offset");

            Assert.Equal("1", offset.Value);

            var qcDose = result.Single(x => x.Name == "QCDose");

            Assert.Equal("QCDose1", qcDose.Value);

            var qcResponse = result.Single(x => x.Name == "QCResponse");

            Assert.Equal("QC Resp1", qcResponse.Value);

            var response = result.Single(x => x.Name == "Response");

            Assert.Equal("Resp 1", response.Value);

            var responseTransformation = result.Single(x => x.Name == "ResponseTransformation");

            Assert.Equal("None", responseTransformation.Value);

            var samplesResponse = result.Single(x => x.Name == "SamplesResponse");

            Assert.Equal("Sample 1", samplesResponse.Value);

            var slopeCoeff = result.Single(x => x.Name == "SlopeCoeff");

            Assert.Equal("6", slopeCoeff.Value);

            var slopeStartValue = result.Single(x => x.Name == "SlopeStartValue");

            Assert.Equal("7", slopeStartValue.Value);

            var startValues = result.Single(x => x.Name == "StartValues");

            Assert.Null(startValues.Value);
        }
Beispiel #11
0
        public void LoadArguments_ReturnsCorrectArguments()
        {
            //Arrange
            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            DoseResponseAndNonLinearRegressionAnalysisModel sut = new DoseResponseAndNonLinearRegressionAnalysisModel(GetDataset());

            List <Argument> arguments = new List <Argument>();

            arguments.Add(new Argument {
                Name = "AnalysisType", Value = "FourParameter"
            });
            arguments.Add(new Argument {
                Name = "Dose", Value = "Dose1"
            });
            arguments.Add(new Argument {
                Name = "DoseScale", Value = "Log10"
            });
            arguments.Add(new Argument {
                Name = "EDICCoeff", Value = "8"
            });
            arguments.Add(new Argument {
                Name = "EDICStartValue", Value = "9"
            });
            arguments.Add(new Argument {
                Name = "Equation", Value = "y=mx+c"
            });
            arguments.Add(new Argument {
                Name = "EquationXAxis", Value = "Resp2"
            });
            arguments.Add(new Argument {
                Name = "EquationYAxis", Value = "Dose2"
            });
            arguments.Add(new Argument {
                Name = "MaxCoeff", Value = "4"
            });
            arguments.Add(new Argument {
                Name = "MaxStartValue", Value = "5"
            });
            arguments.Add(new Argument {
                Name = "MinCoeff", Value = "2"
            });
            arguments.Add(new Argument {
                Name = "MinStartValue", Value = "1"
            });
            arguments.Add(new Argument {
                Name = "Offset", Value = "1"
            });
            arguments.Add(new Argument {
                Name = "QCDose", Value = "QCDose1"
            });
            arguments.Add(new Argument {
                Name = "QCResponse", Value = "QC Resp1"
            });
            arguments.Add(new Argument {
                Name = "Response", Value = "Resp 1"
            });
            arguments.Add(new Argument {
                Name = "ResponseTransformation", Value = "None"
            });
            arguments.Add(new Argument {
                Name = "SamplesResponse", Value = "Sample 1"
            });
            arguments.Add(new Argument {
                Name = "SlopeCoeff", Value = "6"
            });
            arguments.Add(new Argument {
                Name = "SlopeStartValue", Value = "7"
            });
            arguments.Add(new Argument {
                Name = "StartValues", Value = "1,2,3"
            });

            Assert.Equal(21, arguments.Count);

            //Act
            sut.LoadArguments(arguments);

            //Assert
            Assert.Equal("FourParameter", sut.AnalysisType.ToString());
            Assert.Equal("Dose1", sut.Dose);
            Assert.Equal("Log10", sut.DoseScale.ToString());
            Assert.Equal(8, sut.EDICCoeff);
            Assert.Equal(9, sut.EDICStartValue);
            Assert.Equal("y=mx+c", sut.Equation);
            Assert.Equal("Resp2", sut.EquationXAxis);
            Assert.Equal("Dose2", sut.EquationYAxis);
            Assert.Equal(4, sut.MaxCoeff);
            Assert.Equal(1, sut.MinStartValue);
            Assert.Equal(1, sut.Offset);
            Assert.Equal("QCDose1", sut.QCDose);
            Assert.Equal("QC Resp1", sut.QCResponse);
            Assert.Equal("Resp 1", sut.Response);
            Assert.Equal("None", sut.ResponseTransformation);
            Assert.Equal("Sample 1", sut.SamplesResponse);
            Assert.Equal(6, sut.SlopeCoeff);
            Assert.Equal(7, sut.SlopeStartValue);
            Assert.Equal("1,2,3", sut.StartValues);
        }
 public async Task <IActionResult> DoseResponseAndNonLinearRegressionAnalysis(DoseResponseAndNonLinearRegressionAnalysisModel model, bool ignoreWarnings)
 {
     return(await RunAnalysis(model, ignoreWarnings));
 }
Beispiel #13
0
 public DoseResponseAndNonLinearRegressionAnalysisValidator(DoseResponseAndNonLinearRegressionAnalysisModel drnlr)
     : base(drnlr.DataTable)
 {
     drnlrVariables = drnlr;
 }