Example #1
0
        public static DialogResult Show(
            QueryColumn qc)
        {
            ParsedStructureCriteria pssc;
            string tok;

            if (Instance == null)
            {
                Instance = new CriteriaStructureFormatDialog();
            }
            CriteriaStructureFormatDialog cfd = Instance;

            if (!ParsedStructureCriteria.TryParse(qc, out pssc) ||
                (pssc.SearchType != StructureSearchType.Substructure && pssc.SearchType != StructureSearchType.SmallWorld &&
                 pssc.SearchType != StructureSearchType.Related))
            {
                XtraMessageBox.Show("Only structure columns with criteria can have formatting defined");
                return(DialogResult.Cancel);
            }

            // Setup

            new JupyterGuiConverter().ConvertFormOrUserControl(Instance);

            if (pssc.SearchType == StructureSearchType.SmallWorld)
            {
                cfd.HilightStructures.Checked = pssc.SmallWorldParameters.Highlight;
                cfd.AlignStructures.Checked   = pssc.SmallWorldParameters.Align;
            }

            else             // Other structure match hilighting (i.e. SS)
            {
                cfd.HilightStructures.Checked = pssc.Highlight;
                cfd.AlignStructures.Checked   = pssc.Align;
            }

            // Show form & get new values

            DialogResult dr = cfd.ShowDialog(SessionManager.ActiveForm);

            if (dr == DialogResult.Cancel)
            {
                return(dr);
            }

            if (pssc.SearchType == StructureSearchType.SmallWorld)
            {
                pssc.SmallWorldParameters.Highlight = cfd.HilightStructures.Checked;
                pssc.SmallWorldParameters.Align     = cfd.AlignStructures.Checked;
            }

            else             // Other structure match hilighting (i.e. SS)
            {
                pssc.Highlight = cfd.HilightStructures.Checked;
                pssc.Align     = cfd.AlignStructures.Checked;
            }

            pssc.ConvertToQueryColumnCriteria(qc);
            return(dr);
        }
Example #2
0
        /// <summary>
        /// Return true if structure column can be searched by retrieving structure and matching with method call
        /// </summary>
        /// <param name="strQc"></param>
        /// <returns></returns>

        public static bool CanExecuteInternalStructureSearch(
            QueryColumn strQc)
        {
            ParsedStructureCriteria psc = null;

            MetaColumn strMc = strQc.MetaColumn;

            if (strMc.DataType != MetaColumnType.Structure)
            {
                return(false);                // only some structure searches are non-oracle now
            }
            MetaTable mt = strMc.MetaTable;

            bool parseOk = ParsedStructureCriteria.TryParse(strQc, out psc);

            if (parseOk && psc.SearchType == StructureSearchType.MolSim && psc.SimilarityType == SimilaritySearchType.ECFP4)             // ECFP4 search
            {
                return(true);
            }

            else if (parseOk && psc.SearchType == StructureSearchType.SmallWorld)             // smallworld executed via service calls
            {
                return(true);
            }

            else if (parseOk && psc.SearchType == StructureSearchType.Related)             // related structure search
            {
                return(true);
            }

            else if (mt.MetaBrokerType == MetaBrokerType.Annotation)             // annotation table
            {
                return(true);
            }

            else if (Lex.StartsWith(mt.Name, "USERDATABASE_STRUCTURE_"))             // structure database
            {
                return(true);
            }

            else if (Lex.Eq(strMc.DataTransform, "FromMolFile") ||             // other table with structure stored in usable format
                     Lex.Eq(strMc.DataTransform, "FromChime") ||
                     Lex.Eq(strMc.DataTransform, "FromSmiles"))
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }