The -s option is more restricted when used with the fs format. If you type

obabel -L fs

the documentation says:

The search target is the parameter of the ``-s`` option and can be
slightly extended SMILES (with ``[#n]`` atoms and ``~`` bonds) or
the name of a file containing a molecule.

This is because fastsearch uses fingerprints the target as well as the 
searched molecules, so the content of the s option has to be a molecule.

You could do the search in two parts - a rough fastsearch using SMILES 
which is then refined using SMARTS:

obabel index.fs -omol2 -sSMILES -an |
   obabel -imol2 -O first.smi -sSMARTS

Chris

On 21/03/2015 21:52, Stefano Forli wrote:
> I think there's an error either in the documentation or in the implementation 
> of the
> filter by pattern in obabel (v2.3.2). The online help says:
>
>    $ obabel -H
>    ...
>    -s"smarts" Convert only if match SMARTS or mols in file:
>    ...
>
> as well as the documentation page here:
>     
> http://openbabel.org/docs/dev/Fingerprints/fingerprints.html#substructure-searching
>
> Although, when trying the following example, I get an error message that 
> implies the code
> is expecting a SMILES string:
>
> --------------------
> $ obabel -ifs mol2_files_top50K.fs
> -s'[#6]-1(=[#6](-[$([#1]),$([#6](-[#1])-[#1]),$([#6]=[#8])])-[#16]-[#6](-[#7]-1-[$([#1]),$([#6]-[#1]),$([#6]:[#6])])=[#7;\!R])-[$([#6](-[#1])-[#1]),$([#6]:[#6])]'
> -osmi -O first.smi
> ==============================
> *** Open Babel Error  in ReadMolecule
>     C-1(=C(-[$(H),$(C(-H)-H),$(C=O)])-S contained a character ',' which is 
> invalid in SMILES
> ==============================
> *** Open Babel Error  in ObtainTarget
>     Cannot read the SMILES string
> 0 molecules converted
> ----------------------
>
> (note: I've escaped some characters in the pattern to avoid shell errors).
>
> Thanks,
>
> S
>
>
>


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to