Hi Goutam, I assume you are typing the first example interactively in the Python interpreter or in a ipython shell or Jupyter notebook. In that case you only need to enter the same commands in a text editor, save the script with a name (e.g., substructure.py) and run it from a shell;
python substructure.py If this is not what you are after please get back to me off-list such that we keep the mailing list traffic to a minimum. Cheers, p. > On 28 Jun 2019, at 19:10, Goutam Mukherjee <cyz078...@gmail.com> wrote: > > Hi All, > > I have one query about Substructure matching using RDKit. > I have a target SMILES codes (Required to convert Canonical SMILES format) > which may content 1 or more than one SMILES code > I have one more file, a query file, which content just one SMILES code of a > small fragment. Say, > Target file: Brc1ccc(cc1)C(=O)Nc1n[nH]c(c1)C1CCCCC1 > Query file format: c1cn[nH]c1 > I have to compare whether the query fragment is present in the target file or > not. > > I able to do it in command line > Here is the command > from __future__ import print_function > from rdkit import Chem > m = Chem.MolFromSmiles('Brc1ccc(cc1)C(=O)Nc1n[nH]c(c1)C1CCCCC1') > m.HasSubstructMatch(Chem.MolFromSmarts('c1cn[nH]c1')) > True > > However, I want to do this substructure search using command line (say, > python script). > Could you please help me to do this. > Your help will be highly appreciated. > > Thanks and Kind Regards, > Goutam > _______________________________________________ > Rdkit-discuss mailing list > Rdkit-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss