Jarvis Patrick API / JARP command line differences

User 8052c55234

09-07-2014 09:33:14

I am interested in Jarvis-Patrick clustering, and I met two difficulties:


 


1) First, I initially try to implement the command line


jarp -i "/home/X/Desktop/JavaProject/testJP" -c 0.1 -t 1.6 -f 0 -m 3 -z -y


it in a java code with:
       


         JarvisPatrick jp=new JarvisPatrick();       
         try {
            jp.setInput("/home/X/Desktop/JavaProject/testJP");
        } catch (FileNotFoundException e1) {

              e1.printStackTrace();
        }
         jp.setMinCommonRatio(0.1f); //-c
         jp.setThreshold(1.6f); //-t
         jp.setFpSize(0); // -f
         jp.setDimensions(2); // -m
         jp.setStatNeeded(true); // -z
         try {
            jp.run();
        } catch (ClusteringException | IOException | SQLException| InvalidLicenseKeyException e) {
            e.printStackTrace();
        }


 


But it give me the following error:
Exception in thread "main" java.lang.NullPointerException
    at chemaxon.clustering.JarvisPatrick.run(JarvisPatrick.java:348)
    at Clustering.JarvisPatrickClustering.<init>(JarvisPatrickClustering.java:55)
    at main.runJarvisPatrick.main(runJarvisPatrick.java:14)


 


It should be note that the command line work well.

Is there any specific option I do not gave?


 


-----




2) Second, I would like to be sure about the data to give as input file.


Initially, I gave a neighbors matrix (with 0 and 1), but based on a previous post, https://www.chemaxon.com/forum/viewpost2909.html


I do a matrix distances as follow:

251 0.000 0.890 0.913 0.915 0.954 0.923 0.891 0.900 0.962 0.888
252 0.890 0.000 0.891 0.838 0.935 0.929 0.805 0.896 0.944 0.845
253 0.913 0.891 0.000 0.908 0.905 0.907 0.883 0.909 0.921 0.871
254 0.915 0.838 0.908 0.000 0.916 0.942 0.879 0.862 0.907 0.892
255 0.954 0.935 0.905 0.916 0.000 0.805 0.891 0.917 0.798 0.955
256 0.923 0.929 0.907 0.942 0.805 0.000 0.844 0.919 0.906 0.925
257 0.891 0.805 0.883 0.879 0.891 0.844 0.000 0.911 0.914 0.877
258 0.900 0.896 0.909 0.862 0.917 0.919 0.911 0.000 0.908 0.902
259 0.962 0.944 0.921 0.907 0.798 0.906 0.914 0.908 0.000 0.931
260 0.888 0.845 0.871 0.892 0.955 0.925 0.877 0.902 0.931 0.000


 


jarp -i "/data/txt" -c 0.01 -t 0.9 -f 0 -m 10 -z -y


I obtain only singletons, even if by looking the matrix, a lot of compounds have a distance lower than the the threshold t of 0.9 and satisfy the common neighbors percentage.


Is there any complement information/problem in my understood in this point?


Any helps for one or both points are welcome

User 8052c55234

14-07-2014 12:51:05

I really need an urgent help about this issue, please.


I will appreciate it a lot if you spare even a little time.

ChemAxon 8b644e6bf4

18-07-2014 16:46:02

Apologies for the late answer. What JChem version are you using? What is your use case? Could other clustering method (sphere exclusion/wards/single- complete- or full linkage) be suitable? What is your input set size?


 


Regards,


Gabor

User 8052c55234

23-07-2014 08:18:06

Dear Gabor,


the JChem version I use is jchem-6.2.2. I want actually test different metrics for our academic projec, and Jarvis Patrick is actually need.


 


Thank you for the help,


 

ChemAxon 8b644e6bf4

23-07-2014 16:29:43

Dear Marianne,


 


The offending line in JarvisPatrick.java:348 is


if(!onlyStat)
            output.printHeader(showCentroids);

Output must be set using setOutput() methods.


Regarding the input file: the lines are interpreted as individual 10 dimensional floating point descriptors; distance matrix input is not supported.


Regards,


Gabor