Пример #1
0
 /// <summary>
 /// Creates a QueryAtomContainer with the following settings:
 /// <c>QueryAtomContainer.Create(container,
 ///     ExprType.ELEMENT,
 ///     ExprType.IS_AROMATIC,
 ///     ExprType.ALIPHATIC_ORDER);
 /// </c>>
 /// </summary>
 /// <param name="container">The AtomContainer that stands as model</param>
 /// <returns>The new QueryAtomContainer created from container.</returns>
 public static QueryAtomContainer CreateAnyAtomForPseudoAtomQueryContainer(IAtomContainer container)
 {
     return(QueryAtomContainer.Create(container,
                                      ExprType.Element,
                                      ExprType.IsAromatic,
                                      ExprType.AliphaticOrder));
 }
Пример #2
0
 /// <summary>
 /// Creates a <see cref="QueryAtomContainer"/> with the following settings:
 /// <c>QueryAtomContainer.Create(container,
 ///     ExprType.ELEMENT,
 ///     ExprType.FORMAL_CHARGE,
 ///     ExprType.IS_AROMATIC,
 ///     ExprType.ORDER);</c>
 /// </summary>
 /// <param name="container">The <see cref="IAtomContainer"/> that stands as model</param>
 /// <returns>The new <see cref="QueryAtomContainer"/> created from container.</returns>
 public static QueryAtomContainer CreateSymbolAndChargeQueryContainer(IAtomContainer container)
 {
     return(QueryAtomContainer.Create(container,
                                      ExprType.Element,
                                      ExprType.FormalCharge,
                                      ExprType.IsAromatic,
                                      ExprType.Order));
 }
Пример #3
0
 /// <summary>
 /// Creates a <see cref="QueryAtomContainer"/> with the following settings:
 /// <c>QueryAtomContainer.Create(container,
 ///     Expr.Type.ALIPHATIC_ELEMENT,
 ///     Expr.Type.AROMATIC_ELEMENT,
 ///     Expr.Type.IS_AROMATIC,
 ///     Expr.Type.ALIPHATIC_ORDER,
 ///     Expr.Type.STEREOCHEMISTRY);</c>
 /// </summary>
 /// <param name="container">The <see cref="IAtomContainer"/> that stands as model</param>
 /// <returns>The new <see cref="QueryAtomContainer"/> created from container.</returns>
 public static QueryAtomContainer CreateBasicQueryContainer(IAtomContainer container)
 {
     return(QueryAtomContainer.Create(container,
                                      ExprType.AliphaticElement,
                                      ExprType.AromaticElement,
                                      ExprType.IsAromatic,
                                      ExprType.AliphaticOrder,
                                      ExprType.Stereochemistry));
 }
Пример #4
0
        private void Test(string expected, string smi, params ExprType[] opts)
        {
            var mol = smipar.ParseSmiles(smi);

            Cycles.MarkRingAtomsAndBonds(mol);
            var query  = QueryAtomContainer.Create(mol, opts);
            var actual = Smarts.Generate(query);

            Assert.AreEqual(expected, actual);
        }
Пример #5
0
 /// <summary>
 /// Creates a QueryAtomContainer with the following settings:
 /// <c>
 /// // aromaticity = true
 /// QueryAtomContainer.Create(container, ExprType.IS_AROMATIC);
 /// // aromaticity = false
 /// QueryAtomContainer.Create(container);
 /// </c>
 /// </summary>
 /// <remarks>
 /// This method thus allows the user to search based only on connectivity.
 /// </remarks>
 /// <param name="container">The AtomContainer that stands as the model</param>
 /// <param name="aromaticity">option flag</param>
 /// <returns>The new QueryAtomContainer</returns>
 public static QueryAtomContainer CreateAnyAtomAnyBondContainer(IAtomContainer container, bool aromaticity)
 {
     if (aromaticity)
     {
         return(QueryAtomContainer.Create(container, ExprType.IsAromatic));
     }
     else
     {
         return(QueryAtomContainer.Create(container));
     }
 }
