Package org.openscience.cdk.interfaces

Examples of org.openscience.cdk.interfaces.IMolecularFormula


      String molecularFormula, double minAbundance, int charge,
      Polarity polarity) {

    IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();

    IMolecularFormula cdkFormula = MolecularFormulaManipulator
        .getMolecularFormula(molecularFormula, builder);

    return calculateIsotopePattern(cdkFormula, minAbundance, charge,
        polarity);
View Full Code Here


   * currently displayed and all their implicit and explicit Hs.
   *
   * @return The formula.
   */
  public String getFormula() {
    IMolecularFormula wholeModel = getIChemModel().getBuilder()
        .newInstance(IMolecularFormula.class);
    Iterator<IAtomContainer> containers = ChemModelManipulator
        .getAllAtomContainers(chemModel).iterator();
    int implicitHs = 0;
    while (containers.hasNext()) {
      for (IAtom atom : containers.next().atoms()) {
        wholeModel.addIsotope(atom);
        if (atom.getImplicitHydrogenCount() != null) {
          implicitHs += atom.getImplicitHydrogenCount();
        }
      }
    }
    try {
      if (implicitHs > 0)
        wholeModel
            .addIsotope(XMLIsotopeFactory.getInstance(
                wholeModel.getBuilder()).getMajorIsotope(1),
                implicitHs);
    } catch (IOException e) {
      // do nothing
    }
    return MolecularFormulaManipulator.getHTML(wholeModel, true, false);
View Full Code Here

     * Masses of elements are those of natural abundance. Isotopes are not considered.
     *
     * @return
     */
    public double getMolMass(){
        IMolecularFormula wholeModel = theJcpp.get2DHub().getIChemModel().getBuilder()
            .newInstance(IMolecularFormula.class);
        Iterator<IAtomContainer> containers = ChemModelManipulator
            .getAllAtomContainers(theJcpp.get2DHub().getIChemModel()).iterator();
        int implicitHs = 0;
        while (containers.hasNext()) {
            for (IAtom atom : containers.next().atoms()) {
                wholeModel.addIsotope(atom);
                if (atom.getImplicitHydrogenCount() != null) {
                    implicitHs += atom.getImplicitHydrogenCount();
                }
            }
        }
        try {
            if (implicitHs > 0)
                wholeModel.addIsotope(XMLIsotopeFactory.getInstance(
                        wholeModel.getBuilder()).getMajorIsotope(1),
                        implicitHs);
        } catch (IOException e) {
        // do nothing
        }
        return MolecularFormulaManipulator.getNaturalExactMass(wholeModel);
View Full Code Here

        return result;
    }

    public static void calculateExactMass(IMoleculeSet molSet, String formulaStringPropertyName) {
        double exactMass = 0.0;
        IMolecularFormula molecularFormula;
        //CDKHydrogenAdder ha = CDKHydrogenAdder.getInstance(DefaultChemObjectBuilder.getInstance());
        for (int i = 0; i < molSet.getAtomContainerCount(); i++) {
            if (!(((String) molSet.getMolecule(i).getProperty(formulaStringPropertyName)).isEmpty())) {
                molecularFormula = MolecularFormulaManipulator.getMolecularFormula((String) molSet.getMolecule(i).getProperty(formulaStringPropertyName), DefaultChemObjectBuilder.getInstance());
            } else {
View Full Code Here

TOP

Related Classes of org.openscience.cdk.interfaces.IMolecularFormula

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.