Exemple #1
0
        /// <summary>
        /// Prepare for FSS matching of supplied query molecule
        /// </summary>
        /// <param name="queryMol"></param>

        public void SetFSSQueryMolecule(
            INativeMolMx queryMol,
            string FullStructureSearchType = null)
        {
            FSSQueryMolecule = queryMol as CdkMol;
            return;
        }
Exemple #2
0
        /// <summary>
        /// GetMolFormulaDotDisconnect
        /// </summary>
        /// <param name="mol"></param>
        /// <returns></returns>

        public String GetMolFormulaDotDisconnect(
            INativeMolMx mol)
        {
            string mf = GetMolFormula(mol as CdkMol, includeSpaces: false, separateFragments: true);

            return(mf);
        }
Exemple #3
0
        /// <summary>
        /// Hilight a target molecule using mapped atoms and bonds
        /// </summary>
        /// <param name="targetMol"></param>
        /// <param name="mappedAtoms"></param>
        /// <param name="mappedBonds"></param>
        /// <returns></returns>

        public INativeMolMx HilightSSSMatchGMap(
            INativeMolMx targetMol,
            int[] mappedAtoms,
            int[] mappedBonds)
        {
            throw new NotImplementedException();
        }
Exemple #4
0
        /// <summary>
        /// Get list of RNumbers and a count of instances for each
        /// </summary>
        /// <param name="mol"></param>
        /// <returns></returns>

        public static void GetCoreRGroupInfo(
            INativeMolMx mol,
            out SortedDictionary <int, int> rgCounts,
            out SortedDictionary <int, int> rgBufferStartingPos)
        {
            throw new NotImplementedException();
        }
Exemple #5
0
        /// <summary>
        /// Check if substructure query matches target molecule
        /// </summary>
        /// <param name="queryMol"></param>
        /// <param name="targetMol"></param>
        /// <returns></returns>

        public bool IsSSSMatch(
            INativeMolMx queryMol,
            INativeMolMx targetMol)
        {
            SetSSSQueryMolecule(queryMol as CdkMol);
            return(IsSSSMatch(targetMol as CdkMol));
        }
Exemple #6
0
        /// <summary>
        /// Set substructure search query molecule
        /// </summary>
        /// <param name="cs"></param>

        public void SetSSSQueryMolecule(
            MoleculeMx cs)
        {
            QueryMol    = cs.Clone();
            SSSQueryMol = CdkMolFactory.NewCdkMol(cs);
            CdkMolUtil.SetSSSQueryMolecule(SSSQueryMol);

            return;
        }
Exemple #7
0
        /// <summary>
        /// GetFolFormula
        /// </summary>
        /// <param name="mol"></param>
        /// <param name="includeSpaces"></param>
        /// <param name="separateFragments"></param>
        /// <param name="use2Hand3HforHydrogenIsotopes"></param>
        /// <param name="ignoreIsotopes"></param>
        /// <returns></returns>

        public String GetMolFormula(
            INativeMolMx mol,
            bool includeSpaces                 = false,
            bool separateFragments             = false,
            bool use2Hand3HforHydrogenIsotopes = false,
            bool ignoreIsotopes                = false)
        {
            throw new NotImplementedException();
        }
