Structure Checker Web Service

User 73ad691ca3

18-09-2012 12:27:52

Dear Support team,


I am using Jhem,is there any web service is provided for  using 'Structure Checker' fucntionality.If yes please provide the web service url detail.


Thanks & Regards


Obalesu.N


 


 

ChemAxon 6c76bc6409

18-09-2012 13:17:51

Hi Senthil,


JChem Web Services currently doesn't have a dedicated Structure Checker Web Service.


Through ChemicalTermsWS, 3 structure checker commands are available however. For more information please see these pages in the documentation:


Structure Checker functions in chemical terms language:
http://www.chemaxon.com/marvin/help/chemicalterms/EvaluatorFunctions.html#structure_checker_functions


Chemical Terms WS:
http://www.chemaxon.com/webservices/soap/ChemicalTermsWS.html


Andras 

User 73ad691ca3

24-09-2012 10:54:15

Dear Andras,


Thanks for reply ,Is it possible to check errors in multiple structures using check() method (can we pass multiple structures(.sdf file)  param to check() method).I tried by passing data from sdf file as a string format like this.


                chemaxon.struc.Molecule mol = new chemaxon.struc.Molecule();
                mol = MolImporter.importMol(new StreamReader(@"...\abc.sdf").ReadToEnd());
                StructureChecker checker = new BondLengthChecker();
                StructureCheckerResult result = checker.check(mol)
;//here result object is having error information about first structrue only how can we retrive all structures(.sdf file) error information? .


But check() method is returning errors from first structure only.It is not returning errors from other structures.How can we check errors in all structures(.sdf file).


If it is possible please share me the code which is able to check all the structures from sdf file .


 


 


Thanks & Regards


Obalesu.N


 



ChemAxon f250711500

24-09-2012 12:49:20

Dear Senthil,


The evaluator JChem Web Services can be used on single structures,
molecules files containing multiple structures are no exceptions.

Regarding the code based on the Structure Checker API, it
contains the following part:

  

    chemaxon.struc.Molecule mol = new chemaxon.struc.Molecule();

    mol = MolImporter.importMol(new
StreamReader(@"...\abc.sdf").ReadToEnd());



In this part the MolImporter imports a single Molecule instance
(the first one on the stream) that can contain only one structure,
thus the checker only checks this one.

If you want to import all structures from the file you have to use
the following code:



    Molecule mol = null;

    List<Molecule> molecules = new
ArrayList<Molecule>();

        // Creating importer for the file

        MolImporter importer = new MolImporter(new
FileInputStream("abc.sdf"));

        // Reading all molecules from the importer

        while((mol = importer.read()) != null){

            molecules.add(mol);

        }

    }



The check() method of the structure checkers are also based on
single structures, so you have to use the following code to check
all structures and collect the results:



    StructureChecker checker = new BondLengthChecker();

    List<StructureCheckerResult> results = new
ArrayList<StructureCheckerResult>();

    for(Molecule molecule : molecules){

        results.add(checker.check(molecule));

    }


 


Best Regards,


Imre

User 73ad691ca3

26-09-2012 06:06:29

Hi,


Thanks for reply,Its working fine.I am trying to fix the problems(Errors) in molecule by using the fix() method of BasicCheckerRunner class like this.


InputStream objStream = new FileInputStream((@"checkerslist.xml"));
ConfigurationReader objConfigRdr = new XMLBasedConfigurationReader(objStream);


 BasicCheckerRunner runner = new BasicCheckerRunner(objConfigRdr);


  Molecule mol = null;
  List<Molecule> molecules = new List<Molecule>();
  // Creating importer for the file
  MolImporter importer = new MolImporter(@"Problems.sdf");
   // Reading all molecules from the importer
   while ((mol = importer.read()) != null)
    {
            molecules.Add(mol);
     }


 for (int i = 0; i < molecules.Count; i++)
                {
                    runner.setMolecule(molecules);
                    java.util.List results = runner.checkAndWait();
                    for (int j = 0; j < results.size(); j++)
                    {
                        Boolean success = runner.fix(((StructureCheckerResult)(results.toArray().GetValue(j))));//H
ere fix() returns true but molecule is not updating (when i tried to read/check this same molecule again i am  getting same resultset from checkandwait() method means fix() method is not updating the molecule) .
                    }
                }


 


fix() method is returning true only ,But problems(errors) in structure are not fixed means fix() method is not updating the structure(molecule) .Can you please check above code block where i did mistake.


 


Thanks & Regards


Obalesu.N


 


 


 


 

ChemAxon f250711500

26-09-2012 09:44:00

 


Dear Senthil,


I think you should use the method fix() instead of the method fix(StructureCheckerResult). In my opinion use the latter one to report the found errors, and the applied fixes. If I am correct, you should check the attached code.


The result of the fix method however does not represent, that the molecule is changed, or the fix corrected the error, but represents a successful execution. Collecting results of fixes is also in the attached code.


Best Regards,


Imre