/** * Clones this IsotopeContainer object and its content. * * @return The cloned object */ @Override public Object clone() throws CloneNotSupportedException { IsotopeContainer isoClone = new IsotopeContainer(); isoClone.forms.addAll(getFormulas()); isoClone.setIntensity(getIntensity()); isoClone.setMass(getMass()); return isoClone; }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testIsotopeContainer() { IsotopeContainer isoC = new IsotopeContainer(); Assert.assertNotNull(isoC); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testSetMass_double() { IsotopeContainer isoC = new IsotopeContainer(); isoC.setMass(130.00); Assert.assertNotNull(isoC); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testSetIntensity_double() { IsotopeContainer isoC = new IsotopeContainer(); isoC.setIntensity(5000000.0); Assert.assertNotNull(isoC); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testGetIsotopes() { IsotopePattern isoP = new IsotopePattern(); IsotopeContainer iso1 = new IsotopeContainer(); isoP.setMonoIsotope(iso1); IsotopeContainer iso2 = new IsotopeContainer(); isoP.addIsotope(iso2); Assert.assertEquals(iso1, isoP.getIsotopes().get(0)); Assert.assertEquals(iso2, isoP.getIsotopes().get(1)); }
/** * Sets the parameters attribute of the IsotopePatternRule object. * * @param params The new parameters value * @throws CDKException Description of the Exception * * @see #getParameters */ @Override public void setParameters(Object[] params) throws CDKException { if (params.length != 2) throw new CDKException("IsotopePatternRule expects two parameter"); if (!(params[0] instanceof List)) throw new CDKException("The parameter one must be of type List<Double[]>"); if (!(params[1] instanceof Double)) throw new CDKException("The parameter two must be of type Double"); pattern = new IsotopePattern(); for (double[] listISO : (List<double[]>) params[0]) { pattern.addIsotope(new IsotopeContainer(listISO[0], listISO[1])); } is.seTolerance((Double) params[1]); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testGetNumberOfIsotopes() { IsotopePattern isoP = new IsotopePattern(); IsotopeContainer iso1 = new IsotopeContainer(); isoP.setMonoIsotope(iso1); IsotopeContainer iso2 = new IsotopeContainer(); isoP.addIsotope(iso2); Assert.assertEquals(2, isoP.getNumberOfIsotopes()); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testGetMass() { IsotopeContainer isoC = new IsotopeContainer(); double mass = 130.00; isoC.setMass(mass); Assert.assertEquals(mass, isoC.getMass(), 0.001); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testAddIsotope_IsotopeContainer() { IsotopePattern isoP = new IsotopePattern(); isoP.addIsotope(new IsotopeContainer()); Assert.assertNotNull(isoP); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testSetFormula_IMolecularFormula() { IsotopeContainer isoC = new IsotopeContainer(); IMolecularFormula formula = builder.newInstance(IMolecularFormula.class); isoC.setFormula(formula); Assert.assertNotNull(isoC); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testSetMonoIsotope_IsotopeContainer() { IsotopePattern isoP = new IsotopePattern(); isoP.setMonoIsotope(new IsotopeContainer()); Assert.assertNotNull(isoP); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testGetIntensity() { IsotopeContainer isoC = new IsotopeContainer(); double intensity = 130.00; isoC.setIntensity(intensity); Assert.assertEquals(intensity, isoC.getIntensity(), 0.001); }
/** * Histidine example * * @throws Exception */ @Test public void testCompare_IsotopePattern_IsotopePattern() { IsotopePatternSimilarity is = new IsotopePatternSimilarity(); IsotopePattern spExp = new IsotopePattern(); spExp.setMonoIsotope(new IsotopeContainer(156.07770, 1)); spExp.addIsotope(new IsotopeContainer(157.07503, 0.0004)); spExp.addIsotope(new IsotopeContainer(157.08059, 0.0003)); spExp.addIsotope(new IsotopeContainer(158.08135, 0.002)); IMolecularFormula formula = MolecularFormulaManipulator.getMajorIsotopeMolecularFormula("C6H10N3O2", builder); IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(0.1); IsotopePattern patternIsoPredicted = isotopeGe.getIsotopes(formula); IsotopePattern patternIsoNormalize = IsotopePatternManipulator.normalize(patternIsoPredicted); double score = is.compare(spExp, patternIsoNormalize); Assert.assertNotSame(0.0, score); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testGetIsotope_int() { IsotopePattern isoP = new IsotopePattern(); IsotopeContainer iso1 = new IsotopeContainer(); isoP.setMonoIsotope(iso1); IsotopeContainer iso2 = new IsotopeContainer(); isoP.addIsotope(iso2); Assert.assertEquals(iso1, isoP.getIsotope(0)); Assert.assertEquals(iso2, isoP.getIsotope(1)); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testGetMonoIsotope() { IsotopePattern isoP = new IsotopePattern(); IsotopeContainer isoC = new IsotopeContainer(); isoP.setMonoIsotope(isoC); Assert.assertEquals(isoC, isoP.getMonoIsotope()); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testGetFormula() { IsotopeContainer isoC = new IsotopeContainer(); IMolecularFormula formula = builder.newInstance(IMolecularFormula.class); isoC.setFormula(formula); Assert.assertEquals(formula, isoC.getFormula()); }
/** * Real example. Lipid PC * * @throws Exception */ @Test public void testExperiment() { IsotopePattern spExp = new IsotopePattern(); spExp.setMonoIsotope(new IsotopeContainer(762.6006, 124118304)); spExp.addIsotope(new IsotopeContainer(763.6033, 57558840)); spExp.addIsotope(new IsotopeContainer(764.6064, 15432262)); spExp.setCharge(1.0); IMolecularFormula formula = MolecularFormulaManipulator.getMajorIsotopeMolecularFormula("C42H85NO8P", SilentChemObjectBuilder.getInstance()); IsotopePatternGenerator isotopeGe = new IsotopePatternGenerator(0.01); IsotopePattern patternIsoPredicted = isotopeGe.getIsotopes(formula); IsotopePatternSimilarity is = new IsotopePatternSimilarity(); double score = is.compare(spExp, patternIsoPredicted); Assert.assertEquals(0.97, score, .01); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testIsotopeContainer_double_double() { double mass = 130.00; double intensity = 500000.00; IsotopeContainer isoC = new IsotopeContainer(mass, intensity); Assert.assertNotNull(isoC); Assert.assertEquals(mass, isoC.getMass(), 0.001); Assert.assertEquals(intensity, isoC.getIntensity(), 0.001); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testIsotopeContainer_IMolecularFormula_double() { IMolecularFormula formula = builder.newInstance(IMolecularFormula.class); double intensity = 130.00; IsotopeContainer isoC = new IsotopeContainer(formula, intensity); Assert.assertNotNull(isoC); Assert.assertEquals(formula, isoC.getFormula()); Assert.assertEquals(intensity, isoC.getIntensity(), 0.001); }
/** * A unit test suite for JUnit. * * @return The test suite */ @Test public void testClone() throws Exception { IsotopeContainer isoC = new IsotopeContainer(); IMolecularFormula formula = builder.newInstance(IMolecularFormula.class); isoC.setFormula(formula); double mass = 130.00; isoC.setMass(mass); double intensity = 130.00; isoC.setIntensity(intensity); IsotopeContainer clone = (IsotopeContainer) isoC.clone(); Assert.assertEquals(mass, clone.getMass(), 0.001); Assert.assertEquals(intensity, clone.getIntensity(), 0.001); Assert.assertEquals(formula, clone.getFormula()); }