Class MajorMicrospeciesPlugin

  • All Implemented Interfaces:
    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 Detail

      • MajorMicrospeciesPlugin

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

      • 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
      • 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
      • 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.
        Parameters:
        correctionLibraryPath -
        Since:
        Marvin 21.16
      • 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
      • 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:
        getResultTypes()
      • 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
      • 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