Class MajorMicrospeciesPlugin

java.lang.Object
chemaxon.marvin.plugin.CalculatorPlugin
chemaxon.marvin.calculations.MajorMicrospeciesPlugin
All Implemented Interfaces:
TaggedCalculator, chemaxon.license.Licensable

@PublicApi public class MajorMicrospeciesPlugin extends CalculatorPlugin
Plugin class that calculates the major microspecies on a given pH.

API usage example:

    // read input molecule
    MolImporter mi = new MolImporter("test.mol");
    Molecule mol = mi.read();
    mi.close();

    // create plugin
    MajorMicrospeciesPlugin plugin = new MajorMicrospeciesPlugin();

    // set pH
    plugin.setpH(7.4);

    // set target molecule
    plugin.setMolecule(mol);

    // run the calculation
    plugin.run();

    // get result
    Molecule msmol = plugin.getMajorMicrospecies();

    // print result
    System.out.println("Major microspecies at pH=7.4: "+msmol.toFormat("smiles"));
 

For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.

  • Constructor Details

    • MajorMicrospeciesPlugin

      public MajorMicrospeciesPlugin()
      Constructor. Creates the ionizer object.
  • Method Details

    • setMolecule

      public Molecule setMolecule(Molecule mol, boolean st, boolean om) throws PluginException
      Description copied from class: CalculatorPlugin
      Sets the input molecule after an optional standardization and/or modification. Standardization includes plugin specific standardization (e.g. dehydrogenize, aromatize) and sgroup expansion, modification usually means taking a microspecies form, or the major tautomeric form of the input molecule (usually optional). The input molecule is left unchanged (it is cloned before standardization/modification if required).
      Overrides:
      setMolecule in class CalculatorPlugin
      Parameters:
      mol - is the input molecule
      st - is true if standardization is required
      om - is true if original input molecule is to be used for atom indexing false if modified molecule is to be used for atom indexing
      Returns:
      the molecule to be used for atom indexing
      Throws:
      PluginException - on error
      See Also:
    • getProductName

      public String getProductName()
      Returns the product identifier of the plugin as given by LicenseManager.
      Specified by:
      getProductName in class CalculatorPlugin
      Returns:
      The identifier LicenseManager.PROTONATION_PLUGIN_GROUP
    • setParameters

      public void setParameters(Properties params) throws PluginException
      Sets the input parameters for the plugin. The parameters and value ranges:
      • pH: major microspecies on given pH is taken as input molecule if omitted then the input molecule is taken as it is
      • microspecies: "true" if major microspecies should be taken as input molecule (corresponds to 'take major microspecies' GUI checkbox)
      • msdistr: "true" if microspecies distributions should be calculated (default: "false")
      Overrides:
      setParameters in class CalculatorPlugin
      Parameters:
      params - is the parameter table
      Throws:
      PluginException - on error
    • setChemicalTermsArgument

      @Deprecated protected void setChemicalTermsArgument(String arg) throws PluginException
      Deprecated.
      Description copied from class: CalculatorPlugin
      Sets the argument string as specified in Chemical Terms expressions. This method may only be called from CalculatorPlugin.setChemicalTermsParameters(Properties, String).
      Overrides:
      setChemicalTermsArgument in class CalculatorPlugin
      Parameters:
      arg - The argument, never null. Its meaning is implementation-dependent.
      Throws:
      PluginException - on error
    • setpH

      public void setpH(double pH)
      Sets the pH: major microspecies on given pH is taken as input molecule if set to Double.NaN then the input molecule is taken as it is.
      Parameters:
      pH - is the pH value
    • getpH

      public double getpH()
      Returns the pH where the major microspecies should be taken. Returns Double.NaN if no microspecies calculation required.
      Overrides:
      getpH in class CalculatorPlugin
      Returns:
      the pH where the major microspecies should be taken or Double.NaN if no microspecies calculation
    • setInputMolecule

      protected void setInputMolecule(Molecule mol) throws PluginException
      Sets the input molecule.
      Specified by:
      setInputMolecule in class CalculatorPlugin
      Parameters:
      mol - is the input molecule
      Throws:
      PluginException - on error
    • setTakeMajorTatomericForm

      public void setTakeMajorTatomericForm(boolean takeMajorTautomericForm)
      Sets to use major tautomeric form in calculation. Default: false.
      Parameters:
      takeMajorTautomericForm - the calculation will be performed on the major tutomeric form of the input molecule if set (true)
      Since:
      Marvin 5.2
    • setCorrectionLibrary

      public void setCorrectionLibrary(String correctionLibraryId)
      Sets the correction library.
      Parameters:
      correctionLibraryId - is the correction library identifier
      Since:
      Marvin 21.16
    • setCorrectionLibraryPath

      public void setCorrectionLibraryPath(String correctionLibraryPath)
      Sets the correction library file directly.
      Since:
      Marvin 21.16
    • createModifiedInputMolecule

      protected final Molecule createModifiedInputMolecule(Molecule mol) throws PluginException
      Returns the major tautomeric form of the molecule.
      Overrides:
      createModifiedInputMolecule in class CalculatorPlugin
      Parameters:
      mol - is the input molecule
      Returns:
      the major tautomeric form of the molecule
      Throws:
      PluginException - on error
      Since:
      Marvin 5.2
    • run

      public boolean run() throws PluginException
      Stores the input molecule with ungrouped sgroups.
      Specified by:
      run in class CalculatorPlugin
      Returns:
      true if the calculation was successful, false on calculation error
      Throws:
      PluginException - on error
      See Also:
    • getMajorMicrospecies

      public Molecule getMajorMicrospecies() throws PluginException
      Returns the major microspecies at the pH set in setpH(double).
      Returns:
      the major microspecies
      Throws:
      PluginException - if run() has not been called beforehand
    • getMicrospeciesCount

      public int getMicrospeciesCount() throws PluginException
      Returns the number of microspecies
      Returns:
      the number of microspecies
      Throws:
      PluginException - on error
    • getMicrospecies

      public Molecule getMicrospecies(int index) throws PluginException
      Returns the microspecies molecule.
      Parameters:
      index - is the microspecies index
      Returns:
      the microspecies molecule
      Throws:
      PluginException - on error
    • getSortedMicrospecies

      public Molecule getSortedMicrospecies(int index) throws PluginException
      Returns the microspecies molecule, sorted by descreasing distribution at the given pH.
      Parameters:
      index - is the microspecies index
      Returns:
      the microspecies molecule
      Throws:
      PluginException - on error
    • getSortedMsDistribution

      public double getSortedMsDistribution(int index) throws PluginException
      Returns the microspecies distribution, sorted by descreasing distribution at the given pH.
      Parameters:
      index - is the microspecies index
      Returns:
      the microspecies distribution
      Throws:
      PluginException - on error
    • getResultTypes

      public Object[] getResultTypes()
      Returns the result types (possible types: "majority-ms").
      Overrides:
      getResultTypes in class CalculatorPlugin
      Returns:
      the result types
    • getResultDomain

      public int getResultDomain(Object type)
      Returns the calculation domain CalculatorPlugin.MOLECULE.
      Overrides:
      getResultDomain in class CalculatorPlugin
      Parameters:
      type - is the result type
      Returns:
      CalculatorPlugin.MOLECULE
      See Also:
    • getResultCount

      public int getResultCount(Object type)
      Returns the number of result items: 1.
      Overrides:
      getResultCount in class CalculatorPlugin
      Parameters:
      type - is the result type
      Returns:
      the number of result items
      See Also:
    • getResult

      public Object getResult(Object type, int index) throws PluginException
      Returns the microsepcies if pH is different from Double.NaN, otherwise returns the input molecule itself.
      Overrides:
      getResult in class CalculatorPlugin
      Parameters:
      type - is the result type ("major-ms", "ms", "ms-count" or "ms-distr")
      index - is the microspecies index
      Returns:
      the result item for the specified type and index
      Throws:
      PluginException - if the result cannot be returned
      See Also:
    • getResultAsString

      public String getResultAsString(Object type, int index, Object result) throws PluginException
      Returns the specified result molecule in SMILES format.
      Overrides:
      getResultAsString in class CalculatorPlugin
      Parameters:
      type - is the result type
      index - is the result index
      result - is the result item (molecule)
      Returns:
      the specified result in String format
      Throws:
      PluginException - if an invalid result item is given
    • getDisplayMolecule

      protected Molecule getDisplayMolecule() throws PluginException
      Returns the molecule object to be used for GUI display. This is the major microspecies returned by getMajorMicrospecies().
      Overrides:
      getDisplayMolecule in class CalculatorPlugin
      Returns:
      the molecule object to be used for GUI display
      Throws:
      PluginException - on error
    • getResultMolecule

      public Molecule getResultMolecule() throws PluginException
      Returns the major microspecies for display.
      Overrides:
      getResultMolecule in class CalculatorPlugin
      Returns:
      the major microspecies
      Throws:
      PluginException - on error
      Since:
      Marvin 4.0
    • getErrorMessage

      public String getErrorMessage()
      Returns the calculation error information message or the empty string if there is no error.
      Overrides:
      getErrorMessage in class CalculatorPlugin
      Returns:
      the calculation error information message
    • getIonizerErrorMessage

      public String getIonizerErrorMessage()
      Returns the calculation error information message or the empty string if there is no error.
      Returns:
      the calculation error information message
    • checkMolecule

      public void checkMolecule(Molecule mol) throws PluginException
      Checks the input molecule. Throws exception if the molecule molecule contains R-groups.
      Overrides:
      checkMolecule in class CalculatorPlugin
      Parameters:
      mol - is the input molecule
      Throws:
      PluginException - with error message for the user if the molecule is refused
    • standardize

      public void standardize(Molecule mol)
      Standardizes the molecule. Adds dehydrogenization to default standardization in case when major microsepcies calculation required.
      Overrides:
      standardize in class CalculatorPlugin
      Parameters:
      mol - is the molecule to be standardized
    • setKeepExplicitHydrogens

      public void setKeepExplicitHydrogens(boolean keepExplicitHydrogens)
      Sets if result molecule keeps explicit hydrogens or not
      Parameters:
      keepExplicitHydrogens - if the result should keep explicit hydrogens or not
    • handlesMultiFragmentMolecules

      public boolean handlesMultiFragmentMolecules()
      Returns true if the plugin handles multifragment molecules, false otherwise. This plugin handles multifragment molecules, so it returns true.
      Overrides:
      handlesMultiFragmentMolecules in class CalculatorPlugin
      Returns:
      true because this plugin handles multifragment molecules in case of salt type strutures.e.g.[Na+].CC([O-])=O