コード例 #1
0
        /// <summary>
        /// Execute CDK ECFP4 search
        /// </summary>
        /// <param name="eqp"></param>

        void ExecuteECFP4Search(
            ExecuteQueryParms eqp)
        {
            CdkSimSearchMx dao = Ecfp4Dao;

            if (!CdkSimSearchMx.IsSearchingAvailable())
            {
                throw new UserQueryException("ECFP4 searching is not currently available.");
            }

            Query      q  = eqp.QueryTable.Query;
            QueryTable qt = eqp.QueryTable;
            MetaTable  mt = qt.MetaTable;

            if (dao == null)             // if Dao not allocated then allocate Dao & execute the search
            {
                dao = Ecfp4Dao = new CdkSimSearchMx();
                dao.KeysToExclude = q.KeysToExclude;

                if (eqp.SearchKeySubset != null)
                {
                    dao.SearchKeySubset = new HashSet <string>(eqp.SearchKeySubset);
                }

                string databases = mt.Name + "," + mt.Label;                  // quick/dirty DB Id

                List <StructSearchMatch> hits = dao.ExecuteSearch(Pssc.Molecule.GetMolfileString(), databases, FingerprintType.Circular, Pssc.MinimumSimilarity, Pssc.MaxSimHits);
                VoLength = 1;
                if (qt.GetSelectedMolsimQueryColumn() != null)
                {
                    VoLength = 2;
                }
            }

            BuildECFP4QueryEngineRows(eqp);             // build the QE row set (filtered)

            return;
        }
コード例 #2
0
        /// <summary>
        /// Prep non-Oracle query
        /// </summary>
        /// <param name="eqp"></param>
        /// <returns></returns>

        public override string PrepareQuery(
            ExecuteQueryParms eqp)
        {
            int cti;

            Eqp = eqp;
            QueryEngine qe = eqp.Qe;
            Query       q  = qe.Query;
            QueryTable  qt = eqp.QueryTable;
            QueryColumn qc;
            MetaTable   mt = qt.MetaTable;
            MetaColumn  mc = null;

            StructCriteriaQc = KeyCriteriaQc = null;

            QueryColumn strQc = qt.FirstStructureQueryColumn;

            if (strQc != null && Lex.IsDefined(strQc.Criteria))
            {
                StructCriteriaQc = strQc;
            }
            else
            {
                throw new Exception("Structure criteria not defined");
            }

            Pssc = ParsedStructureCriteria.Parse(StructCriteriaQc);

            QueryColumn keyQc = qt.KeyQueryColumn;

            if (keyQc != null && Lex.IsDefined(q.KeyCriteria))             //keyQc.Criteria))
            {
                KeyCriteriaQc = keyQc;
            }

            if (StructCriteriaQc == null &&
                KeyCriteriaQc == null &&
                eqp.SearchKeySubset == null)
            {
                throw new Exception("NonSqlBroker - No criteria specified");
            }

            SelectList = new List <MetaColumn>();            // list of selected metacolumns
            foreach (QueryColumn qc2 in qt.QueryColumns)
            {
                if (qc2.MetaColumn == null)
                {
                    continue;                                         // in case metacolumn not defined
                }
                if (qc2.IsKey)
                {
                    qc2.Selected = true;
                }
                if (qc2.Selected || qc2.SortOrder != 0)
                {
                    SelectList.Add(qc2.MetaColumn);
                }
            }

            // Setup for ECFP4 similarity search

            if (Pssc.SearchType == StructureSearchType.MolSim && Pssc.SimilarityType == SimilaritySearchType.ECFP4)
            {
                Ecfp4Dao = null;                 // reset Dao to initiate new search
                return("");
            }

            else if (Pssc.SearchType == StructureSearchType.SmallWorld) // SmallWorld search
            {
                SwDao = null;                                           // reset Dao to initiate new search
                return("");
            }

            else if (Pssc.SearchType == StructureSearchType.Related) // Related structure search
            {
                RSS = null;                                          // reset to initiate new search
                return("");
            }

            else if (!MqlUtil.IsCartridgeMetaTable(mt)) // must be non chemical cartridge table (e.g. User structure DB or structure in Annotation table
            {
                return("");                             // everything looks ok, query criteria stored here, no sql returned
            }
            else
            {
                throw new Exception("Unsupported NonSqlBroker search for table: " + eqp.QueryTable.MetaTable.Label);
            }
        }