I have moved this topic to the appropriate forum. The experts will respond soon.
Thanks ebuki, I will be looking forward.
According to the description you sent, you would require the ChemAxon class files located in a directory. In an installed JChem, these class files are located in .jar files, from which they can be extracted. To do this, follow these steps:
FOR /f %i IN ('dir /b "c:\Program Files\ChemAxon\JChem\lib\*.jar"') do jar xf "c:\Program Files\ChemAxon\JChem\lib\%i"
These steps should allow ChemAxon classes in your MatLab. Try it with entering e.g. the following expression:
You should get ans=6 as a reply. (As far as I understand the usage of JAVA classes inside MatLab, but I have never tried it.)
Once you can use ChemAxon classes in MatLab, I can give you further instructions on the usage of MCES.
Thanks a lot Peter.
I tried your suggestion but the jar command did not work in my machine
'jar' is not recognized as an in
operable program or batch file.
However, the .jar files you pointed to can be feed into MatLab without unpacking them. The explanation is here http://www.ew2008.org/matlab/techdoc/matlab_external/ch_java3.html under 'Making Classes in a JAR File Available'. I did what they say and then tried the command
Error: The input character is not valid in MATLAB statements or expressions.
and it fails as well as the MatLab version with single quotes,
??? No method 'importMol' with matching signature found for class 'chemaxon.formats.MolImporter'.
>> inst = chemaxon.formats.MolImporter;
>> which importMol
importMol is a Java method % chemaxon.formats.MolImporter method
Methods for class chemaxon.formats.MolImporter:
MolImporter getMoleculeIterator isRewindable setOptionFlags
close getOptionFlags nextDoc setOptions
createMol getOptions notify setQueryMode
equals getQueryMode notifyAll setThreadCount
estimateNumRecords getRecordCount read skipRecord
getClass getRecordCountMax readDoc skipToNext
getDocLabel hashCode readMol tell
getFile importDoc readRecordAsText toString
getFileName importMol seekForward wait
getFormat isEndReached seekRecord
getGlobalProperties isGrabbingEnabled seekRecordAtFraction
getGrabbedMoleculeString isMolMovie setFileName
getLineCount isMultiSet setGrabbingEnabled
This seems to be working. Then I keep trying,
>> inst.importMol = 'C1C(=O)CCC1';
??? No public field importMol exists for class chemaxon.formats.MolImporter.
and failed, but this one worked,
ans = Molecule@138b0d5[6a,6b]
as well as this one,
ans = 6
But this one didn't,
??? Undefined variable "importMol" or class "importMol".
while these two did,
>> x = inst.importMol('C1C(=O)CCC1')
x = Molecule@10d08bc[6a,6b]
ans = 6
So, chemaxon classes are working from within MatLab.
Can you give me further instructions on the usage of MCES?
Thank you for the several examples. I'm glad to hear that you managed to enable ChemAxon classes in MatLab.
Here is a short example how to use MCES in MatLab:
importer = chemaxon.formats.MolImporter
mol1 = importer.importMol('C1C(=O)CCC1')
mol2 = importer.importMol('CC(=O)C1CCCC1')
mces = chemaxon.sss.search.MCES
mces_atom_count = mces.getAtomCount()
mces_bond_count = mces.getBondCount()
mces_smiles = mces.getAsMolecule().toFormat('smiles')
This first three lines import two structures and store them in mol1 and mol2 variables. The second block performs MCES search, while the last three lines perform queries of the found MCES. I hope it will work, I could not try it currently as I don't have MatLab. You should get mces_smiles = 'C1CCCC1' as a result.
Thanks again. All the commands worked till the search. Below you can see the error message. Apparently, I don't have permission to exucute this command. I asked for an academic license but I haven't got any confirmation yet. I will contact the sale department, but if you have any comment I would appreciate it.
??? Java exception occurred:
chemaxon.license.LicenseException: No license file found.
Product name: MCES
Please contact firstname.lastname@example.org to obtain the corresponding license.
Students and academic researchers are entitled of free use
through our Academic Package, for more information
please visit: http://www.chemaxon.com/acpack_conditions.html
at chemaxon.license.LicenseHandler.checkLicense(Unknown Source)
If you have contacted email@example.com, you will get an acedemic license file soon. This file (license.cxl) should be copied to your user profile in chemaxon directory, i.e. c:\Users\<username>\chemaxon on Win7 or c:\Documents and Settings\<username>\chemaxon on Win XP.
Let me know if you received the license file and you tried the sample codes again.
I finally got the academic license and did as you told and everything run OK. I keep working and if get stuck come back to you.
Thanks a lot.
I'm glad to hear that.