Technical Support Forum Index
Technical Support Forum
Access ChemAxon scientists and developers here. For registration and login issues contact website support.

Support Ticket System is replacing forum

This forum was converted into a searchable archive. You cannot add posts here any more. For support please use our new Ticket System.

Create your first ticket
CFParameters construction failure under jython
To watch this topic for replies  Register (enables digests) or give email address:
This topic is locked: you cannot edit posts or make replies.
Display posts from previous:   
    View previous topic :: View next topic    
Author Message
Florent

Joined: 15 Dec 2009
Posts: 18

View user's profile

Back to top
Link to postPosted: Mon Nov 18, 2013 2:50 pmPost subject: CFParameters construction failure under jython Reply with quote

Hi,

I'm on ubuntu 11.10, with jchem-6.1.3, java version "1.7.0_25" and Jython 2.2.1.

I'm trying to calculate a tanimoto but it doesn't work anymore. (It worked under Jchem_5.11)

 

It sends me this error:

File "tanimoto_min.py", line 21, in ?
File "tanimoto_min.py", line 18, in main

at chemaxon.descriptors.MDParameters.initParameters(MDParameters.java:225)
    at chemaxon.descriptors.CFParameters.initParameters(CFParameters.java:192)
    at chemaxon.descriptors.CFParameters.setLength(CFParameters.java:141)
    at chemaxon.descriptors.CFParameters.<init>(CFParameters.java:73)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)

java.lang.RuntimeException: java.lang.RuntimeException: Failed to create default XML configuration.

 

I can obtain this error with a code as small as:

#!/etc/jython
 
import sys
import os
 
sys.path.append('/home/florent/ChemAxon/JChem/lib/chemaxon-core.jar')
sys.path.append('/home/florent/ChemAxon/JChem/lib/jchem.jar')
sys.path.append('/home/florent/ChemAxon/JChem/lib/jchem-descriptors.jar')
sys.path.append('/home/florent/ChemAxon/JChem/lib/jchem-reaction.jar')
sys.path.append('/home/florent/ChemAxon/JChem/lib/jchem-sss.jar')
 
from chemaxon.formats import *
from chemaxon.descriptors import *
 
def main():
 
    cfparams = CFParameters()
 
if __name__ == '__main__':
    main()

I tried to replace the cfparams line by :

cfparams = CFParameters('<Parameters Length="1024" BondCount="7" BitCount="2"/>')

And it gives me this error:

File "tanimoto_min.py", line 21, in ?
File "tanimoto_min.py", line 18, in main

at chemaxon.descriptors.CFParameters.processDocument(CFParameters.java:283)
    at chemaxon.descriptors.MDParameters.readFromXmlString(MDParameters.java:915)
    at chemaxon.descriptors.CFParameters.<init>(CFParameters.java:97)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)

chemaxon.descriptors.MDParametersException: chemaxon.descriptors.MDParametersException: Parameter configuration error.

So my question is: is this normal ?

Is there a new way to call CFParameters ? (Or you don't need to call CFParameters at all anymore ?)

Thank you for any light you can shed on the subject,

Florent.

László
ChemAxon personnel
Joined: 14 Jan 2011
Posts: 78

View user's profile

Back to top
Link to postPosted: Wed Nov 20, 2013 4:59 pmPost subject: Reply with quote

Dear Florent,

The imported JAR files in your scripts are incorrect. These files are changed in the current JChem version.
I have tested the CFP Tanimoto dissimilarity calculation with merged jchem lib (6.1.3) and the below script was running correctly.

#!/etc/jython
 
import sys
import os
 
sys.path.append('lib_jchem_6.1.3/jchem.jar')

sys.path.append('lib_jchem_6.1.3/com.chemaxon-core.jar')
sys.path.append('lib_jchem_6.1.3/com.chemaxon-io.jar')
sys.path.append('lib_jchem_6.1.3/com.chemaxon-io-smiles.jar')
sys.path.append('lib_jchem_6.1.3/com.chemaxon-common.jar')
sys.path.append('lib_jchem_6.1.3/com.chemaxon-concurrent.jar')
sys.path.append('lib_jchem_6.1.3/com.chemaxon-license.jar')

sys.path.append('lib_jchem_6.1.3/dom4j-1.6.1.jar')
 
from chemaxon.formats import *
from chemaxon.descriptors import *
 
def main():
    print 'Molecules: ' + sys.argv[1] + ' ' + sys.argv[2]
    
    m1 = MolImporter.importMol(sys.argv[1], 'smiles')
    m2 = MolImporter.importMol(sys.argv[2], 'smiles')
    param = CFParameters()
    cfp1 = ChemicalFingerprint(param)
    cfp1.generate(m1)
    cfp2 = ChemicalFingerprint(param)
    cfp2.generate(m2)
    
    dissimilarity = cfp1.getTanimoto(cfp2)    
    print 'Tanimoto dissimilarity:', dissimilarity
 
if __name__ == '__main__':
    main()

Example usage:  $ jython script.py CC CN


Best regards,
Laszlo

This topic is locked: you cannot edit posts or make replies.
Page 1 of 1


To watch this topic for replies   Register (enables digests) or give email address  
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum