Sub structural search using smiles

User 1b64124363

02-04-2012 09:05:49

Is there any one who can help me in sub structural search ......


I
am developing my own web application for sub structural search using PHP
and MYSQL.........I my doing search on the basis of smiles......but i
am not getting all the results....


Suppose


smile generated by query is


c1ccccc1


and
that benzene ring is present in so many structures ,but my search is
showing limited structures not all that contains benzene ring. For eg.
the given smile also contained benzene ring..but that is shown in search
results.


C[C@]1(COc2ccc(NC(=O)Nc3ccc(cc3)C(F)(F)F)cc2)Cn2cc...


So plz tell what is the criteria for sub structural search using smiles .....



Reply its urgent

ChemAxon 5433b8e56b

02-04-2012 14:52:19

Hi,


I think we understand your problem, the searching based on smiles will not be accurate in any ways. This is because the smiles representation of a structure can vary. You can use uniq smiles, but that wont help either when you want to find a cyclohexane and the 3 ring in the smiles representation is a cyclohexane but in your query there is only one ring.


We have our web services API, to run these kind of database searches, or our java API to generate fingerprints as Miklos adviced to you in an other topic.


You can call a java application from PHP with exec, or PHP process API.


I hope this helps.


Regards,
Istvan

User 0e345a0616

02-04-2012 17:48:42

Thanx Istvan for understanding my problem..


But Istvan
i am not getting how to use desciptor generator in php file...plz can u
tell me some examples in php for descriptor generator..as i am unable
to use this java code in php



ChemAxon 5433b8e56b

05-04-2012 12:46:10

Hi,


in general we do not have much knowledge on PHP since we are working on Java and .Net environments. Besides i feel that it is a quite simple task to accomplish, without any knowledge about Java programming for a programmer.


And as I see we have included lots of links and by the way the web is full with example small Java programs, we have a documentation, and usage example for your program as a Java pseudocode, and as I have stated before, to call a java program from PHP can be done in one line with exec.


I felt that this is enough, but it seems it is not, I am not asking why, but I am a bit disapointed, because it is not even a semi pro but a newbie level issue.


Here you can find the main code in the Java class you need, package declaration is missing only (that is your task to find out if you need it, and even to find out if you want to place this class to a package):


import chemaxon.descriptors.DescriptorGenerator;
import chemaxon.descriptors.MDGeneratorException;
import chemaxon.formats.MolFormatException;
import chemaxon.formats.MolImporter;
import chemaxon.struc.Molecule;

public class ClassToCallFromPHP {

    public static void main(String[] args) {
try {
     DescriptorGenerator gen = new DescriptorGenerator("ECFP");
     gen.setParameter("Length", "512");
     Molecule mol = MolImporter.importMol("C1CCCCC1");
     gen.generate(mol);
     System.out.println(gen.getAsString());
} catch (Exception e) {
System.out.println("Error");
}
    }
}

Here you can find the PHP code snippet to run this java code:


<?php
exec("java -cp \"path/to/jchem.jar\" path/to/ClassToCallFromPHP", $output, $retval);
if ($output[0]!="Error"){
// here comes the search code.
// the first and only element of the $output array contains the fingerprint
} else {
echo ("Oooops fingerprint generation failed.");
}
?>

Prerequisites to run the java code this way from PHP:
- Jchem jar available at the specified location for the running PHP script, JChem.jar is in its natural place where it was placed by installation.
- java is installed, and available for the PHP code in its Environments Path variable, otherwise full path is needed for the java executable. Of course PHP need the rigths to run it from the webserver
- you have a setup for the PHP module, that allows to use the exec method of PHP, usually in safe mode it is not working, and there are possibilities to make it unavailable thru configuration. You can find more information on this in the PHP documentation I have linked before, and you also can ask your ISP about the server settings when your program goes to a production environment from localhost.


I think this is the maximum that we can help on this question.


Regards,
Istvan

User 1b64124363

16-04-2012 09:00:34

Hi


i am unable to convert this Java program to PHP....dont you have any programs in PHP...Please provide programs in PHP...As i am doing it from so many dayz , but nothng happened.


I need help in sub structural search

User 1b64124363

19-04-2012 12:05:26

Hi , for sub structural search this command is working
f9 in command line, but when i am running this cmd on php , it is not
showing any output....


<?php

 exec ('C:\Program Files\Chemaxon\Jchem\bin\jcsearch -q "c1ccccc1" -f
smiles "c:\Documents and Settings\admin\Desktop\mcd.sdf" ');


?>



plz reply

ChemAxon 5433b8e56b

19-04-2012 23:16:17

Hi,


First of all you do not need to convert this java program to PHP code, because this program needs lots of classes from jchem.jar which in this case also needed to be converted. You need to compile this with "javac" using the "-cp path/to/jchem.jar" argument added to command, and after the java source has been compiled, you can use the PHP code snippet, suggested by me, with some modification on the path of the files and command executables.


On windows if you want to use the jcsearch command line utility, I think it is better to call the jcsearch.bat that makes the required setup of the environment variables and parameters for the jcsearch executable.


And finally a quote from the PHP manual:


"To get the output of the executed command, be sure to set and use the
output parameter."


So you should use the second parameter of the exec method in your PHP code to get the full output of the runned command, exec returns only the last line of the output of the command that have been ran.


Regards,
Istvan