/// <summary> /// Get list of related structures for compound id /// </summary> /// <param name="queryCid"></param> /// <param name="mtName"></param> /// <param name="chime"></param> /// <returns></returns> public static string GetRelatedMatchRowsSerialized( string queryCid, string mtName) { string result = RelatedStructureSearch.GetRelatedMatchRowsSerialized(queryCid, mtName); return(result); }
/// <summary> /// Get list of related structure compound Ids for a compound id /// </summary> /// <param name="cid"></param> /// <param name="mtName"></param> /// <param name="chime"></param> /// <returns></returns> public static string GetRelatedMatchCounts( string cid, string mtName, string chime, StructureSearchType searchTypes, int searchId) { string result = RelatedStructureSearch.GetRelatedMatchCounts(cid, mtName, chime, searchTypes, searchId); return(result); }
/// <summary> /// Execute Related Structure Search /// </summary> /// <param name="eqp"></param> void ExecuteRelatedStructureSearch( ExecuteQueryParms eqp) { if (RSS == null) { RSS = new RelatedStructureSearch(); Query q = StructCriteriaQc.QueryTable.Query; QueryTable qt = StructCriteriaQc.QueryTable; MetaTable mt = qt.MetaTable; QueryColumn qc = StructCriteriaQc; MetaColumn mc = qc.MetaColumn; RSS.QueryMtName = mt.Name; RSS.QueryChimeString = Pssc.Molecule.GetChimeString(); // if no cid in options use passed structure RSS.IncludeQueryStructure = true; RSS.SearchCorp = (Lex.Contains(mt.Name, "Corp")); RSS.SearchChembl = (Lex.Contains(mt.Name, "ChEMBL")); RSS.SearchFSS = SST.IsFull(Pssc.SearchTypeUnion); RSS.SearchMmp = SST.IsMmp(Pssc.SearchTypeUnion); RSS.SearchSmallWorld = SST.IsSw(Pssc.SearchTypeUnion); RSS.SearchSim = SST.IsSim(Pssc.SearchTypeUnion); RSS.SearchSSS = SST.IsSSS(Pssc.SearchTypeUnion); if (RSS.SearchMmp && Lex.IsUndefined(RSS.QueryCid)) // try to get a cid from the structure if we are searching MMP and don't already have one { int corpId = Pssc.Molecule.GetCompoundId(); if (corpId > 0) { RSS.QueryCid = corpId.ToString(); } } RSS.KeysToExclude = q.KeysToExclude; RSS.ExecuteSearch(); } BuildRelatedStructureSearchQueryEngineRows(eqp); return; }
/// <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); } }