Пример #6
0
 /// <summary>
 /// Create a pattern which can be used to find molecules which contain the <paramref name="query"/>
 /// structure. If a 'real' molecule is provided is is converted
 /// with <see cref="QueryAtomContainer.Create(IAtomContainer, ExprType[])"/>
 /// matching elements, aromaticity status, and bond orders.
 /// </summary>
 /// <param name="query">the substructure to find</param>
 /// <returns>a pattern for finding the <paramref name="query"/></returns>
 /// <see cref="QueryAtomContainer.Create(IAtomContainer, ExprType[])"/>
 public static new DfPattern FindSubstructure(IAtomContainer query)
 {
     if (query is IQueryAtomContainer)
     {
         return(new DfPattern((IQueryAtomContainer)query));
     }
     else
     {
         return(new DfPattern(QueryAtomContainer.Create(query,
                                                        ExprType.AliphaticElement,
                                                        ExprType.AromaticElement,
                                                        ExprType.SingleOrAromatic,
                                                        ExprType.AliphaticOrder,
                                                        ExprType.Stereochemistry)));
     }
 }
        void Main()
        {
            IAtomContainer mol = null;

            #region Create1
            // [nH]1ccc(=O)cc1 => n1:c:c:c(=O):c:c:1
            QueryAtomContainer.Create(mol,
                                      ExprType.AliphaticElement,
                                      ExprType.AromaticElement,
                                      ExprType.SingleOrAromatic,
                                      ExprType.AliphaticOrder,
                                      ExprType.Stereochemistry);
            #endregion
            #region Create2
            // [nH]1ccc(=O)cc1 => [nD2]1:[cD2]:[cD2]:[cD2](=[OD1]):[cD2]:[cD2]:1
            QueryAtomContainer.Create(mol,
                                      ExprType.AliphaticElement,
                                      ExprType.AromaticElement,
                                      ExprType.Degree,
                                      ExprType.SingleOrAromatic,
                                      ExprType.AliphaticOrder);
            #endregion
            #region Create3
            // [nH]1ccc(=O)cc1 => [nx2+0]1:[cx2+0]:[cx2+0]:[cx2+0](=[O&x0+0]):[cx2+0]:[cx2+0]:1
            // IMPORTANT! use Cycles.MarkRingAtomsAndBonds(mol) to set ring status
            QueryAtomContainer.Create(mol,
                                      ExprType.AliphaticElement,
                                      ExprType.AromaticElement,
                                      ExprType.FormalCharge,
                                      ExprType.Isotope,
                                      ExprType.RingBondCount,
                                      ExprType.SingleOrAromatic,
                                      ExprType.AliphaticOrder);
            #endregion
            #region Create4
            // [nH]1ccc(=O)cc1 => [0n+0]1:[0c+0]:[0c+0]:[0c+0](=[O+0]):[0c+0]:[0c+0]:1
            QueryAtomContainer.Create(mol,
                                      ExprType.AliphaticElement,
                                      ExprType.AromaticElement,
                                      ExprType.FormalCharge,
                                      ExprType.Isotope,
                                      ExprType.RingBondCount,
                                      ExprType.SingleOrAromatic,
                                      ExprType.AliphaticOrder);
            #endregion
        }
Пример #8
0
 /// <summary>
 /// Creates a <see cref="QueryAtomContainer"/> with the following settings:
 /// <c>QueryAtomContainer.Create(container,
 ///     ExprType.ELEMENT,
 ///     ExprType.ORDER);</c>
 /// </summary>
 /// <param name="container">The AtomContainer that stands as model</param>
 /// <returns>The new QueryAtomContainer created from container.</returns>
 public static QueryAtomContainer CreateSymbolAndBondOrderQueryContainer(IAtomContainer container)
 {
     return(QueryAtomContainer.Create(container,
                                      ExprType.Element,
                                      ExprType.Order));
 }