Esempio n. 1
0
        /// <summary>
        /// Display the related counts
        /// </summary>
        /// <param name="rss"></param>
        ///
        public void DisplayRelatedCidCounts(
            RelatedStructureSearchResults rss)
        {
            int altCnt, mmpCnt, swCnt, simCnt, allMatchCnt;

            //MoleculeGridPageControl.Width = this.Width - 3;
            //MoleculeGridPageControl.Height = this.Height - MoleculeGridPageControl.Top - 3;

            MoleculeGridPageControl mgpc = MoleculeGridPageControl;

            if (mgpc.EditQueryButton.Visible)             // adjust tool panel for proper display
            {
                mgpc.EditQueryButton.Visible = false;
                //mgpc.MarkDataButton.Visible = false;
                mgpc.FormattingButton.Visible = false;
                mgpc.AdjustToolPanelButtonSpacing();
            }

            if (rss == null)
            {
                DisplayEmptyCidCountsGrid();
                return;
            }

            altCnt = SetRelatedCidCount(AltForms, SumByDb(rss.AltCorpDbCnt, rss.AltChemblCnt));             // alternate forms

            mmpCnt = SetRelatedCidCount(MatchedPairs, SumByDb(rss.MmpCorpDbCnt, rss.MmpChemblCnt));         // matched pairs, no ChEMBL for now

            if (SmallWorldAvailable)
            {
                swCnt = SetRelatedCidCount(SmallWorld, SumByDb(rss.SwCorpDbCnt, rss.SwChemblCnt));                 // SmallWorld
            }
            else
            {
                SmallWorld.Checked = false;
                if (MatchCountsPanel.RowCount == 5)                 // remove SmallWorld from the MatchCountsPanel
                {
                    MatchCountsPanel.SetRow(labelControl3, 2);
                    MatchCountsPanel.SetRow(SimilarStructure, 2);
                    MatchCountsPanel.SetRow(labelControl6, 3);
                    MatchCountsPanel.SetRow(AllMatches, 3);

                    MatchCountsPanel.SetRow(SmallWorldLabel, 4);
                    MatchCountsPanel.SetRow(SmallWorld, 4);
                    SmallWorldLabel.Visible   = SmallWorld.Visible = false;
                    SmallWorld.Checked        = false;
                    MatchCountsPanel.RowCount = 4;
                }

                swCnt = 0;
            }

            simCnt = SetRelatedCidCount(SimilarStructure, SumByDb(rss.SimCorpDbCnt, rss.SimChemblCnt)); // similar

            allMatchCnt = SetRelatedCidCount(AllMatches, altCnt + mmpCnt + swCnt + simCnt);             // total

            SetRelatedCidCount(CorpDB, rss.CorpDbCnt);                                                  // these values don't change during life of search results
            SetRelatedCidCount(ChemblDB, rss.ChemblCnt);

            return;
        }
Esempio n. 2
0
        /// <summary>
        /// Process the change in the checked result types and display corresponding data
        /// </summary>
        /// <param name="ctl"></param>

        private void CheckedChanged(
            CheckEdit ctl)
        {
            if (InSetup)
            {
                return;
            }

            try
            {
                InSetup = true;

                if (ctl == AllMatches)
                {
                    bool amc = AllMatches.Checked;
                    if (AltForms.Enabled)
                    {
                        AltForms.Checked = amc;
                    }
                    if (MatchedPairs.Enabled)
                    {
                        MatchedPairs.Checked = amc;
                    }
                    if (SimilarStructure.Enabled)
                    {
                        SimilarStructure.Checked = amc;
                    }
                    if (SmallWorld.Enabled)
                    {
                        SmallWorld.Checked = amc;
                    }

                    //if (SmallWorldAvailable) SmallWorld.Checked = AllMatches.Checked;
                    //else SmallWorld.Checked = false;
                }

                else
                {
                    bool allChecked =
                        (AltForms.Checked || !AltForms.Enabled) &&
                        (MatchedPairs.Checked || !MatchedPairs.Enabled) &&
                        (SimilarStructure.Checked || !SimilarStructure.Enabled) &&
                        (SmallWorld.Checked || !SmallWorld.Enabled);

                    //if (SmallWorldAvailable) allChecked = allChecked && SmallWorld.Checked;
                    AllMatches.Checked = allChecked;
                }

                Checkmarks = SerializeCheckmarks();         // save current settings

                MatchCountsPanel.Refresh();                 // redraw the counts grid

                if (RenderSearchResultsDelegate != null)
                {
                    DelayedCallback.Schedule(RenderSearchResultsDelegate);
                }

                return;
            }

            catch (Exception ex) { ex = ex; }

            finally { InSetup = false; }
        }