Template Based Clean

19-10-2005 12:50:30

Is there a bit of example code available that shows how to do a template based clean using the API from within a Java application?





Please include also some examples about how to use template based clean with Standardizer.

ChemAxon fb166edcbd

19-10-2005 13:05:47

Template based cleaning is currently available through


Standardizer.


In the current release you need an XML configuration to access template based cleaning:





Code:



<StandardizerConfiguration Version ="0.1">


   <Actions>


   <Clean Type="TemplateBased" TemplateFile="templates.mrv"/>


   </Actions>


</StandardizerConfiguration>








However, the next major release JChem 3.2 will support this task in the simple action string as well, in form of:





Code:



"clean:<template file>"








For command line access examples, try the following:





Code:



standardize -c tbc.xml t.mrv -f mrv








In JChem 3.2 the following will be equivalent:





Code:



standardize -c "clean:templates.mrv" t.mrv -f mrv








The file path is taken relative to the current directory but absolute file path is also accepted.





For API access, see the example in the


Standardizer class header, or refer to the Standardizer Developer's Guide.





I also attach some example code, you can test it by typing:





Code:



java TemplateBasedCleanTest "clean:templates.mrv" t.mrv


ChemAxon fb166edcbd

20-10-2005 12:16:57

I have added a method to Standardizer that sets the default template molecules to be used when the template file is not specified for the template based clean task:





Code:



public void setCleanTemplates(Molecule[] templates)





    Sets the default clean templates. Used in template based clean tasks that do not specify the template file:





        <Clean Type="TemplateBased"/>


        "clean:tb"





    Parameters:


        templates - is the template molecule array








In this way there is no need to refer to a file when Standardizer is used within a Java application.





This method will be available in JChem 3.2.