Exemplo n.º 1
0
        /// <summary>
        /// OK button clicked, process input
        /// </summary>
        /// <returns></returns>

        bool ProcessInput()
        {
            MetaTable   mt;
            Query       q;
            QueryColumn qc;
            string      actDifLabel = "", actSasCoefLabel = "";
            string      tok;

            if (Lex.IsDefined(KeyCriteriaCtl.QueryColumn.Criteria))
            {
                Parms.KeyCriteriaQc = KeyCriteriaCtl.QueryColumn;
            }

            else
            {
                MessageBoxMx.ShowError("Compound Id criteria must be defined.");
                return(false);
            }

            if (EndPointCtl.MetaColumn == null)
            {
                MessageBoxMx.ShowError("An endpoint assay result must be selected.");
                return(false);
            }

            Parms.EndpointMc = EndPointCtl.MetaColumn;
            string endPointLabel = EndPointCtl.MetaColumn.Label;

            qc = SasQt.GetQueryColumnByName("ACTIVITY1");
            if (qc != null)
            {
                qc.Label = endPointLabel + " 1";
            }

            qc = SasQt.GetQueryColumnByName("ACTIVITY2");
            if (qc != null)
            {
                qc.Label = endPointLabel + " 2";
            }

            actSasCoefLabel = "Act. Diff. / (1-Sim.)";

            // Get the type of calculation

            ActDiffCalcType calcType = ActDiffCalcType.Undefined;

            if (SimpleDifference.Checked)
            {
                calcType    = ActDiffCalcType.SimpleDifference;
                actDifLabel = "Activity Difference";
            }

            else if (NegativeLog.Checked)
            {
                actDifLabel = "Negative Log Difference";
                calcType    = ActDiffCalcType.NegativeLog;
            }

            else if (MolarNegativeLog.Checked)
            {
                calcType = ActDiffCalcType.MolarNegativeLog;

                if (Lex.Contains(endPointLabel, "IC50"))
                {
                    actDifLabel = "pIC50 Difference (Molar)";
                }

                else if (Lex.Contains(endPointLabel, "EC50"))
                {
                    actDifLabel = "pEC50 Difference (Molar)";
                }

                else
                {
                    actDifLabel = "Negative Log Difference (Molar)";
                }
            }

            else if (Ratio.Checked)
            {
                calcType        = ActDiffCalcType.Ratio;
                actDifLabel     = "Activity Ratio";
                actSasCoefLabel = "Act. Ratio / (1-Sim.)";
            }

            qc = SasQt.GetQueryColumnByName("ACTIVITY_DIFF");
            if (qc != null)
            {
                qc.Label = actDifLabel;
            }

            qc = SasQt.GetQueryColumnByName("ACT_SIM_COEF");
            if (qc != null)
            {
                qc.Label = actSasCoefLabel;
            }

            Parms.UseAbsoluteValue = CalcAbsoluteValue.Checked;

            Parms.ActDiffCalcType = calcType;

            // Get molsim parameters

            QueryColumn simQc = SasQt.GetQueryColumnByName("SIMILARITY");

            if (ECFP4Similarity.Checked)
            {
                Parms.SimilarityType = SimilaritySearchType.ECFP4;
                if (simQc != null)
                {
                    simQc.Label = "Structural Similarity (ECFP4)";
                }
            }

            else if (StandardSimilarity.Checked)
            {
                Parms.SimilarityType = SimilaritySearchType.Normal;
                if (simQc != null)
                {
                    simQc.Label = "Structural Similarity";
                }
            }

            tok = MinSimCtl.Text;
            Parms.MinimumSimilarity = -1;
            try { Parms.MinimumSimilarity = Double.Parse(tok); }
            catch (Exception ex) { }
            if (Parms.MinimumSimilarity <= 0 || Parms.MinimumSimilarity > 1)
            {
                MessageBoxMx.ShowError(
                    "Minimum acceptable structural similarity\n" +
                    "must be between 0 and 1.0");
                MinSimCtl.Focus();
                return(false);
            }

            // Get pair count

            tok = PairCountCtl.Text;
            Parms.MaxPairCount = -1;
            try { Parms.MaxPairCount = Int32.Parse(tok); }
            catch (Exception ex) { }
            if (Parms.MaxPairCount <= 0.0)
            {
                MessageBoxMx.ShowError(
                    "Pair count must be a positive integer value.");
                PairCountCtl.Focus();
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// SetupForm
        /// </summary>

        void SetupForm()
        {
// CorpIds

            if (Parms.KeyCriteriaQc != null)
            {
                KeyCriteriaCtl.Setup(Parms.KeyCriteriaQc);
            }

            else
            {
                KeyCriteriaCtl.Setup(BaseQuery);
            }

            // Endpoint

            EndPointCtl.Setup(BaseQuery, new QueryColumn(Parms.EndpointMc));

// Activity diff calc type

            ActDiffCalcType calcType = Parms.ActDiffCalcType;

            if (calcType == ActDiffCalcType.SimpleDifference)
            {
                SimpleDifference.Checked = true;
            }

            else if (calcType == ActDiffCalcType.NegativeLog)
            {
                NegativeLog.Checked = true;
            }

            else if (calcType == ActDiffCalcType.MolarNegativeLog)
            {
                MolarNegativeLog.Checked = true;
            }

            else if (calcType == ActDiffCalcType.Ratio)
            {
                Ratio.Checked = true;
            }

            CalcAbsoluteValue.Checked = Parms.UseAbsoluteValue;

            // Molsim parameters

            if (Parms.SimilarityType == SimilaritySearchType.ECFP4)
            {
                ECFP4Similarity.Checked = true;
            }


            else if (Parms.SimilarityType == SimilaritySearchType.Normal)
            {
                StandardSimilarity.Checked = true;
            }


            MinSimCtl.Text = Parms.MinimumSimilarity.ToString();

            PairCountCtl.Text = Parms.MaxPairCount.ToString();

            return;
        }