@Test public void testGetPrefferedImplByDescriptorID() { IEclipsePreferences prefs = new DefaultScope().getNode(Activator.PLUGIN_ID); assertNotNull(prefs); String prefsString = prefs.get(QSARConstants.QSAR_PROVIDERS_ORDER_PREFERENCE, null); assertNotNull(prefsString); System.out.println("Got prefs string: " + prefsString); DescriptorImpl impl = qsar.getPreferredImpl(chiChainID); assertNotNull(impl); System.out.println("pref impl: " + impl.getId()); // assertEquals("net.bioclipse.qsar.test.descriptor2", impl.getId()); System.out.println("wee"); }
@Test public void testCalculateMolDescMap() throws BioclipseException { IMolecule mol1 = new SMILESMolecule("C1CCCCC1CC(CC)CC"); IMolecule mol2 = new SMILESMolecule("C1CCCCC1CC(CC)CCCCCO"); Descriptor desc1 = qsar.getDescriptorByID(bpolID); Descriptor desc2 = qsar.getDescriptorByID(xlogpID); DescriptorImpl impl1 = qsar.getPreferredImpl(bpolID); DescriptorImpl impl2 = qsar.getPreferredImpl(xlogpID); DescriptorType dtype1 = qsar.createDescriptorType(null, null, desc1, impl1, null); DescriptorType dtype2 = qsar.createDescriptorType(null, null, desc2, impl2, null); Map<IMolecule, List<DescriptorType>> moldescmap = new HashMap<IMolecule, List<DescriptorType>>(); List<DescriptorType> list1 = new ArrayList<DescriptorType>(); list1.add(dtype1); list1.add(dtype2); moldescmap.put(mol1, list1); List<DescriptorType> list2 = new ArrayList<DescriptorType>(); list2.add(dtype2); moldescmap.put(mol2, list2); Map<? extends IMolecule, List<IDescriptorResult>> res = qsar.doCalculation(moldescmap, new NullProgressMonitor()); assertNotNull("QSAR calculation returned NULL", res); assertNotNull(res); List<IDescriptorResult> res1 = res.get(mol1); List<IDescriptorResult> res2 = res.get(mol2); assertEquals(2, res1.size()); assertEquals(1, res2.size()); IDescriptorResult dres1 = res1.get(0); IDescriptorResult dres11 = res1.get(1); IDescriptorResult dres2 = res2.get(0); assertNull(dres1.getErrorMessage()); assertNull(dres11.getErrorMessage()); assertNull(dres2.getErrorMessage()); System.out.println( "Mol: " + mol1.toSMILES() + " ; Desc: " + dres1.getDescriptor().getOntologyid() + ": "); for (int i = 0; i < dres1.getValues().length; i++) { System.out.println(" " + dres1.getLabels()[i] + "=" + dres1.getValues()[i]); } System.out.println( "Mol: " + mol1.toSMILES() + " ; Desc: " + dres11.getDescriptor().getOntologyid() + ": "); for (int i = 0; i < dres11.getValues().length; i++) { System.out.println(" " + dres11.getLabels()[i] + "=" + dres11.getValues()[i]); } System.out.println( "Mol: " + mol2.toSMILES() + " ; Desc: " + dres2.getDescriptor().getOntologyid() + ": "); for (int i = 0; i < dres2.getValues().length; i++) { System.out.println(" " + dres2.getLabels()[i] + "=" + dres2.getValues()[i]); } assertEquals("bpol", dres1.getLabels()[0]); assertEquals(new Float(26.236967), dres1.getValues()[0]); assertEquals("XLogP", dres11.getLabels()[0]); assertEquals(new Float(6.706), dres11.getValues()[0]); assertEquals("XLogP", dres2.getLabels()[0]); assertEquals(new Float(6.648), dres2.getValues()[0]); }