Exemple #8
0
        /// <summary>
        /// Prepare for SSS matching of supplied query molecule
        /// </summary>
        /// <param name="queryMol"></param>

        public void SetSSSQueryMolecule(
            INativeMolMx queryMol)
        {
            try
            {
                throw new NotImplementedException();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Exemple #9
0
        /// <summary>
        /// Do a SSS using the predefined query molecule and supplied target molecule
        /// </summary>
        /// <returns></returns>

        public bool IsSSSMatch(MoleculeMx cs)
        {
            if (QueryMol == null || cs.IsBiopolymerFormat)             // fix later
            {
                return(false);
            }

            TargetMol    = cs;
            SSSTargetMol = CdkMolFactory.NewCdkMol(cs);
            bool b = CdkMolUtil.IsSSSMatch(SSSTargetMol);

            return(b);
        }
Exemple #10
0
        /// <summary>
        /// Set full structure search query molecule
        /// </summary>
        /// <param name="cs"></param>

        public void SetFSSQueryMolecule(
            MoleculeMx cs)
        {
            if (cs.IsBiopolymerFormat)             // fix later
            {
                QueryMol = cs;
                return;
            }

            QueryMol = cs.Clone();

            FSSQueryMol = CdkMolFactory.NewCdkMol(cs);
            CdkMolUtil.SetFSSQueryMolecule(FSSQueryMol);

            return;
        }
Exemple #11
0
        /// <summary>
        /// Perform a substructure search
        /// </summary>
        /// <param name="query"></param>
        /// <param name="target"></param>
        /// <returns></returns>

        public bool IsSSSMatch(
            MoleculeMx query,
            MoleculeMx target)
        {
            if (query.IsBiopolymerFormat || target.IsBiopolymerFormat)             // fix later
            {
                return(false);
            }

            QueryMol     = query;
            SSSQueryMol  = CdkMolFactory.NewCdkMol(query);
            SSSTargetMol = CdkMolFactory.NewCdkMol(target);
            bool b = CdkMolUtil.IsSSSMatch(SSSQueryMol, SSSTargetMol);

            return(b);
        }
Exemple #12
0
        /// <summary>
        /// Do a SSS using the predefined query molecule and supplied target molecule
        /// </summary>
        /// <returns></returns>

        public bool IsFSSMatch(MoleculeMx cs)
        {
            if (MoleculeMx.IsUndefined(QueryMol) || MoleculeMx.IsUndefined(cs))
            {
                return(false);
            }

            if (cs.IsBiopolymerFormat)
            {
                return(IsFSSMatch(QueryMol, cs));
            }

            TargetMol    = cs;
            FSSTargetMol = CdkMolFactory.NewCdkMol(cs);
            bool b = CdkMolUtil.IsFSSMatch(FSSTargetMol);

            return(b);
        }
Exemple #13
0
        /// <summary>
        /// Get mapping of current query against supplied target
        /// </summary>
        /// <param name="targetMol"></param>
        /// <param name="queryIndex"></param>
        /// <param name="mappedAtoms"></param>
        /// <param name="mappedBonds"></param>
        /// <returns></returns>

        public bool GetSSSMapping(
            INativeMolMx targetMol,
            out int queryIndex,
            out int[] mappedAtoms,
            out int[] mappedBonds)
        {
            queryIndex  = -1;
            mappedAtoms = mappedBonds = null;

            try
            {
                throw new NotImplementedException();
            }
            catch (Exception ex)
            {
                return(false); // just say false if exception encountered
            }
        }
Exemple #14
0
        /// <summary>
        /// Perform a full structure search
        /// </summary>
        /// <param name="query"></param>
        /// <param name="target"></param>
        /// <param name="switches"></param>
        /// <returns></returns>

        public bool FullStructureMatch(
            INativeMolMx query,
            INativeMolMx target,
            string FullStructureSearchType = null)
        {
            if (query == null || target == null)
            {
                return(false);
            }

            CdkMol q = query as CdkMol;

            q.UpdateNativeMolecule(); // be sure up to date
            if (q?.NativeMol == null)
            {
                return(false);
            }

            CdkMol t = target as CdkMol;

            t.UpdateNativeMolecule();
            if (t?.NativeMol == null)
            {
                return(false);
            }

            var fs = new UniversalIsomorphismTester();

            if (fs.IsIsomorph(q.NativeMol, t.NativeMol))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #15
0
 public static int ProcessTargetMolecule(INativeMolMx mol)
 {
     throw new NotImplementedException();
 }
Exemple #16
0
 public static void SetCoreStructure(INativeMolMx mol, bool PromptUser)
 {
     throw new NotImplementedException();
 }
Exemple #17
0
        /// <summary>
        /// Do setup in preparation for decompose
        /// </summary>
        /// <param name="qt"></param>
        /// <param name="q"></param>

        public void PrepareForDecompose(
            QueryTable qt,
            Query q)
        {
            throw new NotImplementedException();
#if false
            Stopwatch sw = Stopwatch.StartNew();

            MetaTable mt = qt.MetaTable;

            QueryColumn qc = qt.GetQueryColumnByName("core");
            if (qc == null)
            {
                throw new UserQueryException("Core column not defined in rgroup_decomposition table");
            }
            string molfile = qc.MolString;
            if (molfile == null || molfile == "")
            {             // core not defined in Rgroup decomposition table, try to get from structure search in rest of query
                foreach (QueryTable qt3 in q.Tables)
                {
                    if (!qt3.MetaTable.IsRootTable)
                    {
                        continue;
                    }
                    MetaColumn mc3 = qt3.MetaTable.FirstStructureMetaColumn;
                    if (mc3 != null)
                    {
                        QueryColumn qc3 = qt3.GetQueryColumnByName(mc3.Name);
                        molfile = qc3.MolString;
                        break;
                    }
                }
            }

            if (molfile == null || molfile == "")
            {
                throw new UserQueryException("R-group decomposition core structure is not defined");
            }

            bool allowHydrogenSubstituents = true;
            qc = qt.GetQueryColumnByName("AllowHydrogenSubstituents");
            if (Lex.Contains(qc?.Criteria, "'N'"))
            {
                allowHydrogenSubstituents = false;                                                // set to false if "no" criteria specified
            }
            TerminateOptionString = "First mapping";
            bool allowMultipleCoreMappings = false;

            qc = qt.GetQueryColumnByName("Terminate_Option");
            if (qc != null && qc.Criteria != "")
            {
                ParsedSingleCriteria psc = MqlUtil.ParseSingleCriteria(qc.Criteria);
                TerminateOptionString     = psc.Value;
                allowMultipleCoreMappings = Lex.Contains(TerminateOptionString, "All");
            }

            MoleculeMx cs = new MoleculeMx(MoleculeFormat.Molfile, molfile);
            cs.GetCoreRGroupInfo(out RgCounts, out RgTotalCount);             // need to redefine these

            RGroupDecomp.Initialize();

            RGroupDecomp.SetAlignStructuresToCore(true);
            RGroupDecomp.SetAllowMultipleCoreMappings(allowMultipleCoreMappings);
            RGroupDecomp.SetIncludeHydrogenFragments(allowHydrogenSubstituents);

            if (DebugMx.True)             // debug
            {
                String  coreSmiles = "[R1]c1cn2c3c(c1= O)cc(c(c3SC(C2)[R4])[R3])[R2]";
                string  coreChime  = "CYAAFQwAUewQeV58YHemfM^EQqPRfIYlJGEkx6M7e4db95jjK5HrNFVP2e1qHphWPL98KvcvrsF7bP9bRcW4QH$si9PXkkuwre6Q5UkHZjciQqeAKVLSHNAeQTAMlkiXEBD$BePpbNQCPD3BkklFEaQqwokeI$FwUoS5cAixQXkMbLTWDaAK7t7cOkSmt3RhwQedbrba6OHKBq3OF4Dhlz$0BfLeKCUUo8ixle176M2aIzXUccTOU8Xy8ARwE3bTyMfjuI3UunZceJf4iZELvsj3PX2MHZG73baUvQGS4DaxUaBGps81PPiDljfvxwFv8OfdOyIRlOBeuEAvk2rT9SRT6oMZIV6UtLFvmCHdwKnu9WtrfV1rEctydNUVxW4qKVlV0rZtpK1oZXuKcv6WVdl6r2hrjVLxBhblTVKO7w1qGRoziquOnPQkKd9H4EQfV0rP6mzI8Au8ulti2fu3YKB94lPXftPGbwr5yA";
                IMolLib coreMol    = MolLibFactory.NewMolLib(MoleculeFormat.Molfile, molfile);
                coreChime = MoleculeMx.MolfileStringToChimeString(molfile);
                molfile   = coreMol.MolfileString;
            }

            CoreMolecule = CdkMol.Util.MolfileStringToMolecule(molfile);
            RGroupDecomp.SetCoreStructure(CoreMolecule, false);

            CoreChemicalStructure = new MoleculeMx(MoleculeFormat.Molfile, molfile);
            StrMatcher            = null;

            int msTime = (int)sw.ElapsedMilliseconds;
            if (RGroupDecomp.Debug)
            {
                DebugLog.Message("Time(ms): " + msTime);
            }

            return;
#endif
        }
Exemple #18
0
        /// <summary>
        /// Map current query against supplied target molecule
        /// </summary>
        /// <param name="targetMol"></param>
        /// <returns></returns>

        public bool IsSSSMatch(
            INativeMolMx targetMol)
        {
            throw new NotImplementedException();
        }
Exemple #19
0
        /// <summary>
        /// Map current query against supplied target molecule
        /// </summary>
        /// <param name="targetMol"></param>
        /// <returns></returns>

        public bool IsFSSMatch(
            INativeMolMx targetMol)
        {
            return(FullStructureMatch(FSSQueryMolecule, targetMol));
        }